How to figure out state for light to turn on [automation]

- alias: 'Turn on bedroom light when there is movement'
  trigger:
    platform: state
    entity_id: binary_sensor.downstairs_sensor_motion
    from: 'Off'
    to: 'On'
  action:
    - service: light.turn_on
    - entity_id: light.led_bulb_23_46_0a

Trying to get this to work but not sure how to figure out the “service” part, still new to automating

Thank you

Take the - off the front of the entity_id - you have it for the service and it should work. (Replace the - with a space)

thanks, is it possible the automation to only run once in 24 hours?

You could have a condition that checks last_triggered

- alias: 'Turn bedroom light on if movement'
  trigger:
    platform: state
    entity_id: binary_sensor.downstairs_sensor_motion
    to: 'On'
  action:
    service: light.turn_on
    entity_id: light.led_bulb_23_46_0a

So when i walked in the room that has the binary_sensor, the trigger did not go off, it works if i do a trigger manually from the automation though

change to: 'On’ to 'on' Also, check that the automation is ‘enabled’ (switched ON in the dev entities page)

It’s probably best to check in the states tab - /dev-state/ - what the exact spelling of your binary_sensor.downstairs_sensor_motion actually is: ON, on, On, or even oN :grin: