New Python plugin: Domoticz SolarEdge_ModbusTCP

Moderator: leecollings

AddieJanssen
Posts: 17
Joined: Sunday 27 September 2020 16:17
Target OS: -
Domoticz version:
Contact:

New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by AddieJanssen »

I have created a Python plugin to get the data from my SolarEdge inverter into Domoticz.

The inverter needs to be connected to the network and Modbus needs to be enabled on it.

The plugin is available on GitHub:

https://github.com/addiejanssen/domotic ... tcp-plugin

It would be great to hear your feedback on it.
If it is working for you: please share your setup.

Enjoy,

Addie
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by eddieb »

Hi,

just installed this plugin following your instructions.
All went smooth and it seems to work ok on a SE3500H ...

Eddie
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
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: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by McMelloW »

Hi Addie,

Installed your plugin today as well. Works like a charm. Well done!
Also I have an SE3500H with 12 panels.

I did set debug = true But I don't see any messages.
Greetings McMelloW
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by eddieb »

Running for 2 days now and I am very pleased with this plugin.

I notice something in I can not explain ...
Screenshot 2020-09-30 at 07.13.34.png
Screenshot 2020-09-30 at 07.13.34.png (363.96 KiB) Viewed 4029 times
Why do these events occur with different users ?
Why are some events caused by "timer" ???
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
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: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by McMelloW »

Having the same as Eddieb.
SolarEdge-Status.png
SolarEdge-Status.png (32.46 KiB) Viewed 4023 times

The plugin is running 24/7 During sleeping hours, 'sleeping' data is still added to the database. Can we change this?
Greetings McMelloW
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by eddieb »

Actually I don't mind monitoring (parts) of the inverter 24x7
I was just curious about the different users ...
And, if there is somthing like "sleeping" time, when is this ? is this configurable ?
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
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: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by McMelloW »

I don't know about the different users either.

What I understand from my supplier. The inverter goes to the status sleeping when the production is less the a certain amount on the panels.
Up till now, I have used a DzVents script with a perl script to readout the inverter. This is active only during daytime.

Code: Select all

	on = {
		timer = { 'every minute between 15 minutes before sunrise and 15 minutes after sunset' } 
The inverter is allways in sleeping status during this time interval.
Greetings McMelloW
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by eddieb »

at least the Temperature, P1 Voltage and Frequency counters work 24/7.

the inverter self does not update the other counters when idle ...
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
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: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by McMelloW »

eddieb wrote: Wednesday 30 September 2020 11:30 at least the Temperature, P1 Voltage and Frequency counters work 24/7.

the inverter self does not update the other counters when idle ...
In that case, it is no big deal to run 24/7
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: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by freijn »

Hi Addie,

Would it also be possible to "fire" the script from a script ?

i.e. I do like "sync" it from my P1 activity.
This to be able to calculate the in house consumption of power.
( yes I know calculating it from an event makes me calculating it 1 sample too late , but I still like this very much :-) )
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by eddieb »

freijn wrote: Thursday 01 October 2020 21:49 Hi Addie,

Would it also be possible to "fire" the script from a script ?

i.e. I do like "sync" it from my P1 activity.
This to be able to calculate the in house consumption of power.
( yes I know calculating it from an event makes me calculating it 1 sample too late , but I still like this very much :-) )
that would be nice, but P1 executes every second and I doubt if the inverter likes to be polled every second ...

I am running a script here that counts P1power and Solarpower into Realpower.
The script is triggerd by Solarpower and is pretty accurate.
Except when there is fast fluctuation in Solarpower ... The values from the inverter seems to have a small delay compared with P1 ...
My calculation sometimes give me NEGATIVE Realpower usages because of this !
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by freijn »

My inverter is happy with it. fired and calculated every second. :-)
Capture.JPG
Capture.JPG (44.42 KiB) Viewed 3935 times
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by eddieb »

Hmm,
I am interested in the modifications you made to make this happen ;-)
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
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: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by McMelloW »

Getting regular the following errors in the log.
What can I do about this?

Code: Select all

2020-10-03 11:58:54.790 Error: (SolarEdge) 'onHeartbeat' failed 'KeyError'.
2020-10-03 11:58:54.790 Error: (SolarEdge) ----> Line 522 in '/home/pi/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py', function onHeartbeat
2020-10-03 11:58:54.790 Error: (SolarEdge) ----> Line 335 in '/home/pi/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py', function onHeartbeat
Greetings McMelloW
User avatar
Sjonnie2017
Posts: 361
Joined: Wednesday 02 August 2017 19:43
Target OS: Linux
Domoticz version: Latest ß
Location: The Netherlands
Contact:

Just a tiny little problem

Post by Sjonnie2017 »

Hi,

I installed the script in a somewhat different way than described on github (I missed one line :oops: ). I can add the hardware but the devices don't show up. Any help truly appreciated!

The steps I took (and the mistake I made :oops: )

Code: Select all

pi@RPi3:~/domoticz/plugins $ git clone https://github.com/addiejanssen/domoticz-solaredge-modbustcp-plugin.git
Cloning into 'domoticz-solaredge-modbustcp-plugin'...
remote: Enumerating objects: 34, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 34 (delta 12), reused 26 (delta 8), pack-reused 0
Unpacking objects: 100% (34/34), done.
pi@RPi3:~/domoticz/plugins $ sudo systemctl restart domoticz
pi@RPi3:~/domoticz/plugins $ sudo pip3 install solaredge_modbus
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting solaredge_modbus
  Downloading https://files.pythonhosted.org/packages/9c/32/e55ff68a75f940b568c0195ab346b22bf94f7820e8554bb825c3c4c447e2/solaredge_modbus-0.6.0-py3-none-any.whl
Collecting pymodbus>=2.3.0 (from solaredge_modbus)
  Downloading https://files.pythonhosted.org/packages/78/21/6c57bfb2b3fca465606a8115e7993bcb008c0714592a55b4ec9e903f8371/pymodbus-2.4.0-py2.py3-none-any.whl (141kB)
    100% |████████████████████████████████| 143kB 1.1MB/s 
Requirement already satisfied: pyserial>=3.4 in /usr/lib/python3/dist-packages (from pymodbus>=2.3.0->solaredge_modbus) (3.4)
Collecting six>=1.15.0 (from pymodbus>=2.3.0->solaredge_modbus)
  Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Installing collected packages: six, pymodbus, solaredge-modbus
  Found existing installation: six 1.12.0
    Not uninstalling six at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'six'. No files were found to uninstall.
Successfully installed pymodbus-2.4.0 six-1.15.0 solaredge-modbus-0.6.0
pi@RPi3:~/domoticz/plugins $ sudo systemctl restart domoticz
EDIT: I forgot to add the log :shock:
Spoiler: show

Code: Select all

 2020-10-03 17:37:45.371 Status: (Zonnepanelen) Started.
2020-10-03 17:37:45.804 Status: (Zonnepanelen) Entering work loop.
2020-10-03 17:37:45.805 Status: (Zonnepanelen) Initialized version 1.0.0, author 'Addie Janssen'
2020-10-03 17:42:57.334 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:42:57.336 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:42:57.336 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:42:57.336 (Zonnepanelen) onHeartbeat
2020-10-03 17:42:57.336 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:43:56.476531
2020-10-03 17:43:27.364 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:43:27.406 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:43:27.406 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:43:27.406 (Zonnepanelen) onHeartbeat
2020-10-03 17:43:27.406 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:43:56.476531
2020-10-03 17:43:57.417 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:43:57.430 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:43:57.430 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:43:57.430 (Zonnepanelen) onHeartbeat
2020-10-03 17:43:57.433 (Zonnepanelen) Connection Exception when trying to contact: 192.168.16.160:502
2020-10-03 17:43:57.433 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:45:57.433225
2020-10-03 17:44:27.440 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:44:27.461 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:44:27.461 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:44:27.461 (Zonnepanelen) onHeartbeat
2020-10-03 17:44:27.461 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:45:57.433225
2020-10-03 17:44:58.059 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:44:58.085 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:44:58.085 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:44:58.085 (Zonnepanelen) onHeartbeat
2020-10-03 17:44:58.085 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:45:57.433225
2020-10-03 17:45:28.237 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:45:28.260 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:45:28.260 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:45:28.260 (Zonnepanelen) onHeartbeat
2020-10-03 17:45:28.260 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:45:57.433225
2020-10-03 17:45:58.262 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:45:58.310 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:45:58.310 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:45:58.310 (Zonnepanelen) onHeartbeat
2020-10-03 17:45:58.313 (Zonnepanelen) Connection Exception when trying to contact: 192.168.16.160:502
2020-10-03 17:45:58.313 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:47:58.313337
2020-10-03 17:46:28.268 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:46:28.318 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:46:28.318 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:46:28.318 (Zonnepanelen) onHeartbeat
2020-10-03 17:46:28.318 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:47:58.313337
2020-10-03 17:46:58.275 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:46:58.290 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:46:58.290 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:46:58.290 (Zonnepanelen) onHeartbeat
2020-10-03 17:46:58.291 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:47:58.313337
2020-10-03 17:47:28.966 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:47:29.012 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:47:29.012 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:47:29.012 (Zonnepanelen) onHeartbeat
2020-10-03 17:47:29.012 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:47:58.313337
2020-10-03 17:47:58.972 (Zonnepanelen) Pushing 'onHeartbeatCallback' on to queue
2020-10-03 17:47:58.981 (Zonnepanelen) Processing 'onHeartbeatCallback' message
2020-10-03 17:47:58.981 (Zonnepanelen) Calling message handler 'onHeartbeat'.
2020-10-03 17:47:58.981 (Zonnepanelen) onHeartbeat
2020-10-03 17:47:58.985 (Zonnepanelen) Connection Exception when trying to contact: 192.168.16.160:502
2020-10-03 17:47:58.985 (Zonnepanelen) Retrying to communicate with inverter after: 2020-10-03 17:49:58.985216 
EDIT2: Forgot to mention that the inverter is a SolarEdge SE4000H and is connected to my network by wire. Installed today and as far as I know no alterations.

Greetz,

Sjonnie
ConBee II - TRÅDFRI lights + switches, loads of ChingLing dimmers and switches, Heiman and Xiaomi sensors
SolarEdge SE4000H (with active modbus_tcp)
YouLess Energy meter
Shelly 2.5 in roller shutter mode
AddieJanssen
Posts: 17
Joined: Sunday 27 September 2020 16:17
Target OS: -
Domoticz version:
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by AddieJanssen »

eddieb wrote: Wednesday 30 September 2020 7:16 Running for 2 days now and I am very pleased with this plugin.

I notice something in I can not explain ...
Screenshot 2020-09-30 at 07.13.34.png
Why do these events occur with different users ?
Why are some events caused by "timer" ???
To be honest: I have no idea...
I have not added anything in the plugin to work with users, so this must be one of the nice hidden features of Domoticz.
If time permits, I will try to replicate it on my setup and investigate.
AddieJanssen
Posts: 17
Joined: Sunday 27 September 2020 16:17
Target OS: -
Domoticz version:
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by AddieJanssen »

McMelloW wrote: Wednesday 30 September 2020 12:14
eddieb wrote: Wednesday 30 September 2020 11:30 at least the Temperature, P1 Voltage and Frequency counters work 24/7.

the inverter self does not update the other counters when idle ...
In that case, it is no big deal to run 24/7
It is not a problem to run it 24/7; the plugin will not write any data to the database unless the value has changed.
So during night, lots of devices will not change value at all.
I have put an item on my to do list for this; it makes sense to skip certain devices when the status of the inverter is not "producing".
Will look into it over the next weeks.
AddieJanssen
Posts: 17
Joined: Sunday 27 September 2020 16:17
Target OS: -
Domoticz version:
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by AddieJanssen »

McMelloW wrote: Saturday 03 October 2020 12:29 Getting regular the following errors in the log.
What can I do about this?

Code: Select all

2020-10-03 11:58:54.790 Error: (SolarEdge) 'onHeartbeat' failed 'KeyError'.
2020-10-03 11:58:54.790 Error: (SolarEdge) ----> Line 522 in '/home/pi/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py', function onHeartbeat
2020-10-03 11:58:54.790 Error: (SolarEdge) ----> Line 335 in '/home/pi/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py', function onHeartbeat
Nice!
Looks like your inverter is returning a status that is not supported by the solaredge_modbus library that is used by the plugin.
I will update the plugin to catch the error so we can find out what that status is.
Will get back to you when this is in place.
AddieJanssen
Posts: 17
Joined: Sunday 27 September 2020 16:17
Target OS: -
Domoticz version:
Contact:

Re: Just a tiny little problem

Post by AddieJanssen »

Sjonnie2017 wrote: Saturday 03 October 2020 17:44 Hi,

I installed the script in a somewhat different way than described on github (I missed one line :oops: ). I can add the hardware but the devices don't show up. Any help truly appreciated!

EDIT2: Forgot to mention that the inverter is a SolarEdge SE4000H and is connected to my network by wire. Installed today and as far as I know no alterations.

Greetz,

Sjonnie

Hi Sjonnie,

The plugin is not able to connect with your inverter.
This is probably not an issue with your software.
Did you enable Modbus on your inverter and if so: do the ip address and ports match?
AddieJanssen
Posts: 17
Joined: Sunday 27 September 2020 16:17
Target OS: -
Domoticz version:
Contact:

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Post by AddieJanssen »

freijn wrote: Thursday 01 October 2020 21:49 Hi Addie,

Would it also be possible to "fire" the script from a script ?

i.e. I do like "sync" it from my P1 activity.
This to be able to calculate the in house consumption of power.
( yes I know calculating it from an event makes me calculating it 1 sample too late , but I still like this very much :-) )
Hi freijn,

The plugin is not a script, so I don't know if this is possible.
If you are looking for a script, it might be easier to use the solaredge_modbus library itself.
Have a look at the example that the developer provided in his github repo: https://github.com/nmakel/solaredge_mod ... example.py
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests