Xiaomi Mijia smart button question

I’m running Dockerised hass.io on a Raspberry Pi2 with my Xiaomi Aqara hub (lumi gateway v3) & various Sonoff switches on stock firmware. I have tried my very first automation with a Xiaomi Mijia smart button and failed. The Mi Home app is logging all the button presses. The Sonoff switches and the Aqara hub light work OK when controlled from the cards on the front page of HA. I have also unsuccessfully tried it with a TP Link switch. This is what I have in my configuration.yaml file:

automation:
  trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.switch_158d000187XXXX
      click_type: single
  action:
    service: switch.toggle
    data:
      entity_id: switch.sonoff_10001cXXXX

I strongly suspect I have made a noob mistake along the way and would be grateful for any advice.

Thanks

I’ve got

trigger:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_######
click_type: single
action:
- service: switch.turn_off
entity_id: switch.heater

Hope this helps

Cheers, I’ve changed the entry to:

automation:
  trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.switch_158d000187XXXX
      click_type: single
  action:
    - service: switch.toggle
      data:
        entity_id: switch.sonoff_10001cXXXX

but still not working.

Ive got and it works:

  trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.wall_switch_158d0002c9d9d2
      click_type: single
  action:
    service: switch.toggle
    data:
      entity_id: switch.sonoff_basic1

Thanks everyone, I finally got it figured. I had entered the commands in the configuration.yaml file instead of automations.yaml. Told you it would be a stupid noob error!