I’ve just installed my new wall switches which also include the neutral line (called zero line in gearbest site).
I am quite surprised to see that they also show the power consumption, the daily total consumption and monthly consumption on mi app. And the current consumption seems to be true too.
It is found as switch.wall_switch_ln_158xxxxxxxx. Is there a way to get this power values readable too?
If the events uses the same attributes like the device called “plug” you can just enable the power consumption feature for testing. Go to site-packages/homeassistant/components/switch/xiaomi.py anf flip the third parameter at device.append() from False to True:
All variante are accepted now: CAFEC0FFEE00, CA:FE:C0:FF:EE:00, cafe0ffee00, ca:fe:c0:ff:ee:00
res_gw_conf = {'sid': gw_conf.get(CONF_MAC)}
if res_gw_conf['sid'] is not None:
res_gw_conf['sid'] = res_gw_conf['sid'].replace(":", "").lower()
if len(res_gw_conf['sid']) != 12:
raise vol.Invalid('Invalid mac address', gw_conf.get(CONF_MAC))
key = gw_conf.get('key')
The code retrieves the config parameter “CONF_MAC” (mac), removes the “:” and transforms to lower case. If the result doesn’t have a length of 12 chars it will be reported as invalid.
Than i’m stuck. Just relaunched the HA. And then in the logs i see sensor reporting motion.
Definetly there is no motion involved and the logs in Mi Home prove that.
What steps should i take to debug further?
In the past it was enough to do “real motion” in front of the motion sensor. A few minutes later it will fall back to no_motion and the problem is gone. If this does not help. Remove the battery for a moment.
The motion is correctly reported in the log of MiHome app. So it is hard to blame the hardware issue.
Currently fixed it by removing and re adding to the MiHome.
It’s a firmware issue. The communication between your gateway and the chinese servers (mi home app) uses another protocol. Home assistant uses the local procotol which has some flaws. Just monitor (debug log) the events. You will see home assistant just shows what’s reported from the gateway. If the gateway reports a lie we are lost.
If you want to go deeper: Build a zigbee sniffer
and decode the traffic between gateway and motion sensor. Is the issue visible here, too?
So indeed they have changed something in 149. So recommendation is not to update. I believe nobody knows yet how to downgrade on Xiaomi…
Wonder if the all in one zigbee USB stick developed by a french guy and which he states can control xiaomi will make it to the market
The “stuck motion sensor” is not an issue of 149. It pops up from time to time unfortunately and is a pretty old bug. I had the same problem right after the update to 148.
I have enabled logging, edited the xiaomi file and this is from the states page for the switch:
Power consumed: null
Load power: null
friendly_name: Night Light
In use: null
battery_level: 100
icon: mdi:lightbulb-on
Nothing is usable here. Meanwhile as of before the current power value is valid in the mi home app.
And this is the event it creates when switched on: 2017-08-17 16:44:16 DEBUG (Thread-6) [homeassistant.components.xiaomi] PUSH >> <Entity Wall Switch LN_158dxxxxxxxxx: on>: {'channel_0': 'on'}
I finally integrated two of the plugs last night, and noticed the same thing on the Mi app.
I would love to be able to capture daily consumption through HA.
Events of the round wireless button: single, double, hold, long_click_press, long_click_release
Events of the squared wireless button: single, double
Events of the wireless wall switch (single-key): single
Events of the wireless wall switch (double-key): single, single, both