Xiaomi button battery discovered but no on/off

Pretty sure button presses are going to come as events.

Check out that section on the wireless button.

There is no state to this button. There is no on/off.

If you want to use it as a switch to control a light, you’d have to create a template_light. You would use the light as the state somehow (light sensor would work well, or just guess). Then you could tie the command_on/command_off to the button.

To explain how to handle the events:

- alias: Toggle dining light on single press
  trigger:
    # When the button is pressed, do something
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.switch_158d000xxxxxc2
      click_type: single
  action:
    # What to do when the button is pressed
    service: switch.toggle
    entity_id: switch.wall_switch_left_158d000xxxxx01
1 Like