8000 The power consumption of Aqara(Xiaomi) Wall Plug is not updated correctly on the HA page · Issue #16457 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

The power consumption of Aqara(Xiaomi) Wall Plug is not updated correctly on the HA page #16457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
keniji opened this issue Sep 6, 2018 · 3 comments · Fixed by #17235
Closed
Assignees

Comments

@keniji
Copy link
keniji commented Sep 6, 2018

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.

@keniji
Copy link
Author
keniji commented Sep 6, 2018

Just enabled the debug level for logger, and it looks like the component "homeassistant.core" will process the response package from the hub:

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'}

but ignoring reports from the hub later?:

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 1
8000
6: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}]}

@keniji
Copy link
Author
keniji commented Sep 8, 2018

Have rebuilt a new clear HA and verify it could be an issue with HA itself, though I've modified some code to workaround this issue, hopefully there will be any fix in future..

@syssi syssi self-assigned this Oct 7, 2018
@syssi
Copy link
Member
syssi commented Oct 7, 2018

Summary: The data key of the LAN protocol v3 of the ctrl_86plug is "channel_0". Fields are 'inuse', 'energy_consumed' and 'load_power'. Needs to be fixed!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0