Automation not trggering


I have this simple automation but not working .I’m new in the home assistant world.

this is my automation :

- id: '1613218899468'
  alias: turn on the light when motion detected
  description: ''
  - platform: device
    domain: binary_sensor
    entity_id: binary_sensor.couloir_chambre_sensor_on_off
    device_id: 27d7baaf79a57d1addc87e04ef185f5e
    type: motion
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  condition: []
  - domain: light
    entity_id: light.couloir_chambre_light_level_on_off
    device_id: 85a8c8336fd25399c8e7b90a6125fad8
    type: turn_on
  mode: single

Do I need to restart hass every time I create an automation ?

Best regards

No, go to Configuration -> Server Controls -> Reload Automations.
Do you really want to wait one minute after motion has been detected to turn on the lights? Don’t you want to turn it on immediately when motion is detected? If so, remove the for: part

1 Like

I remove the for . I see that the motion sensor detect but the automation is still not trigger


When you press execute there, does it turn the light on?

Yes if I click execute the light turn on.

I don’t use UI automations, so here is the YAML version:

- id: '1613218899468'
  alias: turn on the light when motion detected
  description: ''
    platform: state
    entity_id: binary_sensor.couloir_chambre_sensor_on_off
    to: 'on'
    service: light.turn_on
    entity_id: light.couloir_chambre_light_level_on_off
  mode: single

I tried your code if I click execute the light turn on but with detection nothing happen .

I’m using home assistant core-2021.2.3. Do I need to install an addon or something like that ?

I tried the blueprint Motion-activated Light but same thing no trigering. But I’m sure my motion sensor is workingmotion-detected

Can you please show how the sensor looks like under Developer Tools -> States?

[binary_sensor.couloir_chambre_sensor_occupancy] off friendly_name: Couloir Chambre sensor occupancy device_class: occupancy
[binary_sensor.couloir_chambre_sensor_on_off] off friendly_name: Couloir Chambre sensor on_off device_class: motion

I found out whtat’s wrong I was using binary_sensor.couloir_chambre_sensor_on_off but hass trigger with binary_sensor.couloir_chambre_sensor_occupancy.

Now it’s working thank you for your help