Files
sarah/config/packages/modes/bedroom_mode.yaml
T

76 lines
1.9 KiB
YAML

# Mode config
input_select:
bedroom_mode:
name: Bedroom mode
icon: mdi:home-analytics
options:
- day
- bed
- night
binary_sensor:
- platform: template
sensors:
bedroom_mode:
friendly_name: Bedroom mode
value_template: "{{ states('input_select.bedroom_mode') }}"
icon_template: >-
{% if is_state('input_select.bedroom_mode', 'day') %}
mdi:weather-sunny
{% elif is_state('input_select.bedroom_mode', 'bed') %}
mdi:bed-king-outline
{% else %}
mdi:weather-night
{% endif %}
automation:
- alias: Bedroom mode · Set to day
trigger:
platform: state
entity_id: input_select.bedroom_mode
to: "day"
action:
- service: script.routine_waking_up
- alias: Bedroom mode · Set to bed
trigger:
platform: state
entity_id: input_select.bedroom_mode
to: "bed"
action:
- service: script.routine_bedtime
- alias: Bedroom mode · Set to night
trigger:
platform: state
entity_id: input_select.bedroom_mode
to: "night"
action:
- service: script.routine_good_night
- alias: Bedroom mode · Set to day if bedroom door was opened
trigger:
- platform: state
entity_id: binary_sensor.bedroom_door
to: "on"
- platform: state
entity_id: group.bedroom_windows
condition:
- condition: template
value_template: "{{ now().hour >= states('input_datetime.alarm_time')[0:2]|int }}"
- condition: not
conditions:
- condition: state
entity_id: input_select.bedroom_mode
state: "day"
- condition: state
entity_id: input_boolean.georgi_home
state: "on"
action:
- service: input_select.select_option
entity_id: input_select.bedroom_mode
data:
option: "day"