Add variables and iron out a few more conditions
This commit is contained in:
@ -5360,37 +5360,99 @@
|
|||||||
id: hallway-timer
|
id: hallway-timer
|
||||||
condition: []
|
condition: []
|
||||||
action:
|
action:
|
||||||
|
- variables:
|
||||||
|
hallway_scene: "{% set people_sleeping = is_state('input_boolean.emma_sleeping','on')
|
||||||
|
or is_state('input_boolean.kallen_sleeping','on') or is_state('input_boolean.master_bedroom_sleeping','on')
|
||||||
|
%} {% if is_state('input_boolean.night_mode','on') or people_sleeping == true
|
||||||
|
%}\n Nightlight\n{% else %}\n Adaptive\n{% endif %}\n"
|
||||||
|
hallway_action: "{% set people_sleeping = is_state('input_boolean.emma_sleeping','on')
|
||||||
|
or is_state('input_boolean.kallen_sleeping','on') or is_state('input_boolean.master_bedroom_sleeping','on')
|
||||||
|
%} {% if is_state('input_boolean.goodnight','on') %}\n off\n{% elif is_state('input_boolean.night_mode','on')
|
||||||
|
or people_sleeping == true or is_state('binary_sensor.early_night_mode','on')
|
||||||
|
%}\n on\n{% else %}\n off\n{% endif %}\n"
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- top-detected
|
- top-detected
|
||||||
|
- condition: numeric_state
|
||||||
|
entity_id: sensor.stairwell_top_illuminance
|
||||||
|
below: input_number.upstairs_hallway_lux_threshold
|
||||||
|
alias: Stairwell Top Illuminance is below lux threshold
|
||||||
sequence: []
|
sequence: []
|
||||||
|
alias: Stairwell Top Detected
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- bottom-detected
|
- bottom-detected
|
||||||
|
- alias: Stairwell Bottom Illuminance is below lux threshold
|
||||||
|
condition: numeric_state
|
||||||
|
entity_id: sensor.stairwell_bottom_illuminance
|
||||||
|
below: input_number.stairwell_lux_threshold
|
||||||
sequence: []
|
sequence: []
|
||||||
|
alias: Stairwell Bottom Detected
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- top-clear
|
- top-clear
|
||||||
sequence: []
|
- alias: Lights are on
|
||||||
|
condition: or
|
||||||
|
conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.hallway_overhead
|
||||||
|
state: 'on'
|
||||||
|
alias: Hallway Overhead
|
||||||
|
- alias: Stairwell LED Strip
|
||||||
|
condition: state
|
||||||
|
entity_id: light.stairwell_led_strip
|
||||||
|
state: 'on'
|
||||||
|
sequence:
|
||||||
|
- service: timer.start
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
duration: '{{ states(''input_number.upstairs_hallway_lights_off_delay'')
|
||||||
|
| int * 60 }}'
|
||||||
|
target:
|
||||||
|
entity_id: timer.upstairs_hallway_motion_timer
|
||||||
|
alias: Start upstairs hallway motion timer
|
||||||
|
alias: Stairwell Top Clear
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- bottom-clear
|
- bottom-clear
|
||||||
sequence: []
|
- alias: Lights are on
|
||||||
- conditions:
|
condition: or
|
||||||
- condition: trigger
|
conditions:
|
||||||
id:
|
- condition: state
|
||||||
- stairwell-timer
|
entity_id: light.hallway_overhead
|
||||||
sequence: []
|
state: 'on'
|
||||||
|
alias: Hallway Overhead
|
||||||
|
- alias: Stairwell LED Strip
|
||||||
|
condition: state
|
||||||
|
entity_id: light.stairwell_led_strip
|
||||||
|
state: 'on'
|
||||||
|
sequence:
|
||||||
|
- service: timer.start
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
duration: '{{ states(''input_number.stairwell_lights_off_delay'') | int
|
||||||
|
* 60 }}'
|
||||||
|
target:
|
||||||
|
entity_id: timer.stairwell_motion_timer
|
||||||
|
alias: Start stairwell motion timer
|
||||||
|
alias: Stairwell Bottom Clear
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- hallway-timer
|
- hallway-timer
|
||||||
sequence: []
|
sequence: []
|
||||||
|
alias: Hallway Timer Finished
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- stairwell-timer
|
||||||
|
sequence: []
|
||||||
|
alias: Stairwell Timer Finished
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|
||||||
'
|
'
|
||||||
|
Reference in New Issue
Block a user