Hi, I have this automation, where light turn on when there is motion, turn off when there have been no motion for 3 minutes. But if iMac is active, the light must not be turned off.
But the light does not turn off, after the iMac is inactive? What i’m doing wrong?
alias: Tanjas Kontor Motion
description: ""
trigger:
- type: motion
platform: device
device_id: 1da4a376d6a402f5ee85a4d729404159
entity_id: binary_sensor.tanjas_kontor_motion
domain: binary_sensor
id: motion-detected
- type: no_motion
platform: device
device_id: 1da4a376d6a402f5ee85a4d729404159
entity_id: binary_sensor.tanjas_kontor_motion
domain: binary_sensor
id: motion-notdetected
for:
hours: 0
minutes: 3
seconds: 0
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: motion-detected
- type: is_illuminance
condition: device
device_id: 1da4a376d6a402f5ee85a4d729404159
entity_id: sensor.tanjas_kontor_motion_illuminance
domain: sensor
below: 50
sequence:
- service: light.turn_on
data:
brightness_pct: 80
target:
area_id: tanjas_kontor
- conditions:
- condition: trigger
id: motion-notdetected
sequence:
- if:
- type: is_off
condition: device
device_id: ea1d7286edb2de376c615a4536284254
entity_id: binary_sensor.tanjas_imac_active
domain: binary_sensor
then:
- service: light.turn_off
data: {}
target:
area_id: tanjas_kontor
mode: single