Ikea automation problem

Hello

I am new to home-assistant but have managed to get most of my setup working using mainly ikea lights/ sensors and conbee2 stick

I am unable to correctly use automation for turning lights off after no motion detected for 10 minutes
It works fine to turn on when motion detected and turns on the light, but it does not turn off when no motion detected for 10 minutes.
However if i dont put any minutes in the automation it turns off after 2-3 minutes the default ikea timer

My automation file is as follows

#Bathroom
- alias: Bathroom motion sensor activated
  trigger:
    platform: state
    entity_id: binary_sensor.tradfri_motion_sensor
    to: 'on'
  action:
    service: light.turn_on
    entity_id: light.color_bathroom

- alias: Bathroom motion sensor deactivated
  trigger:
    platform: state
    entity_id: binary_sensor.tradfri_motion_sensor
    to: 'off'
    for:
     minutes: 10
  action:
    service: light.turn_off
    entity_id: light.color_bathroom    

any help would be appreciated

Also is there a way to improve/speed up how fast the lights turn on when motion is detected? Sensitivity may be? If yes then how?

I don’t see anything wrong with your automations. Make sure they’re both turned on. Also, the 10 minutes starts when binary_sensor.tradfri_motion_sensor changes to off, not necessarily when motion detection stops. I.e., it depends on how long the sensor takes to change to off once motion is no longer detected. Many, if not most, motion detectors have a minimum “on” time.

Exactly. See in the pic what the manual says. If the sensor is set to go off after 10 minutes, your automation will wait for another 10 minutes and then switch off the light.

But why not just link the sensor with the light directly? That way it will work independently from HA.

That picture is for the old version. The new does does no longer have the switch to set the timeout. It is always 3 minutes.

I don’t see anything wrong with the automation, but if it does not work you can try this :

- alias: Bathroom motion sensor deactivated
  trigger:
    platform: state
    entity_id: binary_sensor.tradfri_motion_sensor
    to: 'off'
  action:
  - delay: 00:10:00
  - service: light.turn_off
    entity_id: light.color_bathroom    

My lights turn on instantly when motion detected.

Thank for the help guys
Working now