SolarEdge individual optimizer dzVents script

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Friday 22 May 2020 21:34 Actueel Vermogen SE = directly taken from the Inverter via a LAN connection to my RPi
Any good hints to open up my inverter to my lan?

I have a brand new SE5000H, debug mode disabled, no port 80 or 8080. I have firmware version 4.8.28 which has a security hole, with a bash/python script it possible to open up those ports. But a new firmware is already release which closes this hole (4.9.33). I don't want to shield off the complete inverter from the internet.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by freijn »

Yes , of course.

You can enable modbus over lan and use my adapted Python script (posted in an other thread) to read all directly from the inverter.

However.. on that data I have not seen the optimizers listed... :-(
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Saturday 23 May 2020 15:17
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.
:D :D I guess we are talking about the same. Go to this page

https://monitoring.solaredge.com/solare ... siteAccess

At the bottom you see a link Read the API Guide That is the above link to the api guide.
Greetings McMelloW
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Saturday 23 May 2020 15:28
McMelloW wrote: Friday 22 May 2020 21:34 Actueel Vermogen SE = directly taken from the Inverter via a LAN connection to my RPi
Any good hints to open up my inverter to my lan?

I have a brand new SE5000H, debug mode disabled, no port 80 or 8080. I have firmware version 4.8.28 which has a security hole, with a bash/python script it possible to open up those ports. But a new firmware is already release which closes this hole (4.9.33). I don't want to shield off the complete inverter from the internet.
See this topic. https://www.domoticz.com/forum/viewtopi ... 94#p168694

Configured my inverter for Modbus over TCP via LAN according this document (You need a cabled lAN connection for your inverter.)
https://www.solaredge.com/sites/default ... l-note.pdf

Then I used perl script sunpsec-monitor https://github.com/tjko/sunspec-monitor to read-out the registers of the inverter. But cannot read the optimizers. The output of this script goes to a .txt file. This file is parsed by a dzVents script and updates the dummy devices.
So it is a kindop 3-stage-rocket But is t works sufficient so far.

I think Freijn made an advanced script in python.
There is also a python sunspec-ardexa option. https://github.com/ardexa/sunspec-inverters However I did not get this working on my RPi
Greetings McMelloW
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Saturday 23 May 2020 16:23
Dols wrote: Saturday 23 May 2020 15:17
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.
:D :D I guess we are talking about the same. Go to this page

https://monitoring.solaredge.com/solare ... siteAccess

At the bottom you see a link Read the API Guide That is the above link to the api guide.
No its not the same API. The document refers to the api for actual customer use. The API I'm using is the API of the website itself, thats why it needs username and password instead of the api key. It request the data from the "normal" website as if it was for the layout webpage.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Saturday 23 May 2020 17:42 No its not the same API. The document refers to the api for actual customer use. The API I'm using is the API of the website itself, thats why it needs username and password instead of the api key. It request the data from the "normal" website as if it was for the layout webpage.
Where can i find the descriptionof this API?

When you the data from the website, you must be able to get the lifetime total, because it is displayed on the website.
Greetings McMelloW
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Saturday 23 May 2020 19:32 Where can i find the descriptionof this API?

When you the data from the website, you must be able to get the lifetime total, because it is displayed on the website.
I don't have any documentation of this api. But you can try to find what you looking for:

- In Firefox (or chrome) press [F12] to open the developer tools.
- In top bar of the opened window select "Network"
- Open your monitoring.solaredge.com website.
- In the right pane, select response
- You can browse through the files/request see if you can find you are looking for

Maybe this is the url you are looking for?
https://monitoring.solaredge.com/solare ... es/XXXXXXX
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

Hmmm,

The optimizer data is not updated anymore at the solaredge website. Funny thing is the inverter data is updated. Yesterday evening it still worked. I used the setapp to enable modbus over tcp yesterday afternoon.

Don't know if i did something wrong with the setapp or solaredge just cut me off...
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

Dols wrote: Sunday 24 May 2020 9:49 Hmmm,

The optimizer data is not updated anymore at the solaredge website. Funny thing is the inverter data is updated. Yesterday evening it still worked. I used the setapp to enable modbus over tcp yesterday afternoon.

Don't know if i did something wrong with the setapp or solaredge just cut me off...
Okay, didn't apply to the first rule of problem solving "Did you turn it off and on again?". It looks like it's updating the website with the missing historical data on a very slow rate......
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Saturday 23 May 2020 16:42 Then I used perl script sunpsec-monitor https://github.com/tjko/sunspec-monitor to read-out the registers of the inverter. But cannot read the optimizers. The output of this script goes to a .txt file. This file is parsed by a dzVents script and updates the dummy devices.
So it is a kindop 3-stage-rocket But is t works sufficient so far.
I have it running. Thanks.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Sunday 24 May 2020 13:49
McMelloW wrote: Saturday 23 May 2020 16:42 Then I used perl script sunpsec-monitor https://github.com/tjko/sunspec-monitor to read-out the registers of the inverter. But cannot read the optimizers. The output of this script goes to a .txt file. This file is parsed by a dzVents script and updates the dummy devices.
So it is a kind of 3-stage-rocket But it works sufficient so far.
I have it running. Thanks.
Good work, well done.
What do you do with the output of the Perl script.
Greetings McMelloW
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Sunday 24 May 2020 14:38 Good work, well done.
What do you do with the output of the Perl script.
I do it a little different.

I use a dzVent script. It is triggered by the P1 smart meter (every second).
The dzVent script runs the perl script, gets the output directly from the execution, without a temp file. Parse the CSV line. Since i also have fresh p1 data i can computer the actual energy consumption.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Sunday 24 May 2020 16:03 I do it a little different.

I use a dzVent script. It is triggered by the P1 smart meter (every second).
The dzVent script runs the perl script, gets the output directly from the execution, without a temp file. Parse the CSV line. Since i also have fresh p1 data i can computer the actual energy consumption.
Interesting, a bit like freijn does.
Can you share the script, I would like to have a look at it.
Greetings McMelloW
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Sunday 24 May 2020 16:34 Interesting, a bit like freijn does.
Can you share the script, I would like to have a look at it.
It's highly volatile at the moment, i put it on

https://github.com/RDols/dzRequestSolar ... lSolarEdge
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Sunday 24 May 2020 17:02 It's highly volatile at the moment, i put it on

https://github.com/RDols/dzRequestSolar ... lSolarEdge
Looks good.

I trigger every minute at daytime. No use in polling the inverter when there is no sun at night. :) :)

Code: Select all

	on = {
		timer = { 'every minute between 15 minutes before sunrise and 15 minutes after sunset' } 
	},
I like your bits on -- Execute perl script and -- Convert CSV result line into array.
This saves a write and read to the SD-card every minute.

Much success with the further developing of this script. I will follow it.

I also send a support request to SolarEdge. How to read the optimizer/panel values via Modbus over TCP. This is somewhere in the inverter, how else can they present it at the monitor website of your installation
Greetings McMelloW
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Started a bit to early to test your script i Think.

This is the first bit of your code.

Code: Select all

return 
{
    --------------------------------------------------------------------------------
	active = true,
    --------------------------------------------------------------------------------

	on =
	{
		timer = { 'every minute between 15 minutes before sunrise and 15 minutes after sunset' } 
	},

    --------------------------------------------------------------------------------
	data = {},
    --------------------------------------------------------------------------------
	execute = function(domoticz, triggeredItem)
        LogDebug(domoticz, "--==[ Start ]==-----------------------------------")

        -- Execute perl script
        cmd = string.format("perl %s --numeric --meter=0 --port=%d %s", script, port, ip) 
        local f = io.popen(cmd, 'r')
        local result = f:read('*a')
        f:close()

        -- Convert CSV result line into array
        local fields = {}
        for value in result:gmatch('([^,]+)') do
            table.insert(fields, tonumber(value))
            LogDebug(domoticz, fields)
        end
And this is the result. The is something not OK with the read of the inverter I think.

Code: Select all

2020-05-24 18:17:00.993 Status: dzVents: dzPollSolarEdge : --==[ Start ]==-----------------------------------
2020-05-24 18:17:01.479 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.479 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.479 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.480 Status: dzVents: dzPollSolarEdge : table: 0x6ec90b78
2020-05-24 18:17:01.481 Status: dzVents: dzPollSolarEdge : --==[ End ]==-----------------------------------
2020-05-24 18:17:01.482 Status: dzVents: Info: ------ Finished dzPollSolarEdge
2020-05-24 18:18:01.447 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.447 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.447 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.447 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.447 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.448 Status: dzVents: dzPollSolarEdge : table: 0x61d56800
2020-05-24 18:18:01.449 Status: dzVents: dzPollSolarEdge : --==[ End ]==-----------------------------------
2020-05-24 18:18:01.449 Status: dzVents: Info: ------ Finished dzPollSolarEdge
Greetings McMelloW
Dols
Posts: 27
Joined: Friday 15 January 2016 14:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by Dols »

McMelloW wrote: Sunday 24 May 2020 18:25 Started a bit to early to test your script i Think.
The result is pretty much i expect from an succesfull run.

Try the following:

After f:close() you put this debug line:

Code: Select all

LogDebug(domoticz, result )
replace LogDebug(domoticz, fields) with:

Code: Select all

LogDebug(domoticz, value)
This probably give you more insight what happens
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

Dols wrote: Sunday 24 May 2020 19:18 The result is pretty much i expect from an succesfull run.

This probably give you more insight what happens
You are quite right. See the output below.

Code: Select all

2020-05-24 19:22:00.920 Status: dzVents: Info: ------ Start internal script: dzPollSolarEdge:, trigger: "every minute between 15 minutes before sunrise and 15 minutes after sunset"
2020-05-24 19:22:00.921 Status: dzVents: dzPollSolarEdge : --==[ Start ]==-----------------------------------
2020-05-24 19:22:01.497 Status: dzVents: dzPollSolarEdge : 1590340921,4,5,5,8615844,230.50,0.91,369.60,0.02,42.91,0,0,0,0
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 1590340921
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 4
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 5
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 5
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 8615844
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 230.50
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 0.91
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 369.60
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 0.02
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 42.91
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 0
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 0
2020-05-24 19:22:01.498 Status: dzVents: dzPollSolarEdge : 0
2020-05-24 19:22:01.499 Status: dzVents: dzPollSolarEdge : 0
2020-05-24 19:22:01.499 Status: dzVents: dzPollSolarEdge : --==[ End ]==-----------------------------------
2020-05-24 19:22:01.500 Status: dzVents: Info: ------ Finished dzPollSolarEdge
Thanks a lot, I am going to implement it in my script and skip the file write and read.
Greetings McMelloW
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by freijn »

McMellow

Please do exe from the commandline >python -V
2.7 might still be on your system.

And even in the onine doc its not mentioned optimizers over Modbus :-(
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: SolarEdge individual optimizer dzVents script

Post by McMelloW »

freijn wrote: Sunday 24 May 2020 20:38 McMellow

Please do exe from the commandline >python -V
2.7 might still be on your system.

And even in the online doc its not mentioned optimizers over Modbus :-(
Yes, python 2.7 is still on my RPi. But there are no active python2.7 jobs running.
Don't know or it it save to remove python 2.7 and how.

On the other hand, I implemented the way Richard polls the inverter and convert the CSV output in one go. Skip the write / read to a file. The whole dzVents script is running in less than 0.5 sec. So why changing to the sunspec-ardexa solution.

Code: Select all

2020-05-24 21:52:00.667 Status: dzVents: Info: SELAN 0.1.6: ------ Start external script: script_SolarEdge-LAN.lua:, trigger: "every minute between 15 minutes before sunrise and 15 minutes after sunset"
2020-05-24 21:52:01.102 Status: dzVents: Info: SELAN 0.1.6: ------ Finished script_SolarEdge-LAN.lua
Greetings McMelloW
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest