2022-08-07 18:10:43 +00:00
|
|
|
script:
|
|
|
|
#----------------------------------------------------------------------------------#
|
|
|
|
# Left
|
2022-08-09 09:21:13 +00:00
|
|
|
#----------------------------------------------------------------------------------#
|
2022-08-07 18:10:43 +00:00
|
|
|
pos_left_incr:
|
|
|
|
alias: pos_left_incr
|
|
|
|
sequence:
|
|
|
|
- if:
|
|
|
|
- condition: numeric_state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
above: '0'
|
|
|
|
then:
|
|
|
|
- service: input_number.set_value
|
|
|
|
data:
|
|
|
|
value: 0
|
|
|
|
target:
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
else:
|
|
|
|
- if:
|
|
|
|
- condition: numeric_state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
above: '3'
|
|
|
|
then:
|
|
|
|
- service: input_number.set_value
|
|
|
|
data:
|
2022-08-07 18:28:21 +00:00
|
|
|
value: 1
|
2022-08-07 18:10:43 +00:00
|
|
|
target:
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
else:
|
|
|
|
- service: input_number.increment
|
|
|
|
target:
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
# Restart/Start the timer
|
|
|
|
- service: timer.cancel
|
|
|
|
target:
|
|
|
|
entity_id: timer.pos_timer
|
|
|
|
- service: timer.start
|
|
|
|
target:
|
|
|
|
entity_id: timer.pos_timer
|
|
|
|
mode: single
|
2022-08-09 09:21:13 +00:00
|
|
|
#----------------------------------------------------------------------------------#
|
2022-08-07 18:10:43 +00:00
|
|
|
# Right
|
2022-08-09 09:21:13 +00:00
|
|
|
#----------------------------------------------------------------------------------#
|
2022-08-07 18:10:43 +00:00
|
|
|
pos_right_incr:
|
|
|
|
alias: pos_right_incr
|
|
|
|
sequence:
|
|
|
|
- if:
|
|
|
|
- condition: numeric_state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
above: '0'
|
|
|
|
then:
|
|
|
|
- service: input_number.set_value
|
|
|
|
data:
|
|
|
|
value: 0
|
|
|
|
target:
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
else:
|
|
|
|
- if:
|
|
|
|
- condition: numeric_state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
above: '2'
|
|
|
|
then:
|
|
|
|
- service: input_number.set_value
|
|
|
|
data:
|
2022-08-07 18:28:21 +00:00
|
|
|
value: 1
|
2022-08-07 18:10:43 +00:00
|
|
|
target:
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
else:
|
|
|
|
- service: input_number.increment
|
|
|
|
target:
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
# Restart/Start the timer
|
|
|
|
- service: timer.cancel
|
|
|
|
target:
|
|
|
|
entity_id: timer.pos_timer
|
|
|
|
- service: timer.start
|
|
|
|
target:
|
|
|
|
entity_id: timer.pos_timer
|
|
|
|
mode: single
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------------#
|
|
|
|
# Up
|
2022-08-09 09:21:13 +00:00
|
|
|
#----------------------------------------------------------------------------------#
|
2022-08-07 18:10:43 +00:00
|
|
|
pos_up:
|
|
|
|
alias: pos_up
|
|
|
|
sequence:
|
|
|
|
# 0,0
|
|
|
|
- if:
|
|
|
|
- condition: and
|
|
|
|
conditions:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "0.0"
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
state: "0.0"
|
|
|
|
then:
|
2022-08-09 16:30:51 +00:00
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: light.all_lights
|
|
|
|
state: "on"
|
|
|
|
then:
|
|
|
|
- service: script.summary_notification
|
2022-08-11 19:07:23 +00:00
|
|
|
else:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.snapshot_all
|
|
|
|
#- service: light.turn_on
|
|
|
|
# target:
|
|
|
|
# entity_id: light.all_lights
|
2022-08-07 18:10:43 +00:00
|
|
|
# 1,0 Ceiling
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "1.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: light.ceiling
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 2,0 Bed
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "2.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: light.bed_ceiling
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 3,0 Indirect
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "3.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: light.all_indirect
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 4,0 All Lights
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "4.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: light.all_lights
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 0,1 Adaptive
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
state: "1.0"
|
|
|
|
then:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.light_adaptive
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 0,2 Night
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
state: "2.0"
|
|
|
|
then:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.light_night
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 0,3 Bright
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
state: "3.0"
|
|
|
|
then:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.light_bright
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
mode: single
|
2022-08-09 09:21:13 +00:00
|
|
|
#----------------------------------------------------------------------------------#
|
2022-08-07 18:10:43 +00:00
|
|
|
# Down
|
2022-08-09 09:21:13 +00:00
|
|
|
#----------------------------------------------------------------------------------#
|
2022-08-07 18:10:43 +00:00
|
|
|
pos_down:
|
|
|
|
alias: pos_down
|
|
|
|
sequence:
|
|
|
|
# 0,0
|
|
|
|
- if:
|
|
|
|
- condition: and
|
|
|
|
conditions:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "0.0"
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_right
|
|
|
|
state: "0.0"
|
|
|
|
then:
|
2022-08-09 16:30:51 +00:00
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: light.all_lights
|
|
|
|
state: "off"
|
|
|
|
then:
|
|
|
|
- service: script.summary_notification
|
2022-08-11 19:07:23 +00:00
|
|
|
else:
|
|
|
|
- service: light.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: light.all_lights
|
2022-08-07 18:10:43 +00:00
|
|
|
# 1,0 Ceiling
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "1.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: light.ceiling
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 2,0 Bed
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "2.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: light.bed_ceiling
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 3,0 Indirect
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "3.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: light.all_indirect
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# 4,0 All Lights
|
|
|
|
- if:
|
|
|
|
- condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_number.pos_left
|
|
|
|
state: "4.0"
|
|
|
|
then:
|
|
|
|
- service: light.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: light.all_lights
|
|
|
|
mode: single
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------------------#
|
|
|
|
# Dimming
|
|
|
|
#----------------------------------------------------------------------------------#
|
|
|
|
button_brightness_up:
|
|
|
|
sequence:
|
|
|
|
- service: light.turn_on
|
|
|
|
data_template:
|
|
|
|
entity_id: light.direct
|
|
|
|
brightness: >-
|
|
|
|
{% set current = states.light.direct.attributes.brightness|default(0)|int %}
|
|
|
|
{% set step = 100 %}
|
|
|
|
{% set next = current + step %}
|
|
|
|
{% if next > 255 %}
|
|
|
|
{% set next = 255 %}
|
|
|
|
{% endif %}
|
|
|
|
{{ next }}
|
|
|
|
- delay:
|
|
|
|
milliseconds: 1
|
|
|
|
- service: script.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: script.button_brightness_up_loop
|
|
|
|
|
|
|
|
button_brightness_up_loop:
|
|
|
|
sequence:
|
|
|
|
- service: script.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: script.button_brightness_up
|
|
|
|
|
|
|
|
button_brightness_down:
|
|
|
|
sequence:
|
|
|
|
- service: light.turn_on
|
|
|
|
data_template:
|
|
|
|
entity_id: light.direct
|
|
|
|
brightness: >-
|
|
|
|
{% set current = states.light.direct.attributes.brightness|default(0)|int %}
|
|
|
|
{% set step = 100 %}
|
|
|
|
{% set next = current - step %}
|
|
|
|
{% if next < 1 %}
|
|
|
|
{% set next = 1 %}
|
|
|
|
{% endif %}
|
|
|
|
{{ next }}
|
|
|
|
- delay:
|
|
|
|
milliseconds: 1
|
|
|
|
- service: script.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: script.button_brightness_down_loop
|
|
|
|
|
|
|
|
button_brightness_down_loop:
|
|
|
|
sequence:
|
|
|
|
- service: script.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: script.button_brightness_down
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------#
|
|
|
|
# Automations
|
|
|
|
#------------------------------------------------------------------------------------#
|
|
|
|
automation:
|
|
|
|
# Timer
|
|
|
|
- alias: pos_timer_reset
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: event
|
|
|
|
event_type: timer.finished
|
|
|
|
event_data:
|
|
|
|
entity_id: timer.pos_timer
|
|
|
|
action:
|
|
|
|
- service: input_number.set_value
|
|
|
|
data:
|
|
|
|
value: 0
|
|
|
|
target:
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_left
|
|
|
|
- input_number.pos_right
|
|
|
|
# Pos 1,0 Ceiling
|
|
|
|
- alias: pos_1_0_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_left
|
|
|
|
to: "1.0"
|
|
|
|
action:
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-11 21:03:59 +00:00
|
|
|
- service: switch.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: switch.adaptive_lighting_default
|
2022-08-07 18:10:43 +00:00
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
effect: Twitter
|
|
|
|
target:
|
|
|
|
entity_id: light.ceiling
|
|
|
|
- delay:
|
|
|
|
hours: 0
|
|
|
|
minutes: 0
|
|
|
|
seconds: 1
|
2022-08-11 21:03:59 +00:00
|
|
|
milliseconds: 500
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.snapshot_all
|
2022-08-07 18:10:43 +00:00
|
|
|
# Pos 2,0 Ceiling Bed
|
|
|
|
- alias: pos_2_0_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_left
|
|
|
|
to: "2.0"
|
|
|
|
action:
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-11 21:03:59 +00:00
|
|
|
- service: switch.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: switch.adaptive_lighting_default
|
2022-08-07 18:10:43 +00:00
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
effect: Twitter
|
|
|
|
target:
|
|
|
|
entity_id: light.bed_ceiling
|
|
|
|
- delay:
|
|
|
|
hours: 0
|
|
|
|
minutes: 0
|
|
|
|
seconds: 1
|
2022-08-11 21:03:59 +00:00
|
|
|
milliseconds: 500
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.snapshot_all
|
2022-08-07 18:10:43 +00:00
|
|
|
# Pos 3,0 Indirect
|
|
|
|
- alias: pos_3_0_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_left
|
|
|
|
to: "3.0"
|
|
|
|
action:
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-11 21:03:59 +00:00
|
|
|
- service: switch.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: switch.adaptive_lighting_default
|
2022-08-07 18:10:43 +00:00
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
effect: Twitter
|
|
|
|
target:
|
|
|
|
entity_id: light.all_indirect
|
|
|
|
- delay:
|
|
|
|
hours: 0
|
|
|
|
minutes: 0
|
|
|
|
seconds: 1
|
2022-08-11 21:03:59 +00:00
|
|
|
milliseconds: 500
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.snapshot_all
|
2022-08-07 18:10:43 +00:00
|
|
|
# Pos 4,0 All Lights
|
|
|
|
- alias: pos_4_0_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_left
|
|
|
|
to: "4.0"
|
|
|
|
action:
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-11 21:03:59 +00:00
|
|
|
- service: switch.turn_off
|
|
|
|
target:
|
|
|
|
entity_id: switch.adaptive_lighting_default
|
2022-08-07 18:10:43 +00:00
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
effect: Twitter
|
|
|
|
target:
|
|
|
|
entity_id: light.all_lights
|
|
|
|
- delay:
|
|
|
|
hours: 0
|
|
|
|
minutes: 0
|
|
|
|
seconds: 1
|
2022-08-11 21:03:59 +00:00
|
|
|
milliseconds: 500
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.snapshot_all
|
2022-08-07 18:10:43 +00:00
|
|
|
# Pos 0,1 Adaptive
|
|
|
|
- alias: pos_0_1_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_right
|
|
|
|
to: "1.0"
|
|
|
|
action:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.light_adaptive
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# Pos 0,2
|
|
|
|
- alias: pos_0_2_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_right
|
|
|
|
to: "2.0"
|
|
|
|
action:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
|
|
|
entity_id: scene.light_night
|
2022-08-11 19:07:23 +00:00
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|
2022-08-07 18:10:43 +00:00
|
|
|
# Pos 0,3
|
|
|
|
- alias: pos_0_3_flash
|
|
|
|
mode: single
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- input_number.pos_right
|
|
|
|
to: "3.0"
|
|
|
|
action:
|
|
|
|
- service: scene.turn_on
|
|
|
|
target:
|
2022-08-11 19:07:23 +00:00
|
|
|
entity_id: scene.light_bright
|
|
|
|
- service: automation.trigger
|
|
|
|
target:
|
|
|
|
entity_id: automation.light_all_snapshot
|