Page 1 of 1

Issues running Solaredge_Modbus on Rasp. Pi 5 and Python 3.11

Posted: Friday 18 July 2025 12:32
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?

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

Posted: Friday 18 July 2025 13:15
by jvdz
Have a look here: viewtopic.php?t=43707

This version has the correct current requirements.txt and some extra options.

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

Posted: Friday 18 July 2025 13:17
by eddieb
I am running the jvdz version on my docker/bookworm domoticz. Works fine here

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

Posted: Saturday 19 July 2025 12:34
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.

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

Posted: Saturday 19 July 2025 12:49
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.

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

Posted: Saturday 19 July 2025 13:48
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.

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

Posted: Monday 21 July 2025 8:47
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!

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

Posted: Monday 21 July 2025 10:29
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.

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

Posted: Wednesday 23 July 2025 14:10
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?

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

Posted: Wednesday 23 July 2025 15:35
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.

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

Posted: Wednesday 23 July 2025 21:51
by jannl
The option is in the app after the inverter got the new firmware. I will test it this weekend.

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

Posted: Friday 25 July 2025 8:09
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

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

Posted: Friday 25 July 2025 12:11
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.

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

Posted: Friday 25 July 2025 12:45
by jvdz
Which exact option did you use?
Just to make sure I understand you correctly: all is working as you like?

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

Posted: Friday 25 July 2025 15:03
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.

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

Posted: Friday 25 July 2025 19:49
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.

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

Posted: Saturday 26 July 2025 9:12
by jannl
No, not yet. I wll try to find some time to test that.

Which branch should I use again?