1
0

Move bedroom lights automation logic to scripts

This commit is contained in:
Przemek Grondek 2021-11-12 02:56:26 +01:00
parent 6d2f876f9c
commit 0524519a2b
4 changed files with 107 additions and 63 deletions

View File

@ -7,40 +7,7 @@
type: remote_button_short_press type: remote_button_short_press
subtype: turn_off subtype: turn_off
action: action:
- choose: - service: script.bedroom_bed_lamp_toggle
- conditions:
- condition: state
entity_id: light.bed_lamp
state: 'on'
sequence:
- service: light.turn_off
entity_id: light.bed_lamp
- service: light.turn_off
entity_id: light.bed_lightstrip
- service: light.turn_off
entity_id: light.bedroom_lights
- conditions:
- condition: state
entity_id: light.bed_lamp
state: 'off'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: light.turn_on
entity_id: light.bed_lamp
data:
brightness_pct: 10
kelvin: 2000
default:
- service: light.turn_on
entity_id: light.bed_lamp
data:
brightness_pct: 30
kelvin: 3200
- id: bedroom-bed-sleep - id: bedroom-bed-sleep
alias: '[Bedroom] Bed Sleep' alias: '[Bedroom] Bed Sleep'

View File

@ -8,9 +8,7 @@
type: remote_button_short_press type: remote_button_short_press
subtype: turn_on subtype: turn_on
action: action:
- service: light.turn_on - service: script.bedroom_lights_on
data:
entity_id: light.bedroom_lights
mode: single mode: single
- id: bedroom-button-turn-off - id: bedroom-button-turn-off
@ -22,9 +20,7 @@
type: remote_button_short_press type: remote_button_short_press
subtype: turn_off subtype: turn_off
action: action:
- service: light.turn_off - service: script.bedroom_all_lights_off
data:
entity_id: light.bedroom_lights
mode: single mode: single
- id: bedroom-button-dim-up - id: bedroom-button-dim-up

View File

@ -14,27 +14,7 @@
entity_id: input_select.home_mode entity_id: input_select.home_mode
state: Day state: Day
action: action:
- choose: - service: script.bedroom_lights_on
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.bedroom_lights
data:
brightness_pct: 60
kelvin: 2000
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
sequence:
- service: light.turn_on
entity_id: light.bedroom_lights
data:
brightness_pct: 60
kelvin: 3200
- id: bedroom-motion-off - id: bedroom-motion-off
alias: '[Bedroom] Motion Off' alias: '[Bedroom] Motion Off'
@ -50,5 +30,4 @@
entity_id: alarm_control_panel.ha_alarm entity_id: alarm_control_panel.ha_alarm
state: disarmed state: disarmed
action: action:
- service: light.turn_off - service: script.bedroom_lights_off
entity_id: light.bedroom_lights

View File

@ -0,0 +1,102 @@
bedroom_lights_toggle:
alias: '[Bedroom] Lights toggle'
sequence:
- choose:
- conditions:
- condition: state
entity_id: light.bedroom_lights
state: 'on'
sequence:
- service: script.bedroom_lights_off
- conditions:
- condition: state
entity_id: light.bedroom_lights
state: 'off'
sequence:
- service: script.bedroom_lights_on
bedroom_lights_on:
alias: '[Bedroom] Lights on'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.bedroom_lights
data:
brightness_pct: 60
kelvin: 2000
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
sequence:
- service: light.turn_on
entity_id: light.bedroom_lights
data:
brightness_pct: 60
kelvin: 3200
bedroom_lights_off:
alias: '[Bedroom] Lights off'
sequence:
- service: light.turn_off
entity_id: light.bedroom_lights
bedroom_all_lights_off:
alias: '[Bedroom] All lights off'
sequence:
- service: light.turn_off
entity_id: light.bedroom_lights
- service: light.turn_off
entity_id: light.bed_lightstrip
- service: light.turn_off
entity_id: light.bed_lamp
bedroom_bed_lamp_toggle:
alias: '[Bedroom] Bed lamp toggle'
sequence:
- choose:
- conditions:
- condition: state
entity_id: light.bed_lamp
state: 'on'
sequence:
- service: script.bedroom_bed_lamp_off
- conditions:
- condition: state
entity_id: light.bed_lamp
state: 'off'
sequence:
- service: script.bedroom_bed_lamp_on
bedroom_bed_lamp_on:
alias: '[Bedroom] Bed lamp on'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: light.turn_on
entity_id: light.bed_lamp
data:
brightness_pct: 10
kelvin: 2000
default:
- service: light.turn_on
entity_id: light.bed_lamp
data:
brightness_pct: 30
kelvin: 3200
bedroom_bed_lamp_off:
alias: '[Bedroom] Bed lamp off'
sequence:
- condition: state
entity_id: light.bed_lamp
state: 'off'