Files
sarah/config/packages/modes/house_mode.yaml
T
2020-05-01 16:17:32 +03:00

80 lines
1.9 KiB
YAML

# Mode config
input_select:
house_mode:
name: House mode
icon: mdi:home-analytics
options:
- day
- bed
- night
binary_sensor:
- platform: template
sensors:
house_mode:
friendly_name: House mode
value_template: "{{ states('input_select.house_mode') }}"
icon_template: >-
{% if is_state('input_select.house_mode', 'day') %}
mdi:weather-sunny
{% elif is_state('input_select.house_mode', 'bed') %}
mdi:bed-king-outline
{% else %}
mdi:weather-night
{% endif %}
script:
house_mode_next:
alias: House mode · Next
sequence:
- service: input_select.select_option
entity_id: input_select.house_mode
data_template:
option: >
{% if is_state('input_select.house_mode', 'day') %}
bed
{% elif is_state('input_select.house_mode', 'bed') %}
night
{% else %}
day
{% endif %}
automation:
- alias: House mode · Set to day
trigger:
platform: state
entity_id: input_select.house_mode
to: "day"
action:
- service: script.routine_waking_up
- alias: House mode · Set to bed
trigger:
platform: state
entity_id: input_select.house_mode
to: "bed"
action:
- service: script.routine_bedtime
- alias: House mode · Set to night
trigger:
platform: state
entity_id: input_select.house_mode
to: "night"
action:
- service: script.routine_good_night
- alias: House mode · Toggle on bedside switch double click
trigger:
- platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_bedside_switch_ieee
command: double
action:
- service: script.house_mode_next