Page 8 of 8

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Sunday 20 September 2026 21:09
by imautohuttraeger
Updated to 2.0.6.
Restructured repository seems to work.

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Sunday 20 September 2026 22:55
by imautohuttraeger
EDIT: Seems that my .backup_zip directory must not stay in the plugins folder. Sorry. Will move it. Seems that a non coding guy like me is more disruptive than helpful 😔

SE errors at 21:36 with new version. Just at that point of time. No errors before and after.

Log data beyond errors at that point of time not available in log of web UI retroactive.

Would love to provide more data but I need to know how I can get it without sitting in front the computer at the exact time.

Code: Select all

2026-09-20 21:36:42.275  Error: SE_Modbus_Neu: Call to function 'onHeartbeat' failed, exception details:
2026-09-20 21:36:42.293  Error: SE_Modbus_Neu: Traceback (most recent call last):
2026-09-20 21:36:42.293  Error: SE_Modbus_Neu:   File "/home/pi/domoticz/plugins/solaredge_modbus_tcp_v2.backup_zip/plugin.py", line 709, in onHeartbeat
2026-09-20 21:36:42.293  Error: SE_Modbus_Neu:     _plugin.onHeartbeat()
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:     ~~~~~~~~~~~~~~~~~~~^^
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:   File "/home/pi/domoticz/plugins/solaredge_modbus_tcp_v2.backup_zip/plugin.py", line 251, in onHeartbeat
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:     meter = self.inverter.meters()[device_name]
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu: KeyError: 'Meter1'

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 9:05
by AddieJanssen
imautohuttraeger wrote: Sunday 20 September 2026 22:55 EDIT: Seems that my .backup_zip directory must not stay in the plugins folder. Sorry. Will move it. Seems that a non coding guy like me is more disruptive than helpful 😔

SE errors at 21:36 with new version. Just at that point of time. No errors before and after.

Log data beyond errors at that point of time not available in log of web UI retroactive.

Would love to provide more data but I need to know how I can get it without sitting in front the computer at the exact time.

Code: Select all

2026-09-20 21:36:42.275  Error: SE_Modbus_Neu: Call to function 'onHeartbeat' failed, exception details:
2026-09-20 21:36:42.293  Error: SE_Modbus_Neu: Traceback (most recent call last):
2026-09-20 21:36:42.293  Error: SE_Modbus_Neu:   File "/home/pi/domoticz/plugins/solaredge_modbus_tcp_v2.backup_zip/plugin.py", line 709, in onHeartbeat
2026-09-20 21:36:42.293  Error: SE_Modbus_Neu:     _plugin.onHeartbeat()
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:     ~~~~~~~~~~~~~~~~~~~^^
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:   File "/home/pi/domoticz/plugins/solaredge_modbus_tcp_v2.backup_zip/plugin.py", line 251, in onHeartbeat
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:     meter = self.inverter.meters()[device_name]
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu:             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
2026-09-20 21:36:42.294  Error: SE_Modbus_Neu: KeyError: 'Meter1'
These errors can't come from v2.0.6. The line numbers mentioned don't match.

You can reduce the log level in the hardware settings of the plugin to "Verbose".
That will reduce the amount of log info, but does include the json output of the inverter.

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 9:12
by JayDotR
Hi Addie,

Seems that the move to "src/" is not seen so transparently

Code: Select all

2026-09-21 09:03:49.347  Status: SolarEdge ModBus Roof: Started.
2026-09-21 09:03:49.347  Status: SolarEdge ModBus Roof: Entering work loop.
2026-09-21 09:03:49.348  Status: SolarEdge ModBus Batt: Started.
2026-09-21 09:03:49.348  Status: SolarEdge ModBus Batt: Entering work loop.
2026-09-21 09:03:50.116  Error: SolarEdge ModBus Batt: (SolarEdge_ModbusTCP) failed to load 'plugin.py'.
2026-09-21 09:03:50.193  Error: SolarEdge ModBus Roof: (SolarEdge_ModbusTCP) failed to load 'plugin.py'.
2026-09-21 09:03:50.479  Error: SolarEdge ModBus Batt: Exception: 'ModuleNotFoundError: No module named 'plugin''.  No traceback available.
2026-09-21 09:03:50.556  Error: SolarEdge ModBus Roof: Exception: 'ModuleNotFoundError: No module named 'plugin''.  No traceback available.
I doubt that the plugin.py must remain in the root folder, and eventually the imports could undergo a path modif (I will test) and keep you informed

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 9:26
by JayDotR
Your structure:

Code: Select all

Domoticz-SolarEdge-ModbusTCP/
├── plugin.py
└── src/
    ├── inverters.py
    └── ...
At the top of plugin.py, before importing inverters:

Code: Select all

import sys
from pathlib import Path

# Add src/ directory to Python module search path
SRC_DIR = Path(__file__).resolve().parent / "src"

if str(SRC_DIR) not in sys.path:
    sys.path.insert(0, str(SRC_DIR))

import inverters

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 11:00
by JayDotR
And solved the Issue I ran into later on (fatal error on a fetch)

Code: Select all


pi@pihole:/srv/domoticz/plugins/Domoticz-SolarEdge.2.0.6 $ diff plugin.new.py plugin.2.0.6.py

67,74d66
< import sys
< from pathlib import Path
<
< # Add src/ directory to Python module search path.
< SRC_DIR = Path(__file__).resolve().parent / "src"
< if str(SRC_DIR) not in sys.path:
<     sys.path.insert(0, str(SRC_DIR))
<
370c362
<                         last_update: datetime = datetime.strptime(Devices[unit[Column.ID] + offset].LastUpdate, "%Y-%m-%d %H:%M:%S")
---
>                         last_update: datetime = datetime.strptime(Devices[unit[Column.ID]].LastUpdate, "%Y-%m-%d %H:%M:%S")
Runs now at a glance beside 2.0.5 on the same host

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 12:55
by AddieJanssen
JayDotR wrote: Monday 21 September 2026 9:12 Hi Addie,

Seems that the move to "src/" is not seen so transparently

Code: Select all

2026-09-21 09:03:49.347  Status: SolarEdge ModBus Roof: Started.
2026-09-21 09:03:49.347  Status: SolarEdge ModBus Roof: Entering work loop.
2026-09-21 09:03:49.348  Status: SolarEdge ModBus Batt: Started.
2026-09-21 09:03:49.348  Status: SolarEdge ModBus Batt: Entering work loop.
2026-09-21 09:03:50.116  Error: SolarEdge ModBus Batt: (SolarEdge_ModbusTCP) failed to load 'plugin.py'.
2026-09-21 09:03:50.193  Error: SolarEdge ModBus Roof: (SolarEdge_ModbusTCP) failed to load 'plugin.py'.
2026-09-21 09:03:50.479  Error: SolarEdge ModBus Batt: Exception: 'ModuleNotFoundError: No module named 'plugin''.  No traceback available.
2026-09-21 09:03:50.556  Error: SolarEdge ModBus Roof: Exception: 'ModuleNotFoundError: No module named 'plugin''.  No traceback available.
I doubt that the plugin.py must remain in the root folder, and eventually the imports could undergo a path modif (I will test) and keep you informed
That's why there's a release zip file 8-) which puts all the required files nicely together in the root.
Don't clone the repo, but instead download the zip file and extract all files.

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 13:20
by JayDotR
Hi Addie,

Indeed, makes sense with the zip. By convenience i made the classic git pull.

Nevertheless, I encountered an error when reading data, which is also part in the diff I posted the morning. I can check if I encounter it when using the zip as source. I sent you the diff to apply & error log by PM

Jan

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 15:35
by imautohuttraeger
AddieJanssen wrote: Monday 21 September 2026 9:05 These errors can't come from v2.0.6. The line numbers mentioned don't match.
That's right. That's why I added this EDIT note:
imautohuttraeger wrote: Sunday 20 September 2026 22:55 EDIT: Seems that my .backup_zip directory must not stay in the plugins folder. Sorry. Will move it. Seems that a non coding guy like me is more disruptive than helpful 😔
I have moved this backup folder outside the plugins folder now

Pre-release version v2.0.7 published

Posted: Monday 21 September 2026 21:56
by AddieJanssen
A new day - a new release.

Thanks JayDotR for finding a bug and providing the fix as well :D

I have just published v2.0.7 on GitHub that should fix the bug.

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 22:20
by imautohuttraeger
Wow, that was fast. In your Wiki
https://github.com/addiejanssen/domotic ... lugin/wiki
the following is written:
Updating the plugin can be done by removing the previous version and do a clean install again. Make sure to stop the Domoticz service before you start or at least stop all hardware that is related to the plugin.

Make sure that the requirements listed in the requirements.txt file are met. If newer versions of the solaredge_modbus library are required, make sure that you remove the older versions to prevent version conflicts.
Question: Will I loose all devices in Domoticz by a new clean install or will they be kept? I am asking, because I use several devices idx in scripts.

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 23:09
by AddieJanssen
imautohuttraeger wrote: Monday 21 September 2026 22:20 Wow, that was fast. In your Wiki
https://github.com/addiejanssen/domotic ... lugin/wiki
the following is written:
Updating the plugin can be done by removing the previous version and do a clean install again. Make sure to stop the Domoticz service before you start or at least stop all hardware that is related to the plugin.

Make sure that the requirements listed in the requirements.txt file are met. If newer versions of the solaredge_modbus library are required, make sure that you remove the older versions to prevent version conflicts.
Question: Will I loose all devices in Domoticz by a new clean install or will they be kept? I am asking, because I use several devices idx in scripts.
Replacing the folder/files of the plugin will have no impact on existing devices or settings.
Just make sure that you don't make changes to the hardware in Domoticz.

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Monday 21 September 2026 23:23
by imautohuttraeger
.......Thx! .....

SolarEdge SunSpec Scanner

Posted: Tuesday 22 September 2026 22:09
by AddieJanssen
I need your help...

I have started work on the "detection of meters and batteries may not (correctly) work for all inverters" topic.

SolarEdge inverters implement the SunSpec protocol which provides an option to scan for devices connected to the inverter.

I have created a scanner that will contact the inverter to scan for devices attached to it.

I am looking for you to run the scanner and share the output here in this forum.
Based on that, I get an understanding of the different types of inverters in use and if scanning for devices works or not.
I would appreciate that you run the scanner even when there are no batteries or meters attached to your inverter.

You can find the scanner and instructions how to use it on GitHub: https://github.com/addiejanssen/solared ... ec-scanner

WARNING: the scanner requires a newer version of pymodbus which is incompatible with the Domoticz SolarEdge_ModbusTCP!
So, keep things separated by using different computers, containers or virtual environments!

Here's the output when I ran the scanner (python scanner.py inverter 502) for my inverter:

Code: Select all

Connecting to server
 Connected to server

  The inverter is providing a SunSpec Map

   Reading Block at address [40002] for device [1]
    Block id = 1: Common
     Manufacturer:   [SolarEdge ]
     Model:          [SE7K]
     Options:        []
     Version:        [0003.2537]
     Device Address: [1]

   Reading Block at address [40069] for device [1]
    Block id = 103: Inverter (Three Phase)

   Reading Block at address [40121] for device [1]
    Block id = -1: The End of the block list has been reached

Closed connection to serve

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Tuesday 22 September 2026 22:54
by imautohuttraeger
Will try to run it on my Pi with a copy of the SD card for security reasons tomorrow.

However, in case we need to use pymodbus 3.15.0 more often for testing, I am thinking of this procedure:

1.
pip3 install pymodbus==3.15.0

2.
Do the scan, copy the output and post it on the forum

3.
Go back to old pymodbus, so that the current plugin works again:
pip3 install pymodbus==3.6.9

Would that work? If yes: Must I install the dependencies again?

Re: New Python plugin: Domoticz SolarEdge_ModbusTCP

Posted: Tuesday 22 September 2026 23:05
by AddieJanssen
There's an easier way of doing things...
Create another user on your pi and run the scanner while logged in as that user.