Wemo's Binary Sensor doesn't work with motion detected

Hi,

My wemo sensor was recognised as binary_sensor.garage_motion. HA able to display when there is motion detected. I tried to automate with a simple script to see if this is working. But it doesn’t trigger the action to turn on my switch light. Below is my configuration:

trigger:
- platform: state
entity_id: binary_sensor.garage_motion
state: ‘on’
action:
service: switch.turn_on
entity_id: switch.garage_light

Try changing state: on to to: 'on' to see if it helps

I tried that to: 'on’ but it still not working.
I have also added from: 'off’ then follow by to: 'on' , still not working.
I wonder if there is documentation somewhere to find the state change?

The following should work. Make sure you have it indented properly like below. And, check your log file for any Errors or Warnings after restarting HA.

alias: Turn on garage light
  trigger:
    platform: state
    entity_id: binary_sensor.garage_motion
    to: 'on'
  action:
    service: switch.turn_on
    entity_id: switch.garage_light

Still doesn’t work for me…Maybe it was due to the slow response on wemo sensor?
I will need to test out more… Thanks all.

Finally, its working after several trial and errors.
Need to be very careful on the space in between and syntax.
Thank you all for the advice!

Try using yamllint to check your syntax every time you start HASS.

Thank you, it’s very useful!