#IKEA motion sensor shut off light after X minutes after detected motion?

1 messages · Page 1 of 1 (latest)

latent birch
#

Hello, I have an IKEA motion sensor and a EcoDim dimmer https://www.zigbee2mqtt.io/devices/Eco-Dim.07_Eco-Dim.10.html with a few dumb lights in my bathroom.
My motion sensor successfully turns on lights, but there is somewthing wrong with the logic to shut them off.

What works: turn on lights scenes depending time of the day (ecodim 20% during night time, 30% evening, 70% day time).

What does not work: shut off ecodim light, when there hasnt been any detected motion for X amount of minutes, and the light is on.

How it behaves now: if I leave bathroom with lights on, it never triggers the shut off light, and light is on forever.
If I press ecodim button to shutoff light, and then quickly try to leave bathrom, then motion is detected and it turns on again. so I have to press ecodim once again to shut off light.

my automations:
this fails to work as I want,

alias: motion sensor bathroom lamp OFF
description: ""
triggers:
  - type: not_occupied
    device_id: 1da98976057540d6ba36d16019f35597
    entity_id: c256944dda5772ebb7869fad5dbde97a
    domain: binary_sensor
    trigger: device
conditions:
  - type: is_not_occupied
    condition: device
    device_id: 1da98976057540d6ba36d16019f35597
    entity_id: c256944dda5772ebb7869fad5dbde97a
    domain: binary_sensor
    for:
      hours: 0
      minutes: 15
      seconds: 0
  - condition: device
    type: is_on
    device_id: b9a83edf993d4ac0bc57a3935878229d
    entity_id: 6ccb7b59e94de70434a75418b109a372
    domain: light
actions:
  - type: turn_off
    device_id: b9a83edf993d4ac0bc57a3935878229d
    entity_id: light.ecodim_light
    domain: light
mode: single
#

this successfully turns on light during the time I want.

alias: motion sensor bathroom lamp MID
description: ""
mode: single
triggers:
  - type: motion
    device_id: 1da98976057540d6ba36d16019f35597
    entity_id: binary_sensor.motion_sensor_occupancy
    domain: binary_sensor
    trigger: device
conditions:
  - condition: device
    type: is_off
    device_id: b9a83edf993d4ac0bc57a3935878229d
    entity_id: light.ecodim_light
    domain: light
  - condition: or
    conditions:
      - condition: time
        after: "06:30:00"
        before: "08:00:00"
      - condition: time
        after: "22:00:00"
        before: "23:59:59"
actions:
  - action: scene.turn_on
    target:
      entity_id: scene.ecodim_medium
    data: {}
vapid haven
#

Try the following:

  1. Run action light.turn_off for that light from Dev Tools > Actions.
  2. Run that action to turn off the light from your automation, the 3-dot menu attached to your actions
  3. Try a version of the automation without the condition
    Also, do you see anything in the automation traces?
trail pelican
#

the condition you have set can NEVER be true during the time of triggering

you have set a condition that the room must be empty for 15 minutes at the moment where it becomes empty

remove the condition completely and put the "for 15 minutes" into the trigger

latent birch
trail pelican
#

I don't know what you mean by "the when"
it needs to be in the trigger

#

basically not_occupied for 15m

latent birch
#
alias: motion sensor bathroom lamp OFF
description: ""
triggers:
  - type: not_occupied
    device_id: 1da98976057540d6ba36d16019f35597
    entity_id: c256944dda5772ebb7869fad5dbde97a
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 15
      seconds: 0
conditions:
  - condition: device
    type: is_on
    device_id: b9a83edf993d4ac0bc57a3935878229d
    entity_id: 6ccb7b59e94de70434a75418b109a372
    domain: light
actions:
  - type: turn_off
    device_id: b9a83edf993d4ac0bc57a3935878229d
    entity_id: light.ecodim_light
    domain: light
mode: single
trail pelican
#

correct - that should work

#

you seem to be creating one automation per trigger - that can become confusing quickly
I would recommend to put every "topic" in a single automation

like in your case one automation to handle the light and the motion sensor

latent birch
#

So this almost works now, but the problem is that if I stay in the bathroom and make lots of movement for 15 minutes (+ ikea motion sensor backoff timer for a minute or so) - then the light is still shut off!
And then if I just move a little bit while still in the bathroom, it will turn on instantly again.

I basically want to reset these 15 minutes every time the ikea motion sensor detects motion

trail pelican
#

then I assume your motion sensor doesn't recognize motion in case it's too bright
look at the docs from your sensor if you can disable this behavior

it's not related to the automation

vapid quiver