Yeelight and xiaomi Gateway switch

HI
I am trying to workout how to get my Yeelight to work with my xiaomi switch
I tried the following code into the automatyion.yaml but it just comes back with an error

  • id: 1001
    alias: Turn on lights
    trigger:
    • platform: event
      event_type: click
      event_data:
      entity_id: binary_sensor.switch_158d00016d77d9
      click_type: single
      action:
    • service: switch.toggle
      data:
      entity_id: group.all_lights

Any advice would be great

Hi,

try calling the service light.toggle instead of the service switch.toggle.
Simply replace switch.toggle with light.toggle in your automation.

Thanks for that. It still doesn’t appears to work

Here is a log error I get

lid config for [automation]: expected dict for dictionary value @ data[‘action’][0][‘data’]. Got None
expected dict for dictionary value @ data[‘trigger’][0][‘event_data’]. Got None
expected str for dictionary value @ data[‘id’]. Got None
extra keys not allowed @ data[‘trigger’][0][‘click_type’]. Got None
extra keys not allowed @ data[‘trigger’][0][‘entity_id’]. Got None. (See /config/configuration.yaml, line 146). Please check the docs at https://home-assistant.io/components/automation/

Can anyone point me in the right direction.

Just adapt one of the examples at the documentation: https://home-assistant.io/components/binary_sensor.xiaomi_aqara/#xiaomi-wireless-button

- alias: Toggle all lights
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d00016d77d9
      click_type: single
  action:
    service: homeassistant.toggle
    entity_id: group.all_lights

Thanks for that, it worked…

Cheers