Python SolarEdge modbus script via lan

Python and python framework

Moderator: leecollings

User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Python SolarEdge modbus script via lan

Post by jvdz »

Frank,

Are you even sure the sunspec_ardexa process is done after 2 seconds?
I would keep it simple, because it will never be 100% correct and it is "only" about the consumption of your house at the given time. Total consumption will (eventually) be correct.
What I do is I run the sunspec_ardexa process each 15 seconds and my P1 info is updated each 10 seconds, so each time I get an update for P1 I calculate the consumption by using the last SolarPowerValue - P1Return + P1Usage and update another dummy P1 device.
This is fine for getting an good impression of the real consumption and doesn't stress the RPI too much as the sunspec_ardexa does take about 4 seconds to complete on my RPI 2B.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python SolarEdge modbus script via lan

Post by freijn »

Hey Jos,

Running on an RP4 here :

This request took: 1.17648792267 seconds.
This is excluded the HTTP requests, but I think its still below the 2 sec.

The biggest step forward was from a RP2 to RP3 I can recommend it!

THanks for sharing your thoughts with me.

Frank
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Python SolarEdge modbus script via lan

Post by jvdz »

freijn wrote: Sunday 08 March 2020 19:21 This request took: 1.17648792267 seconds.
This is excluded the HTTP requests, but I think its still below the 2 sec.
Correct I get: "This request took: 2.19808793068 seconds.", but the total time including the load process for this script is just below the 4 seconds for me.
I know and am planning to install a couple of new PI's, but there hasn't been any need as yet as My current RPI2b runs on average at 3% cpu.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
patricksluis62
Posts: 3
Joined: Monday 23 March 2020 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python SolarEdge modbus script via lan

Post by patricksluis62 »

Hi,

I have follow the steps on the first post from Freijn.

The domo.ini file is stored in the domoticz map with the idx numbers I have made with the virtual sensors in domoticz.
I didn`t found the sunspec_ardexa.py file in the python 2.7/dist-packages folder.
I have found a folder in root/pysonspec but is wasn`t the sunspec-ardexa.py file. I have open an other file with thonny python IDE and paste the code you have made on the first post.
When I paste this (sunspec_ardexa discover 192.168.1.12 1) command in the terminal and execude it.
It works as you can see>
Amps (A) 0.0 A
Amps PhaseA (AphA) 0.0 A
Amps PhaseB (AphB) 0.0 A
Amps PhaseC (AphC) 0.0 A
Phase Voltage AB (PPVphAB) 376.8 V
Phase Voltage BC (PPVphBC) 380.3 V
Phase Voltage CA (PPVphCA) 379.6 V
Phase Voltage AN (PhVphA) 216.2 V
Phase Voltage BN (PhVphB) 218.0 V
Phase Voltage CN (PhVphC) 220.5 V
Watts (W) 0 W
Hz (Hz) 49.97 Hz
VA (VA) 0 VA
VAr (VAr) 0 var
PF (PF) 0 Pct
WattHours (WH) 15484252 Wh
DC Amps (DCA) 0 A
DC Voltage (DCV) 866.0 V
DC Watts (DCW) 0 W
Heat Sink Temperature (TmpSnk) 43.45 C
Operating State (St) Starting
Vendor Operating State (StVnd) 0
Vendor Event Bitfield 1 (EvtVnd1) 1
Vendor Event Bitfield 4 (EvtVnd4) 0

The question is how do I get the parameters in Domoticz?
In Domoticz I can see the devices I have made but they don`t get any data.

Thank you for your time!!

Patrick
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python SolarEdge modbus script via lan

Post by freijn »

Patrick

run this command :

sudo find / -name sunspec_ardexa.py


This will show you where sunspec_ardexa.py file is located.
Now follow the procedure I wrote in the first post.
backup-replace.

Then run the script again and see if you get the results in your Domoticz.
If all fails, enable the debug ( set it to 1 ) and see if the script generates output.

Please let me know how you are going. and Stay Healty !
patricksluis62
Posts: 3
Joined: Monday 23 March 2020 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python SolarEdge modbus script via lan

Post by patricksluis62 »

Hi,

Thanks for the fast response.

I have located the file with the search function and paste the new script over the existing script.
No results unfortunally, so I deleted all sunspec files and started from nr. 1
Completed all steps and located the files, replace it with the new script but unfortunally, again no updated parameter in Domoticz.
But when I use this command: (sunspec_ardexa discover 192.168.1.12 1) nothing happens.
When I use the seccond command: (sunspec_ardexa -vv discover 192.168.1.12 1)
The parameters in the terminal are comming.

I have updated Domoticz also in the morning, could this be the problem?

Patrick
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python SolarEdge modbus script via lan

Post by freijn »

Hemmmm

can you check if you allow updates without a password on your local network ? in the Settings menu
Capture.JPG
Capture.JPG (18.95 KiB) Viewed 1582 times
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: Python SolarEdge modbus script via lan

Post by McMelloW »

Hello to all SolarEdge users

Two little questions.

1) Does this works on python 3.7 If yes, how do I install.

2) Does this support Optimzer information as well?
Greetings McMelloW
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Python SolarEdge modbus script via lan

Post by jvdz »

McMelloW wrote: Saturday 23 May 2020 17:40 1) Does this works on python 3.7 If yes, how do I install.
I am running it with 2.7 so am not sure, but this post seems to suggest it: https://www.domoticz.com/forum/viewtopi ... 55#p238222
McMelloW wrote: Saturday 23 May 2020 17:40 2) Does this support Optimzer information as well?
Nope just the Standard stuff:

Code: Select all

Found a device at address:  1

Name:  common 	Sunspec Id:  1 	Label:  Common
	Manufacturer (Mn)                                  SolarEdge            
	Model (Md)                                             SE5000           
	Version (Vr)                                        0003.2434           
	Serial Number (SN)                                   7aaaaaaa           
	Device Address (DA)                                         1           

Name:  inverter 	Sunspec Id:  101 	Label:  Inverter (Single Phase)
	Amps (A)                                                14.47 A         
	Amps PhaseA (AphA)                                      14.47 A         
	Phase Voltage AB (PPVphAB)                              236.7 V         
	Watts (W)                                                3422 W         
	Hz (Hz)                                                49.985 Hz        
	VA (VA)                                                  3428 VA        
	VAr (VAr)                                              196.03 var       
	PF (PF)                                                 99.83 Pct       
	WattHours (WH)                                        7716992 Wh        
	DC Amps (DCA)                                           9.202 A         
	DC Voltage (DCV)                                        377.5 V         
	DC Watts (DCW)                                           3474 W         
	Heat Sink Temperature (TmpSnk)                          50.97 C         
	Operating State (St)                                     MPPT           
	Vendor Operating State (StVnd)                              0           
	Vendor Event Bitfield 1 (EvtVnd1)                           0           
	Vendor Event Bitfield 4 (EvtVnd4)                           0           
This request took:  1.61030101776  seconds.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
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: Python SolarEdge modbus script via lan

Post by McMelloW »

@jvdz
Thanks for the information.

This offers no extras. This perl script https://github.com/tjko/sunspec-monitor
Called within a dzVents script does the same within less 0.5 sec.
Greetings McMelloW
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Python SolarEdge modbus script via lan

Post by jvdz »

McMelloW wrote: Monday 25 May 2020 11:42 This offers no extras. This perl script https://github.com/tjko/sunspec-monitor
Called within a dzVents script does the same within less 0.5 sec.
Yea I know.., but not sure about the speed remark as I am still running on a "old" Raspberry Pi 2 Model B.
I have read claims about the perl script being slower.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
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: Python SolarEdge modbus script via lan

Post by McMelloW »

jvdz wrote: Monday 25 May 2020 12:23 Yea I know.., but not sure about the speed remark as I am still running on a "old" Raspberry Pi 2 Model B.
I have read claims about the perl script being slower.

The timecalculation is from the log. Time ended minus time started.
Last edited by McMelloW on Sunday 09 August 2020 11:39, edited 1 time in total.
Greetings McMelloW
patricksluis62
Posts: 3
Joined: Monday 23 March 2020 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python SolarEdge modbus script via lan

Post by patricksluis62 »

Hi,

I have installed the script again on another raspberry with Domoticz and a different inverter. Unfortunately, I have again problems with getting the data in domoticz. When I execute the script in the terminal, I receive data from the SolarEdge inverter, but nothing appears in Domoticz. Last time (March) I didn`t allow the internal network to access domoticz, I have changed it and it get working. Anyone who has ideas what the problem can be this time……
Thank you for your time!!
Patrick
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python SolarEdge modbus script via lan

Post by freijn »

Did you replace the customized code ?
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Python SolarEdge modbus script via lan

Post by CronoS »

Hi,

I am testing it on my RP 3+, but I stll got the error: "Cannot find the address 1". Is there are a prerequisite that I have missed? I have installed the plugin and tried some commands e.g.: "sunspec_ardexa --verbose discover a.b.c.d 1 --port 1502", with or without the ports and also tried 1-20. I haven't setup up the domoticz part yet, first I wanted to find out if the plugin actually is doing something first and that I get a verbose logging back that it is basically found or some sort.....

Thanks!
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python SolarEdge modbus script via lan

Post by rogerthn »

Maybe
freijn wrote: Sunday 23 February 2020 19:53 ...
2020-02-27 Thanks Telewy !
If the script does not connect to the inverter with the message : Cannot find the address: 1
Then please in the file /usr/local/lib/python2.7/dist-packages/sunspec/core/client.py
at line 333 insert the sleep command :
time.sleep(0.1)
I am using python 3 and have

Code: Select all

diff /usr/local/lib/python3.7/dist-packages/sunspec/core/client.py.ORG /usr/local/lib/python3.7/dist-packages/sunspec/core/client.py
332a333
>                 time.sleep(0.1)
Strebrah
Posts: 2
Joined: Sunday 09 August 2020 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Netherlands
Contact:

Re: Python SolarEdge modbus script via lan

Post by Strebrah »

Hi,

I had some difficulties getting the proposed script working.
So, over the weekend, I created my own Solaredge Modbus TCP to Domoticz python code.
I uploaded it to github; https://github.com/strebrah/Solaredge_Domoticz_Modbus
Maybe someone will find this useful :)

bye!
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python SolarEdge modbus script via lan

Post by freijn »

CronoS wrote: Sunday 09 August 2020 9:17 Hi,

I am testing it on my RP 3+, but I stll got the error: "Cannot find the address 1". Is there are a prerequisite that I have missed? I have installed the plugin and tried some commands e.g.: "sunspec_ardexa --verbose discover a.b.c.d 1 --port 1502", with or without the ports and also tried 1-20. I haven't setup up the domoticz part yet, first I wanted to find out if the plugin actually is doing something first and that I get a verbose logging back that it is basically found or some sort.....

Thanks!
Goes back to basic first. Can you connect to your inverter? telent ipaddres : port number Does it open a connection ?
Strebrah
Posts: 2
Joined: Sunday 09 August 2020 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Netherlands
Contact:

Re: Python SolarEdge modbus script via lan

Post by Strebrah »

Strebrah wrote: Sunday 09 August 2020 17:20 Hi,

I had some difficulties getting the proposed script working.
So, over the weekend, I created my own Solaredge Modbus TCP to Domoticz python code.
I uploaded it to github; https://github.com/strebrah/Solaredge_Domoticz_Modbus
Maybe someone will find this useful :)

bye!
@freijn, can you include this as an alternative in the first topic post? or should I create a new topic? Thanks!
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python SolarEdge modbus script via lan

Post by freijn »

[/quote]

@freijn, can you include this as an alternative in the first topic post? or should I create a new topic? Thanks!
[/quote]

Done ! THanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest