Description
Home Assistant release with the issue: 0.77.3
Last working Home Assistant release (if known): N/A
Operating environment (Hass.io/Docker/Windows/etc.): Hassbian on Pi 3B+
Component/platform: Switch/xiaomi_aqara
Description of problem:
The power consumption is not updated correctly on the HA page.
For example, I have a device which always has a power of 2x.xx, and it is pluged on an Aqara Wall Plug. When I switch the Wall Plug off, HA will show the status:
Switch: OFF
inuse: 1
load power: 2x.xx
When I switch the Wall Plug on, HA will show the status:
Switch: ON
inuse: 0
load power: 0
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
xiaomi_aqara:
gateways:
- mac:
key: !secret airpar_key
Traceback (if applicable): I'll give a trace here
When I turn on HA, the plug's status:
Swtch ON
load power 21.9
in use 1
The log shows:
2018-09-06 16:30:24 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001xxxxxx"}'
2018-09-06 16:30:24 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_rsp', 'params': [{'battery_voltage': 3600}, {'channel_0': 'on'}, {'inuse': 1}, {'energy_consumed': 110493}, {'load_power': 21.9}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:30:24 DEBUG (Thread-10) [xiaomi_gateway] Registering device 158d0001xxxxxx, ctrl_86plug as: switch
When I turn the plug off on HA, the status:
Switch OFF
load power 21.9
in use 1
The log shows:
2018-09-06 16:35:19 DEBUG (Thread-8) [xiaomi_gateway] _send_cmd >> b'{"cmd": "write", "params": [{"channel_0": "off"}], "key": "c7f13cc4eeeba8ecb1c58e7b61xxxxxx", "sid": "158d0001xxxxxx"}'
2018-09-06 16:35:19 DEBUG (Thread-8) [xiaomi_gateway] _send_cmd resp << {'cmd': 'write_rsp', 'params': [{'battery_voltage': 3600}, {'channel_0': 'on'}, {'inuse': 1}, {'energy_consumed': 110506}, {'load_power': 21.9}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:35:19 DEBUG (Thread-8) [xiaomi_gateway] write_ack << {'cmd': 'write_rsp', 'params': [{'battery_voltage': 3600}, {'channel_0': 'on'}, {'inuse': 1}, {'energy_consumed': 110506}, {'load_power': 21.9}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:35:19 DEBUG (Thread-22) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'params': [{'channel_0': 'off'}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:35:19 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Plug_158d0001xxxxxx: off>: {'channel_0': 'off', 'raw_data': [{'channel_0': 'off'}]}
2018-09-06 16:35:20 DEBUG (Thread-22) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'params': [{'load_power': 0.0}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:35:20 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Plug_158d0001xxxxxx: off>: {'load_power': 0.0, 'raw_data': [{'load_power': 0.0}]}
Then I turn the plug on again on HA, the status:
Switch ON
load power 0
in use 0
The log shows:
2018-09-06 16:39:12 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b'{"cmd": "write", "params": [{"channel_0": "on"}], "key": "6aba63ece5485111d96ec1aff2xxxxxx", "sid": "158d0001xxxxxx"}'
2018-09-06 16:39:12 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {'cmd': 'write_rsp', 'params': [{'battery_voltage': 3600}, {'channel_0': 'off'}, {'inuse': 0}, {'energy_consumed': 110506}, {'load_power': 0.0}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:39:12 DEBUG (Thread-6) [xiaomi_gateway] write_ack << {'cmd': 'write_rsp', 'params': [{'battery_voltage': 3600}, {'channel_0': 'off'}, {'inuse': 0}, {'energy_consumed': 110506}, {'load_power': 0.0}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:39:12 DEBUG (Thread-22) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'params': [{'channel_0': 'on'}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:39:12 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Plug_158d0001xxxxxx: on>: {'channel_0': 'on', 'raw_data': [{'channel_0': 'on'}]}
2018-09-06 16:39:14 DEBUG (Thread-22) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'params': [{'load_power': 21.9}], 'model': 'ctrl_86plug', 'sid': '158d0001xxxxxx'}
2018-09-06 16:39:14 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Plug_158d0001xxxxxx: on>: {'load_power': 21.9, 'raw_data': [{'load_power': 21.9}]}
Then I turn the plug off again on HA:
Switch OFF
load power 20.95
in use 1
Do you have idea on this issue? Thanks in advance!
Additional information:
I move the issue here from:
Danielhiversen/PyXiaomiGateway#90
Long story for short, I found there is an issue causing Wall Plug control problem, I changed the code and the issue is gone, but still find there is another issue (I submit here). Anyway, it seems not related to this issue, since I've restore the original py file but still have this issue.