nmakel / solaredge_modbus

SolarEdge Modbus data collection library
MIT License
140 stars 33 forks source link

KeyError "Status" #96

Open infoedkok opened 4 months ago

infoedkok commented 4 months ago

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

OlmZone commented 1 month ago

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