Page 2 of 4

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 20:00
by freijn
i did , and if i do the url manual i get the response with a lot of content

Perhaps.......

how did you create the script ? as a file directly in the directory or (as i did ) in the gui interface ?

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 20:01
by McMelloW
freijn wrote: Friday 22 May 2020 20:00 i did , and if i do the url manual i get the response with a lot of content

Perhaps.......

how did you create the script ? as a file directly in the directory or (as i did ) in the gui interface ?
Just in the gui. save it. switch it on and saved it again. Then it is active in generated scripts

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 20:10
by freijn
What type of script ? timer I assume ?

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 20:26
by McMelloW
Copy - Paste from dzRequestSolarInfo.lua at github in the event gui.
Then saved it.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 21:04
by freijn
Hi Richard,

Very interested in your code but somehow I can't get it to work :-(

Below my extra debug steps.
Below that the logfile of it.

of course I double checked my login password and site-id. Just thinking, could the capta be the issue here?

Code: Select all

--------------------------------------------------------------------------------
    execute = function(domoticz, item)
--------------------------------------------------------------------------------
        if (item.isTimer) then
            LogDebug(domoticz, "-=[ Start HTTP Request]=======================================")
            RequestSolardEdge(domoticz)
        elseif (item.isHTTPResponse) then
            LogDebug(domoticz, "-=[ Start HTTP Response ]=====================================")
            if (item.ok) then
                LogDebug(domoticz, "Item.ok")
                local info = { Inverters = {}, Strings = {}, Optimizers = {} }
                LogDebug(domoticz,info)
                for _, child in pairs(item.json.logicalTree.children) do
                    LogDebug(domoticz, "Loop GetInverterDatar")
                    local inverter = GetInverterData(item.json, info, child)
                    if inverter then
                        table.insert(info.Inverters, inverter)
                    end
                end
                
                for _, device in ipairs(info.Inverters) do
                    LogDebug(domoticz, "Loop Inverters")
                    UpdateDevice(domoticz, "Inverter", device)
                end
                
                for _, device in ipairs(info.Strings) do
                    LogDebug(domoticz, "Loop String")
                    UpdateDevice(domoticz, "String", device)
                end
                
                for _, device in ipairs(info.Optimizers) do
                    LogDebug(domoticz, "Loop Optimizer")
                    UpdateDevice(domoticz, "Optimizer", device)
                end
            else
                LogDebug(domoticz, string.format("Error in HTTP request. Error %d - %s", item.statusCode, item.statusText))
            end
        end
  
        LogDebug(domoticz, "-=[ End ]=====================================================")
 	end
}

Code: Select all

2020-05-22 20:58:00.375 Status: dzVents: dzRequestSolarInfo : -=[ Start HTTP Request]=======================================
2020-05-22 20:58:00.375 Status: dzVents: dzRequestSolarInfo : https://monitoring.solaredge.com/solaredge-apigw/api/sites/480XXX/layout/logical
2020-05-22 20:58:00.375 Status: dzVents: dzRequestSolarInfo : -=[ End ]=====================================================
2020-05-22 20:58:03.335 Status: dzVents: dzRequestSolarInfo : -=[ Start HTTP Response ]=====================================
2020-05-22 20:58:03.335 Status: dzVents: dzRequestSolarInfo : Item.ok
2020-05-22 20:58:03.335 Status: dzVents: dzRequestSolarInfo : table: 0xad15cdc0
2020-05-22 20:58:03.335 Status: dzVents: dzRequestSolarInfo : -=[ End ]=====================================================
2020-05-22 20:58:08.052 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/dzRequestSolarInfo.lua
2020-05-22 20:59:02.555 Status: dzVents: dzRequestSolarInfo : -=[ Start HTTP Response ]=====================================
2020-05-22 20:59:02.555 Status: dzVents: dzRequestSolarInfo : Item.ok
2020-05-22 20:59:02.555 Status: dzVents: dzRequestSolarInfo : table: 0xa61a7338
2020-05-22 20:59:02.555 Status: dzVents: dzRequestSolarInfo : Loop GetInverterDatar
2020-05-22 20:59:02.555 Status: dzVents: dzRequestSolarInfo : -=[ End ]=====================================================

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 21:21
by McMelloW
Hmmm, strange.

Just copy / paste the script from github. Change the lines for email, password and siteID. Saved it and switched to active.
It works like a charm. See my output in previous posting.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 21:31
by freijn
Richard,

I had to change :

if component.data and component.data.type == "INVERTER" then

into :

if component.data and component.data.type == "INVERTER_3PHASE" then

Now its working!

Cheers,

Frank

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 21:34
by McMelloW
Today, I discover a difference in values of my Daily Energy Production. See picture below.
SE-DailyProduction.png
SE-DailyProduction.png (23.69 KiB) Viewed 2550 times
Actueel Vermogen SE = directly taken from the Inverter via a LAN connection to my RPi
Inverter 1 = With the use of the lua script from the Solaredge Monitor website
String 1.1 = With the use of the lua script from the Solaredge Monitor website

Why do I have 3 different values of Vandaag, all 3 from the same inverter.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 22:15
by Dols
McMelloW wrote: Friday 22 May 2020 12:21 Hello Richard,

Is there no figure for the Total Lifetime Energy? (Totale energie) I could not find it in the test output.
https://monitoring.solaredge.com/solare ... ut/logical

imo This a counter within the Inverter? At least it is also available on the monitor homepage.
SolarEdgeHeader.png
Not in that json file. Maybe with different uri. I haven't found it yet. But even then, looks like its only for the inverter, not for the individual optimizer. Thinking about this, the original web hardware already does this.

Not having tot the total energy gives some problems with the day graphs, which needs a continuous increasing value.

In my commit of may 21, i have the first attempt to calculate the "total" energy from the cumulative day energy. It failed. Currently testing a second attempt. Will take a few days to verify if this works correctly.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 22:23
by McMelloW
Dols wrote: Friday 22 May 2020 22:15
Not in that json file. Maybe with different uri. I haven't found it yet. But even then, looks like its only for the inverter, not for the individual optimizer. Thinking about this, the original web hardware already does this.

Not having tot the total energy gives some problems with the day graphs, which needs a continuous increasing value.

In my commit of may 21, i have the first attempt to calculate the "total" energy from the cumulative day energy. It failed. Currently testing a second attempt. Will take a few days to verify if this works correctly.
Thanks for your answer.
Getting the information directly from the inverter via a LAN connection contains the total lifetime production. See my picture "Totaal Vermogen SE"

Can I redirect the the http respond to a file, so I can investigate all information received from Solaredge.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 22:30
by Dols
freijn wrote: Friday 22 May 2020 21:04 [..]
Looks like it can't find the data. Some items in the json are localized. What is you language setting in you solaredge monitoring web site? Can be found under account settings. My guess is that you have metric setting and language dutch. That should work.

Never mind, you found the real problem. :D

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 22:36
by Dols
freijn wrote: Friday 22 May 2020 21:31 I had to change :
if component.data and component.data.type == "INVERTER" then
into :
if component.data and component.data.type == "INVERTER_3PHASE" then

Now its working!
If you want can you send me one json result? I have just a 1 phase converter. I want to check if there is more different.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 22:55
by Dols
McMelloW wrote: Friday 22 May 2020 21:34 Today, I discover a difference in values of my Daily Energy Production. See picture below.

SE-DailyProduction.png

Actueel Vermogen SE = directly taken from the Inverter via a LAN connection to my RPi
Inverter 1 = With the use of the lua script from the Solaredge Monitor website
String 1.1 = With the use of the lua script from the Solaredge Monitor website

Why do I have 3 different values of Vandaag, all 3 from the same inverter.
What does the solaredge website say?

I don't trust my calculation to have continuous increase energy value. It has some problems on the daily rollover. I just committed a change that disables the calculation.

Re: SolarEdge individual optimizer dzVents script

Posted: Friday 22 May 2020 23:07
by McMelloW
Dols wrote: Friday 22 May 2020 22:55 What does the solaredge website say?

I don't trust my calculation to have continuous increase energy value. It has some problems on the daily rollover. I just committed a change that disables the calculation.
This makes even more complicated. An 4th number 10.92 kWh

Re: SolarEdge individual optimizer dzVents script

Posted: Saturday 23 May 2020 0:42
by Dols
McMelloW wrote: Friday 22 May 2020 12:21 Hello Richard,

Is there no figure for the Total Lifetime Energy? (Totale energie) I could not find it in the test output.
https://monitoring.solaredge.com/solare ... ut/logical

imo This a counter within the Inverter? At least it is also available on the monitor homepage.
SolarEdgeHeader.png
Hmm, total energy of the optimizers can be found with next url. But it is an HTTP POST and needs an session ID.....

https://monitoring.solaredge.com/solare ... meUnit=ALL

timeUnit can be "DAY", "WEEK", "MONTH", "YEAR", "ALL". And with ALL i get the strange reading.

Re: SolarEdge individual optimizer dzVents script

Posted: Saturday 23 May 2020 1:32
by McMelloW
Dols wrote: Saturday 23 May 2020 0:42 Hmm, total energy of the optimizers can be found with next url. But it is an HTTP POST and needs an session ID.....

https://monitoring.solaredge.com/solare ... meUnit=ALL

timeUnit can be "DAY", "WEEK", "MONTH", "YEAR", "ALL". And with ALL i get the strange reading.
In this api guide http://www.solaredge.com/files/pdfs/se_ ... ng_api.pdf They speak about "lifetime" But not all API's return with this value.
Do you use the same API guide?

Re: SolarEdge individual optimizer dzVents script

Posted: Saturday 23 May 2020 9:48
by freijn
Dols wrote: Friday 22 May 2020 22:36
freijn wrote: Friday 22 May 2020 21:31 I had to change :
if component.data and component.data.type == "INVERTER" then
into :
if component.data and component.data.type == "INVERTER_3PHASE" then

Now its working!
If you want can you send me one json result? I have just a 1 phase converter. I want to check if there is more different.
in your inbox

Re: SolarEdge individual optimizer dzVents script

Posted: Saturday 23 May 2020 12:04
by McMelloW
Quick question.
What is the difference in the device options Computed or From Device?

Re: SolarEdge individual optimizer dzVents script

Posted: Saturday 23 May 2020 14:54
by Dols
McMelloW wrote: Saturday 23 May 2020 12:04 Quick question.
What is the difference in the device options Computed or From Device?
"computed" it does not use the energy (Kwh) information provided, but instead in calculates (integrates) the power (Watt) instead. This is typically used when there is no (reliable) energy information available.

"from device" stores the energy (Kwh) as provided. It expects this to be an ever growing number to work correctly. (total energy). Providing it with the day energy will break the day graph, maybe some other stuff too.

Re: SolarEdge individual optimizer dzVents script

Posted: Saturday 23 May 2020 15:17
by Dols
McMelloW wrote: Saturday 23 May 2020 1:32 In this api guide http://www.solaredge.com/files/pdfs/se_ ... ng_api.pdf They speak about "lifetime" But not all API's return with this value.
Do you use the same API guide?
No i don't use the official API. I use the API the monitoring website is using. Found a hint somewhere on the internet, from there it's reverse engineering.