Open mjf2708 opened 5 years ago
Hello I've the same error.
With a HS110 EU the json is :
(TP Link HS110) got response: {'emeter': {'get_realtime': {'current_ma': 151, 'err_code': 0, 'voltage_mv': 236387, 'power_mw': 28591, 'total_wh': 17}}}
And the script are waiting for this key :
Devices[2].Update(nValue=int(1 * realtime_result['current']), sValue=str(realtime_result['current']))
Devices[3].Update(nValue=int(1 * realtime_result['voltage']), sValue=str(realtime_result['voltage']))
Devices[4].Update(nValue=int(1 * realtime_result['power']), sValue=str(realtime_result['power']))
I had the same problem when using the plugin with HS110, Hardware version 2.0, Firmware version 1.5.4 The plugin now works when I changed line 198 - 200 in plugin.py to: Devices[2].Update(nValue=0, sValue=str(realtime_result['current_ma'] / 1000)) Devices[3].Update(nValue=0, sValue=str(realtime_result['voltage_mv'] / 1000)) Devices[4].Update(nValue=0, sValue=str(realtime_result['power_mw'] / 1000))
It seems like that the JSON response from my HS110 returns mV, mA and mW instead of V, A and W. This solution is described in: https://www.domoticz.com/forum/viewtopic.php?t=13290&start=120
I adopted the above solution, and now Domoticz isn't crashing anymore, but I am not getting readings for (W). Under the devices heading, the values say 0, 12.709. Current and Voltage are showing up fine. What could be wrong?
I'm getting the following errors with this plugin:
2018-10-27 19:15:31.682 Error: (hs110) 'onHeartbeat' failed 'KeyError'. 2018-10-27 19:15:31.682 Error: (hs110) ----> Line 262 in /home/pi/domoticz/plugins/tplink/plugin.py, function onHeartbeat 2018-10-27 19:15:31.682 Error: (hs110) ----> Line 136 in /home/pi/domoticz/plugins/tplink/plugin.py, function onHeartbeat 2018-10-27 19:15:31.682 Error: (hs110) ----> Line 198 in /home/pi/domoticz/plugins/tplink/plugin.py, function update_emeter_values
Resolved by changing nvalue to 0 in lines 198-200.