solaredge_modbus icon indicating copy to clipboard operation
solaredge_modbus copied to clipboard

KeyError "Status"

Open infoedkok opened this issue 1 year ago • 3 comments

Hi, After upgrading Domoticz to 2024-1 (docker container) and installing the plugin from version 1.1.1 and solaredge_modbus-0.8.0 I have these errors: 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: Call to function 'onHeartbeat' failed, exception details: 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: Traceback (most recent call last): 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: File "/opt/domoticz/userdata/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py", line 544, in onHeartbeat 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: _plugin.onHeartbeat() 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: File "/opt/domoticz/userdata/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py", line 352, in onHeartbeat 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: to_lookup = int(inverter_values[unit[Column.MODBUSNAME]]) 2024-02-13 15:27:22.544 Error: SolarEdgeMODBUS: KeyError: 'status'

'Status' looks like one of the 22 items that are passed. This status reports on what the inverter is doing.

"KeyError" message is generated by in ---init---.py"!

Here in ---init---.py there's a list of keys for Status which refers to INVERTER_STATUS_MAP, line 110: INVERTER_STATUS_MAP = [ "Undefined", "Off", "Sleeping", "Grid Monitoring", "Producing", "Producing (Throttled)", "Shutting Down", "Fault", "Standby" ]

I think that this list is missing some status and that causes this message?

The errors appear randomly :-(

Versions after pip3 install -r requirements.txt : Requirement already satisfied: solaredge_modbus==0.7.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (0.7.0) Requirement already satisfied: pymodbus>=2.4.0 in /usr/local/lib/python3.9/dist-packages (from solaredge_modbus==0.7.0->-r requirements.txt (line 1)) (3.6.4)

Any idea what status of the inverter could cause this?

Regards, Ed

infoedkok avatar Feb 19 '24 11:02 infoedkok

Hi, I experience the same errors, that keep on going at random intervals: 2024-05-31 09:36:06.614 Error: SolarEdge: Call to function 'onHeartbeat' failed, exception details: 2024-05-31 09:36:06.616 Error: SolarEdge: Traceback (most recent call last): 2024-05-31 09:36:06.616 Error: SolarEdge: File "/home/pi/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py", line 544, in onHeartbeat 2024-05-31 09:36:06.616 Error: SolarEdge: _plugin.onHeartbeat() 2024-05-31 09:36:06.616 Error: SolarEdge: File "/home/pi/domoticz/plugins/domoticz-solaredge-modbustcp-plugin/plugin.py", line 352, in onHeartbeat 2024-05-31 09:36:06.616 Error: SolarEdge: to_lookup = int(inverter_values[unit[Column.MODBUSNAME]]) 2024-05-31 09:36:06.616 Error: SolarEdge: KeyError: 'status'

(plugin version 1.1.1 and solaredge_modbus-0.7.0, not in docker-container.) Although it seems to work pretty well, it looks ugly in my error log. If I can help by providing more info or maybe testing, let me know.

Regards, Jos

OlmZone avatar May 31 '24 08:05 OlmZone

Averter mentioned in this link https://github.com/saidlm/Domoticz-Solax-plugin/issues/3 a possible cause and solution: it has to do with pymodbus version. If the version starts with 3.3 or 3.0 it ought to be lowercase big and little, otherwise it needs to be uppercase BIG and LITTLE. See an implementation line in HA code

In this case, in init.py of the solaredge module, it is in uppercase. Pymodbus installed inside my domoticz is 3.6.4. So uppercase should be fine (?)

EDIT: tested it anyway (replaced 5 BIG>big and 1 LITTLE>little in ___ init ___.py). No result, still getting the error

infoedkok avatar Sep 04 '24 12:09 infoedkok