aukedejong / domoticz-fronius-inverter-plugin

Domoticz Fronius Inverter plugin
MIT License
9 stars 8 forks source link

Error: 'onHeartbeat' failed 'KeyError'. #2

Open Martial83 opened 3 years ago

Martial83 commented 3 years ago

Hi @aukedejong and a big thank you for that! The plugin work very well, but, at night, i have errors like that, every 30s 2021-04-10 07:21:24.184 Error: (Mon onduleur) 'onHeartbeat' failed 'KeyError'. 2021-04-10 07:21:24.184 Error: (Mon onduleur) ----> Line 181 in '/home/pi/domoticz/plugins/domoticz-fronius-inverter-plugin/plugin.py', function onHeartbeat 2021-04-10 07:21:24.184 Error: (Mon onduleur) ----> Line 65 in '/home/pi/domoticz/plugins/domoticz-fronius-inverter-plugin/plugin.py', function onHeartbeat 2021-04-10 07:21:24.184 Error: (Mon onduleur) ----> Line 125 in '/home/pi/domoticz/plugins/domoticz-fronius-inverter-plugin/plugin.py', function updateDeviceCurrent

I don't understand why. Can you help me?

Moosbueffel commented 3 years ago

Perhaps because you have energy saving mode on at night!?

Martial83 commented 3 years ago

Yes, you'r right. Do I have to delete it? There is no other solution?

Moosbueffel commented 3 years ago

Yes, you can try to switch it off. Id didn't use this plugin, because I have 2 devices, so my device ID is system, which is not supported by this plugin. But I use the same API-call. And I disabled energy saving at night and it works.

So give it a try!

Moosbueffel commented 3 years ago

Other solution is only to disable the calls at night. I think, this can only be done by the developer. Or yoou change the code by yourself.

In my case I also collect the consuption, which is also running during night ;).

Martial83 commented 3 years ago

Thank you for your help. I can't find the option on my fronius

Moosbueffel commented 3 years ago

I checked Settings and manual and also can't find. Perhaps its in the menue at the hardware. This setting was done from my installateur. Perhaps you can ask your installateur if you will not find the setting.

Martial83 commented 3 years ago

I've found Nightmode, but it is only for the display panel

Martial83 commented 3 years ago

No, it's not only for the display panel. I'll try it

Martial83 commented 3 years ago

Hi, I have found the problem: We must test jsonObject["Body"]["Data"]["DeviceStatus"]["ErrorCode"] rather jsonObject["Head"]["Status"]["Code"] which one is always 0 In addition, I commented logDebugMessage("JSON: " + str(jsonData)) dans getInverterRealtimeData To be clean, we should test jsonObject["Body"]["Data"]["DeviceStatus"]["ErrorCode"] (307 during night)

def isInverterActive(self, jsonObject): return jsonObject["Body"]["Data"]["DeviceStatus"]["ErrorCode"] == 0

sincze commented 1 year ago

With the help from this thread I started to modify the plugin a bit so it continues to work for me with the necessary additional checks. https://github.com/sincze/domoticz-fronius-inverter-plugin