Add HA automations
This commit is contained in:
parent
5aa4769b92
commit
e12a2fa2c4
2 changed files with 308 additions and 49 deletions
|
|
@ -21,16 +21,16 @@
|
||||||
id: second_btn
|
id: second_btn
|
||||||
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
||||||
domain: zha
|
domain: zha
|
||||||
type: remote_button_double_press
|
type: remote_button_long_press
|
||||||
subtype: button_1
|
subtype: button_1
|
||||||
trigger: device
|
trigger: device
|
||||||
id: first_btn_double
|
id: first_btn_long
|
||||||
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
||||||
domain: zha
|
domain: zha
|
||||||
type: remote_button_double_press
|
type: remote_button_long_press
|
||||||
subtype: button_2
|
subtype: button_2
|
||||||
trigger: device
|
trigger: device
|
||||||
id: second_btn_double
|
id: second_btn_long
|
||||||
conditions: []
|
conditions: []
|
||||||
actions:
|
actions:
|
||||||
- choose:
|
- choose:
|
||||||
|
|
@ -39,16 +39,23 @@
|
||||||
id:
|
id:
|
||||||
- first_btn
|
- first_btn
|
||||||
sequence:
|
sequence:
|
||||||
|
# Cycle ceiling light preset: off -> 1 -> 2 -> 3 -> 4 -> off
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: light.cell_light
|
entity_id: light.cell_light
|
||||||
state: 'off'
|
state: 'off'
|
||||||
sequence:
|
sequence:
|
||||||
|
# Turn on at preset 1
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 1
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
- action: light.turn_on
|
- action: light.turn_on
|
||||||
data:
|
data:
|
||||||
color_temp_kelvin: 2000
|
color_temp_kelvin: 1800
|
||||||
brightness_pct: 70
|
brightness_pct: 30
|
||||||
target:
|
target:
|
||||||
entity_id: light.cell_light
|
entity_id: light.cell_light
|
||||||
- conditions:
|
- conditions:
|
||||||
|
|
@ -56,27 +63,95 @@
|
||||||
entity_id: light.cell_light
|
entity_id: light.cell_light
|
||||||
state: 'on'
|
state: 'on'
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_off
|
# Check current preset and cycle
|
||||||
target:
|
- choose:
|
||||||
entity_id:
|
- conditions:
|
||||||
- light.cell_light
|
- condition: state
|
||||||
data: {}
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
state: '4.0'
|
||||||
|
sequence:
|
||||||
|
# At preset 4, turn off
|
||||||
|
- action: light.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: light.cell_light
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 0
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
state: '3.0'
|
||||||
|
sequence:
|
||||||
|
# Move to preset 4
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 4
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 3000
|
||||||
|
brightness_pct: 100
|
||||||
|
target:
|
||||||
|
entity_id: light.cell_light
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
state: '2.0'
|
||||||
|
sequence:
|
||||||
|
# Move to preset 3
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 3
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2500
|
||||||
|
brightness_pct: 75
|
||||||
|
target:
|
||||||
|
entity_id: light.cell_light
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
state: '1.0'
|
||||||
|
sequence:
|
||||||
|
# Move to preset 2
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 2
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 50
|
||||||
|
target:
|
||||||
|
entity_id: light.cell_light
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- second_btn
|
- second_btn
|
||||||
sequence:
|
sequence:
|
||||||
|
# Cycle bed lights preset: off -> 1 -> 2 -> 3 -> 4 -> off
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: light.table_lights_bed_lights
|
entity_id: light.table_lights_bed_lights
|
||||||
state: 'off'
|
state: 'off'
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_on
|
# Turn on at preset 1
|
||||||
metadata: {}
|
- action: input_number.set_value
|
||||||
data:
|
data:
|
||||||
color_temp_kelvin: 2000
|
value: 1
|
||||||
brightness_pct: 50
|
target:
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 1800
|
||||||
|
brightness_pct: 30
|
||||||
target:
|
target:
|
||||||
entity_id: light.table_lights_bed_lights
|
entity_id: light.table_lights_bed_lights
|
||||||
- conditions:
|
- conditions:
|
||||||
|
|
@ -84,35 +159,101 @@
|
||||||
entity_id: light.table_lights_bed_lights
|
entity_id: light.table_lights_bed_lights
|
||||||
state: 'on'
|
state: 'on'
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_off
|
# Check current preset and cycle
|
||||||
metadata: {}
|
- choose:
|
||||||
data: {}
|
- conditions:
|
||||||
target:
|
- condition: state
|
||||||
entity_id: light.table_lights_bed_lights
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
state: '4.0'
|
||||||
|
sequence:
|
||||||
|
# At preset 4, turn off
|
||||||
|
- action: light.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 0
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
state: '3.0'
|
||||||
|
sequence:
|
||||||
|
# Move to preset 4
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 4
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 3000
|
||||||
|
brightness_pct: 100
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
state: '2.0'
|
||||||
|
sequence:
|
||||||
|
# Move to preset 3
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 3
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2500
|
||||||
|
brightness_pct: 75
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
state: '1.0'
|
||||||
|
sequence:
|
||||||
|
# Move to preset 2
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 2
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 50
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- first_btn_double
|
- first_btn_long
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_on
|
# Long press button 1: turn off ceiling light and reset preset
|
||||||
metadata: {}
|
- action: light.turn_off
|
||||||
data:
|
|
||||||
color_temp_kelvin: 3000
|
|
||||||
brightness_pct: 100
|
|
||||||
target:
|
target:
|
||||||
entity_id: light.cell_light
|
entity_id: light.cell_light
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 0
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_ceiling_light_preset
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- second_btn_double
|
- second_btn_long
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_on
|
# Long press button 2: turn off bed lights and reset preset
|
||||||
metadata: {}
|
- action: light.turn_off
|
||||||
data:
|
|
||||||
color_temp_kelvin: 2000
|
|
||||||
brightness_pct: 75
|
|
||||||
target:
|
target:
|
||||||
entity_id: light.table_lights_bed_lights
|
entity_id: light.table_lights_bed_lights
|
||||||
|
- action: input_number.set_value
|
||||||
|
data:
|
||||||
|
value: 0
|
||||||
|
target:
|
||||||
|
entity_id: input_number.bedroom_bed_light_preset
|
||||||
mode: single
|
mode: single
|
||||||
|
|
||||||
- id: '1750278561179'
|
- id: '1750278561179'
|
||||||
|
|
@ -191,33 +332,127 @@
|
||||||
target:
|
target:
|
||||||
area_id: living_room
|
area_id: living_room
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: and
|
- condition: trigger
|
||||||
conditions:
|
id:
|
||||||
- condition: trigger
|
- left
|
||||||
id:
|
|
||||||
- left
|
|
||||||
- right
|
|
||||||
- condition: state
|
|
||||||
entity_id: light.zbt_1_table_light
|
|
||||||
state: 'on'
|
|
||||||
sequence:
|
sequence:
|
||||||
|
# Decrease preset (minimum 1)
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: numeric_state
|
||||||
id:
|
entity_id: input_number.living_room_light_preset
|
||||||
- left
|
above: 1
|
||||||
|
sequence:
|
||||||
|
- action: input_number.decrement
|
||||||
|
target:
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
# Apply the preset settings
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '1.0'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 1800
|
||||||
|
brightness_pct: 30
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '2.0'
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_on
|
- action: light.turn_on
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data:
|
data:
|
||||||
color_temp_kelvin: 2000
|
color_temp_kelvin: 2000
|
||||||
brightness_pct: 70
|
brightness_pct: 50
|
||||||
target:
|
target:
|
||||||
area_id: living_room
|
area_id: living_room
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: state
|
||||||
id:
|
entity_id: input_number.living_room_light_preset
|
||||||
- right
|
state: '3.0'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2500
|
||||||
|
brightness_pct: 75
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '4.0'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 3000
|
||||||
|
brightness_pct: 100
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- right
|
||||||
|
sequence:
|
||||||
|
# Increase preset (maximum 4)
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: numeric_state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
below: 4
|
||||||
|
sequence:
|
||||||
|
- action: input_number.increment
|
||||||
|
target:
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
# Apply the preset settings
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '1.0'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 1800
|
||||||
|
brightness_pct: 30
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '2.0'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 50
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '3.0'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2500
|
||||||
|
brightness_pct: 75
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_number.living_room_light_preset
|
||||||
|
state: '4.0'
|
||||||
sequence:
|
sequence:
|
||||||
- action: light.turn_on
|
- action: light.turn_on
|
||||||
metadata: {}
|
metadata: {}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,31 @@ default_config:
|
||||||
frontend:
|
frontend:
|
||||||
themes: !include_dir_merge_named themes
|
themes: !include_dir_merge_named themes
|
||||||
|
|
||||||
|
# Input number helpers for light presets
|
||||||
|
input_number:
|
||||||
|
living_room_light_preset:
|
||||||
|
name: Living Room Light Preset
|
||||||
|
initial: 2
|
||||||
|
min: 1
|
||||||
|
max: 4
|
||||||
|
step: 1
|
||||||
|
mode: box
|
||||||
|
bedroom_ceiling_light_preset:
|
||||||
|
name: Bedroom Ceiling Light Preset
|
||||||
|
initial: 0
|
||||||
|
min: 0
|
||||||
|
max: 4
|
||||||
|
step: 1
|
||||||
|
mode: box
|
||||||
|
bedroom_bed_light_preset:
|
||||||
|
name: Bedroom Bed Light Preset
|
||||||
|
initial: 0
|
||||||
|
min: 0
|
||||||
|
max: 4
|
||||||
|
step: 1
|
||||||
|
mode: box
|
||||||
|
|
||||||
# External configuration files
|
# External configuration files
|
||||||
automation: !include automations.yaml
|
automation: !include automations.yaml
|
||||||
script: !include scripts.yaml
|
script: !include scripts.yaml
|
||||||
scene: !include scenes.yaml
|
scene: !include scenes.yaml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue