This automation turning on specific lights after certain time and below specific illuminance. Another automation turning off some of them when I’m watching Netflix so I did add condition to keep them off until Netflix (or another service) is running. When I’m going back to certain source on TV they are back on.
alias: Wieczor
description: ''
trigger:
- type: motion
platform: device
device_id: 27c7636ede85df65e7e8f50fdd28331f
entity_id: binary_sensor.czujnik_ruchu_salon_occupancy
domain: binary_sensor
condition:
- condition: template
value_template: '{{ state_attr(''media_player.sonytv'', ''app_id'') != ''org.videolan.vlc'' }}'
- condition: template
value_template: '{{ state_attr(''media_player.sonytv'', ''app_id'') != ''com.netflix.ninja'' }}'
- condition: template
value_template: '{{ state_attr(''media_player.sonytv'', ''app_id'') != ''org.xbmc.kodi'' }}'
- condition: time
before: '22:00'
after: '17:00'
- type: is_illuminance
condition: device
device_id: 27c7636ede85df65e7e8f50fdd28331f
entity_id: sensor.czujnik_ruchu_salon_illuminance_lux
domain: sensor
below: 7
above: 0
action:
- type: turn_on
device_id: 2462ade5b3a61552de466a074fdbf084
entity_id: light.lampka
domain: light
brightness_pct: 60
- service: light.turn_on
data: {}
target:
entity_id: light.sciana
mode: single