Aqara/Xiaomi double wall switch (with neutral) state lost after HA restart

Hi there,

I’ve just installed 2 Aqara switches and hooked them up to Home Assistant - one is a single button no neutral and one is double button with neutral. Both work great until I restart HA … single button version restores it’s state but double button version always shows ‘off’ (both buttons) which basically breaks ‘switch.toggle’ automation against it.

I searched a lot around this forum but didn’t find any info:(

I’ve enabled debug and can see that there is difference in response from the ‘good’ single button and the ‘bad’ double button switch on HA init:

the bad:

2018-12-18 01:10:44 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158XXXXXX"}'
2018-12-18 01:10:44 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'ctrl_ln2.aq1', 'sid': '158XXXXXX', 'short_id': 18661, 'data': '{"voltage":3600}'}
2018-12-18 01:10:44 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158XXXXXX, ctrl_ln2.aq1 as: switch
2018-12-18 01:13:52 DEBUG (Thread-4) [xiaomi_gateway] MCAST (heartbeat) << {'cmd': 'heartbeat', 'model': 'ctrl_ln2.aq1', 'sid': '158XXXXXX', 'short_id': 18661, 'data': '{"voltage":3600}'}
2018-12-18 01:13:52 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch LN Right_158XXXXXX: off>: {'voltage': 3600}
2018-12-18 01:13:52 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch LN Left_158XXXXXX: off>: {'voltage': 3600}

<Entity Wall Switch LN Left_158XXXXXX: off> - this one is actually ON at this moment

the good:

2018-12-18 01:10:44 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158YYYYYYY"}'
2018-12-18 01:10:44 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'ctrl_neutral1', 'sid': '158YYYYYYY', 'short_id': 47635, 'data': '{"voltage":3300,"channel_0":"off"}'}
2018-12-18 01:10:44 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158YYYYYYY, ctrl_neutral1 as: switch
2018-12-18 01:15:54 DEBUG (Thread-4) [xiaomi_gateway] MCAST (heartbeat) << {'cmd': 'heartbeat', 'model': 'ctrl_neutral1', 'sid': '158YYYYYYY', 'short_id': 47635, 'data': '{"voltage":3300,"channel_0":"off"}'}
2018-12-18 01:15:54 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch_158YYYYYYY: off>: {'voltage': 3300, 'channel_0': 'off'}

i.e. the ‘good’ one has {“voltage”:3300,“channel_0”:“off”}’ while I don’t see that on the double switch.


  • Does anyone else have this issue?
  • If that is confirmed to be a “feature” (not a bug), is there a way to workaround this behaviour (for example, saving the pre-restart state somehow “manually” and then restoring it using automation afterwards)?

I have the same problem, my device is QBKG12LM double keys with neutral line
imo, the problem comes from gw firmware, it only reports no meaning voltage

I’ve described a very dirty workaround here Restore state of Xiaomi switch after restart - but that’s not really a solution (