Hey guys,
- Does anyone have an issue where the lights don’t turn off after x seconds?
- Can you have multiple automation_blockers ?
Basically, I’m trying to use this for my bedroom lights and would like to not run this automation , if my phone is charging + x + x blala.
mode: restart
max_exceeded: silent
variables:
scene_ambient: scene.none
scene_morning: scene.none
scene_day: scene.none
scene_evening: scene.none
scene_night: scene.none
automation_blocker: binary_sensor.pixel_4a_5g_is_charging
automation_blocker_boolean: false
no_motion_blocker: null
no_motion_blocker_boolean: false
elevation_check: 2
scene_no_motion: scene.none
motion_entity: binary_sensor.lumi_lumi_sensor_motion_aq2_b3c65b07_ias_zone
trigger:
- platform: state
entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_b3c65b07_ias_zone
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_b3c65b07_ias_zone
from: 'on'
to: 'off'
for: 120
condition:
- condition: or
conditions:
- '{{ automation_blocker == none }}'
- >-
{{ automation_blocker_boolean and states[automation_blocker].state ==
'on' }}
- >-
{{ not automation_blocker_boolean and states[automation_blocker].state
== 'off' }}
- condition: template
value_template: >-
{{ (elevation_check == none) or (state_attr('sun.sun','elevation') <=
elevation_check | float(90)) }}
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state == ''on'' }}'
sequence:
- choose:
- conditions:
- '{{ scene_morning != ''scene.none''}}'
- condition: time
after: '00:00:00'
before: '00:00:00'
sequence:
- scene: scene.none
- conditions:
- '{{ scene_day != ''scene.none''}}'
- condition: time
after: '00:00:00'
before: '00:00:00'
sequence:
- scene: scene.none
- conditions:
- '{{ scene_evening != ''scene.none''}}'
- condition: time
after: '00:00:00'
before: '00:00:00'
sequence:
- scene: scene.none
- conditions:
- '{{ scene_night != ''scene.none''}}'
- condition: time
after: '00:00:00'
before: '00:00:00'
sequence:
- scene: scene.none
default:
- service: light.turn_on
target:
entity_id: light.bedroom_lights
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state == ''off'' }}'
- condition: or
conditions:
- '{{ no_motion_blocker == none }}'
- >-
{{ no_motion_blocker_boolean and states[no_motion_blocker].state
== 'on' }}
- >-
{{ not no_motion_blocker_boolean and
states[no_motion_blocker].state == 'off' }}
sequence:
- choose:
- conditions:
- '{{ scene_ambient != ''scene.none'' }}'
- condition: time
after: '00:00:00'
before: '00:00:00'
sequence:
- scene: scene.none
- conditions:
- '{{ scene_no_motion != ''scene.none'' }}'
sequence:
- scene: scene.none
default:
- service: light.turn_off
target:
entity_id: light.bedroom_lights
id: '1658293153688'
alias: Motion Lights - Bedroom
description: ''