Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Python and python framework

Moderator: leecollings

Post Reply
Diemux
Posts: 6
Joined: Tuesday 12 January 2021 16:49
Target OS: Windows
Domoticz version:
Contact:

Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by Diemux »

Hi All,

I have been running in to issues with my domoticz setup. I have a Solaredge inverter and have used the solaredge modbus plugin by Addie Janssen. It all worked but due to an error the Raspberry upgraded and the installation was broken.

I was able to restore the system but I'm no longer able to get this plugin working. The combination Python requirements is not valid to run on Bookworm/Python 3.11.
I have been going back and forth with the help of chat GPT to get stuff running but in ends up the same.

Log:
Spoiler: show
2025-07-18 12:24:13.908 Error: Solaredge Omvormer: (SolarEdge_ModbusTCP) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/:/home/domoticz/.local/lib/python3.11/site-packages:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2025-07-18 12:24:13.910 Error: Solaredge Omvormer: Traceback (most recent call last):
2025-07-18 12:24:13.910 Error: Solaredge Omvormer: File "/home/domoticz/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py", line 16, in <module>
2025-07-18 12:24:13.910 Error: Solaredge Omvormer: import solaredge_modbus
2025-07-18 12:24:13.910 Error: Solaredge Omvormer: File "/home/domoticz/.local/lib/python3.11/site-packages/solaredge_modbus/__init__.py", line 7, in <module>
2025-07-18 12:24:13.910 Error: Solaredge Omvormer: from pymodbus.client import ModbusTcpClient
2025-07-18 12:24:13.910 Error: Solaredge Omvormer: ImportError: cannot import name 'ModbusTcpClient' from 'pymodbus.client' (/home/domoticz/.local/lib/python3.11/site-packages/pymodbus/client/__init__.py)
I tried multiple versions of solaredge_modbus and pymodbus but found no working solution. Any tips?
User avatar
jvdz
Posts: 2343
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jvdz »

Have a look here: viewtopic.php?t=43707

This version has the correct current requirements.txt and some extra options.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
eddieb
Posts: 347
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by eddieb »

I am running the jvdz version on my docker/bookworm domoticz. Works fine here
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
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

May be install an older python version besides 3.11. Should be possible.

In my docker startup I have a lot of python lines to get the solaredge modbus running. The latest docker containers run on bookworm.
User avatar
jvdz
Posts: 2343
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jvdz »

You do not need a "lot of python lines" in the startup bash file when you use the proper requirements.txt file as explained in the linked thread. One is sufficient as far as I know.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

In the end...whether the lines are in the requirements.txt or added as individual lines....

Besides that, after installing solardege_modbus.py some dependencys have to be uninstalled and replaced by the correct ones. Not sure hown o handle that with a requirements.txt.
Diemux
Posts: 6
Joined: Tuesday 12 January 2021 16:49
Target OS: Windows
Domoticz version:
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by Diemux »

I got it to work with the suggested plugin from jvdz. I did had to fix a few python issues but that had to do with my environment.

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

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jvdz »

Diemux wrote: Monday 21 July 2025 8:47 I got it to work with the suggested plugin from jvdz. I did had to fix a few python issues but that had to do with my environment.
Sweet ! :-)
jannl wrote: Saturday 19 July 2025 13:48 Besides that, after installing solardege_modbus.py some dependencys have to be uninstalled and replaced by the correct ones. Not sure hown o handle that with a requirements.txt.
Which dependency is that?
To my knowledge, things are simply working when you have this in your requirements.txt:

Code: Select all

pymodbus==3.6.9
solaredge_modbus==0.8.0
and all "wrong" versions are replaced with the required versions.

I like to hear when that is not the case so we can document it.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

I will check that on friday when I am at home again.

Maybe the order of the dependencies in the requirements.txt is important....

Does any one know if the new option to disable the battery from charging the/a car is in the modbus registers?
User avatar
jvdz
Posts: 2343
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jvdz »

jannl wrote: Wednesday 23 July 2025 14:10 Does any one know if the new option to disable the battery from charging the/a car is in the modbus registers?
You mean you like to stop SolarEdge to deliver from the SolarBattery when the Car is loading its battery from Solar/Net?
Nobody confirmed this as yet, but there are extra Selector buttons for the Battery available in the MetersDev branch (v2.0.5.2) with these functions:
storage_control_mode:

Code: Select all

STOREDGE_CONTROL_MODE = {
    0: "Disabled",
    1: "Maximize Self Consumption",
    2: "Time of Use",
    3: "Backup Only",
    4: "Remote Control",
}
rc_cmd_mode(Assume this is the field for this)

Code: Select all

STOREDGE_CHARGE_DISCHARGE_MODE = {
    0: "Off",
    1: "Charge from excess PV power only",
    2: "Charge from PV first",
    3: "Charge from PV and AC",
    4: "Maximize export",
    5: "Discharge to match load",
    7: "Maximize self consumption",
}
This remains in a separate branch until properly tested, which I can't as I do not have a StorEdge connected.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

The option is in the app after the inverter got the new firmware. I will test it this weekend.
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

jvdz wrote: Monday 21 July 2025 10:29
Diemux wrote: Monday 21 July 2025 8:47 I got it to work with the suggested plugin from jvdz. I did had to fix a few python issues but that had to do with my environment.
Sweet ! :-)
jannl wrote: Saturday 19 July 2025 13:48 Besides that, after installing solardege_modbus.py some dependencys have to be uninstalled and replaced by the correct ones. Not sure hown o handle that with a requirements.txt.
Which dependency is that?
To my knowledge, things are simply working when you have this in your requirements.txt:

Code: Select all

pymodbus==3.6.9
solaredge_modbus==0.8.0
and all "wrong" versions are replaced with the required versions.

I like to hear when that is not the case so we can document it.
Hi, I just tested and it works, thanks. I noticed I also installed modbus.py, propably that caused the issues.

Anyway, with your code snippet it works, thanks
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

jvdz wrote: Wednesday 23 July 2025 15:35
jannl wrote: Wednesday 23 July 2025 14:10 Does any one know if the new option to disable the battery from charging the/a car is in the modbus registers?
You mean you like to stop SolarEdge to deliver from the SolarBattery when the Car is loading its battery from Solar/Net?
Nobody confirmed this as yet, but there are extra Selector buttons for the Battery available in the MetersDev branch (v2.0.5.2) with these functions:
storage_control_mode:

Code: Select all

STOREDGE_CONTROL_MODE = {
    0: "Disabled",
    1: "Maximize Self Consumption",
    2: "Time of Use",
    3: "Backup Only",
    4: "Remote Control",
}
rc_cmd_mode(Assume this is the field for this)

Code: Select all

STOREDGE_CHARGE_DISCHARGE_MODE = {
    0: "Off",
    1: "Charge from excess PV power only",
    2: "Charge from PV first",
    3: "Charge from PV and AC",
    4: "Maximize export",
    5: "Discharge to match load",
    7: "Maximize self consumption",
}
This remains in a separate branch until properly tested, which I can't as I do not have a StorEdge connected.
From the app, it is working. When I set the option, the battery is not used for charging.
The battery is not used at all, even not for other appliances in the house.
User avatar
jvdz
Posts: 2343
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jvdz »

Which exact option did you use?
Just to make sure I understand you correctly: all is working as you like?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

I use an option in the Solaredge app, recently added to the app and the firmware of the inverter.
The option is in the charger settings of the app and is called: 'use battery' (batterij gebruiken), on or off.

It is not completely doing what I like. I would like to have just the charger use the grid and the house still use the battery (when the inverter is not using it's max power). Besides that I would like to have a setting that allows me to use the battery for charging until 50% is reached. I (still manually) set the charger to a bit less then 5kW, so most power comes from the sun and little from the battery or grid).

To manipulate those settings via modbus would be great.
User avatar
jvdz
Posts: 2343
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jvdz »

Ok, so you haven't loaded the proposed branch yet?
Would be nice when somebody gives that a try to see if those added Selector switches actually work.
As to your wish on how you want it all to work: I haven't enough information of your complete setup to be able to comment on it.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
jannl
Posts: 682
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Post by jannl »

No, not yet. I wll try to find some time to test that.

Which branch should I use again?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest