AutomationDataset/jkpe/jkpe_automations.yaml

145 lines
3.7 KiB
YAML

- alias: 8sleep - Combined Automation
description: Handles wake display, temperature cycling, auto-off display, and sending
temperatures to Eight Sleep API
triggers:
- id: button_on
entity_id: binary_sensor.esphome_web_5c4f38_button
from: 'off'
to: 'on'
trigger: state
- id: button_off
entity_id: binary_sensor.esphome_web_5c4f38_button
from: 'on'
to: 'off'
for:
seconds: 30
trigger: state
- id: button_off
entity_id:
- binary_sensor.esphome_web_5c4f38_button
to: 'off'
for:
seconds: 30
trigger: state
from: unavailable
- id: '-2'
entity_id: input_select.eight_sleep_temperature_choices
to: '-2'
for:
seconds: 10
trigger: state
- id: '-1'
entity_id: input_select.eight_sleep_temperature_choices
to: '-1'
for:
seconds: 10
trigger: state
- id: '0'
entity_id: input_select.eight_sleep_temperature_choices
to: '0'
for:
seconds: 10
trigger: state
- id: '1'
entity_id: input_select.eight_sleep_temperature_choices
to: '1'
for:
seconds: 10
trigger: state
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: button_on
sequence:
- if:
- condition: state
entity_id: light.esphome_web_5c4f38_backlight
state: 'off'
then:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.esphome_web_5c4f38_backlight
else:
- action: input_select.select_next
metadata: {}
data:
cycle: true
target:
entity_id: input_select.eight_sleep_temperature_choices
- conditions:
- condition: trigger
id: button_off
sequence:
- target:
entity_id: light.esphome_web_5c4f38_backlight
action: light.turn_off
data: {}
- conditions:
- condition: or
conditions:
- condition: trigger
id: '-2'
- condition: trigger
id: '-1'
- condition: trigger
id: '0'
- condition: trigger
id: '1'
sequence:
- condition: not
conditions:
- condition: state
entity_id: sensor.jack_s_eight_sleep_side_bed_state_type
state: 'off'
- choose:
- conditions:
- condition: trigger
id: '-2'
sequence:
- target:
entity_id: sensor.jack_s_eight_sleep_side_bed_temperature
data:
sleep_stage: bedTimeLevel
target: -20
duration: 0
action: eight_sleep.heat_set
- conditions:
- condition: trigger
id: '-1'
sequence:
- target:
entity_id: sensor.jack_s_eight_sleep_side_bed_temperature
data:
sleep_stage: current
target: -10
duration: 0
action: eight_sleep.heat_set
- conditions:
- condition: trigger
id: '0'
sequence:
- target:
entity_id: sensor.jack_s_eight_sleep_side_bed_temperature
data:
sleep_stage: current
target: 0
duration: 0
action: eight_sleep.heat_set
- conditions:
- condition: trigger
id: '1'
sequence:
- target:
entity_id: sensor.jack_s_eight_sleep_side_bed_temperature
data:
sleep_stage: current
target: 10
duration: 0
action: eight_sleep.heat_set
default: []
mode: single