Xiaomi switch (With relay)

Hello!
As i understand Xiaomi switches doesn’t have the states On and OFF, only one state - Push.
This states I cant see in HA (Except Wireless round button)

I have one wired switch, which has a relay inside, so how can I control it?

No, you are wrong.
Xiaomi switches has 2 states - “on” when button is pressed and “off” when is released.

Some states and events of xiaomi aqara devices are here: Xiaomi Gateway (Aqara) - Home Assistant

If you want to control wired xiaomi swtch you should first set option in mihome app “convert button to wireless switch”. After that You can write standard automations for the swich eg.:

- alias: Turn off lamp and gateway when chandelier is on
  trigger:
    platform: state
    entity_id: switch.wall_switch_right_158d0001f413ab
    to: 'on'
  condition:
    condition: state
    entity_id: light.niebieski
    state: 'on'
  action:
  - service: light.turn_off
    entity_id: light.niebieski, light.gateway_light_7811dcb06922

- alias: on\off chandelier
  trigger:
    platform: event
    event_type: click
    event_data:
     entity_id: binary_sensor.wall_switch_right_158d0001e118b0
     click_type: single
  action:
    service: switch.toggle
    entity_id: switch.wall_switch_right_158d0001f413ab

This is an example for double switch

I think he is referring to WXKG12LM (see: https://github.com/Koenkk/zigbee2mqtt/wiki/Supported-devices#xiaomi).

This indeed has one state usually, however automations can work based on the events. It really depends what integration you use for support:

  • Native zha: component?
  • xiamo_aqara: component?
  • zigbee2mqtt addon?

Thanks, its clear.
I cant did it because switch with zero line doesn’t has this options(

So, i cant control it with HA?

Have you looked in mihome plug-in (…)/more functions?

Yes, at iOS and Android.
No options like this.

I seen this option at Youtube, it was switch without zero line.

After few days, switch appeared.
Thanks, for help.

I have a qbkg03lm which is working fine with automations and I can “Listen to events” and see when the buttons are clicked. When I click the button the lights go on and off.

I see an option in the Mi Home “Convert left button to wireless switch” and “Convert right button to wireless switch.” When I enable these two options physically clicking the buttons no longer causes the lights to turn off and on. I can still turn the lights off and on using the buttons in the Mi Home app, which means they are responding to commands. But the problem is I can no longer see any events in HomeAssistant when I “listen to events”, which means I can’t build automations off them.

Long story short: qbkg03lm when converted to a wireless switch… the events are not seen in HomeAssistant when I physically push buttons but I can still control hem through HomeAssistant / Mi Home.

1 Like

Is anyone able to help? Thanks!