- id: alice_ping
alias: 'Alice: Ping'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Дом на связи
action:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Тук-тук! Дом на связи
- id: alice_tell_fairy_tale
alias: 'Alice: Tell fairy tale'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Расскажи сказку про белого бычка
action:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Присаживайся поудобнее мой дорогой дружок
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Сейчас я расскажу тебе сказку про белого бычка
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Нет!
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Я тут подумала, а читай-ка ты её сам, ленивый ты крендель!
- id: bathroom_mirror_button_single_press
alias: 'Bathroom Mirror Button: Single press'
trigger:
- trigger: device
domain: mqtt
device_id: 88c16946d5bfcee7dfce360e772ab881
type: action
subtype: single
action:
if:
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: input_boolean.scene_waking_up
state: 'off'
then:
- service: input_boolean.turn_on
entity_id: input_boolean.scene_waking_up
else:
- service: light.toggle
entity_id: light.bathroom_mirror
- id: bathroom_mirror_button_double
alias: 'Bathroom Mirror Button: Double'
trigger:
- trigger: device
domain: mqtt
device_id: 88c16946d5bfcee7dfce360e772ab881
type: action
subtype: double
action:
- choose:
- conditions:
- condition: state
entity_id: light.bathroom_main
state: 'on'
- condition: numeric_state
entity_id: light.bathroom_main
attribute: brightness
below: 250
sequence:
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 100
- conditions:
- condition: state
entity_id: light.bathroom_main
state: 'on'
- condition: numeric_state
entity_id: light.bathroom_main
attribute: brightness
above: 250
sequence:
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 25
- id: bathroom_mirror_button_hold
alias: 'Bathroom Mirror Button: Hold'
trigger:
- trigger: device
domain: mqtt
device_id: 88c16946d5bfcee7dfce360e772ab881
type: action
subtype: hold
action:
- service: light.turn_off
entity_id: group.bathroom_path_lights
- id: bathroom_bathtub_button_single_press
alias: 'Bathroom Bathtub Button: Single press'
trigger:
- trigger: device
domain: mqtt
device_id: f0a662efaa0eddc62b7028e4e5214d8d
type: action
subtype: single
action:
- if:
- condition: state
entity_id: input_select.home_mode
state: Day
then:
- service: light.toggle
entity_id: light.bathroom_bathtub
else:
- service: light.turn_off
entity_id: light.bathroom_main
- service: light.turn_on
entity_id:
- light.bathroom_sink_path
- light.bathroom_toilet_path
data:
rgbw_color:
- 255
- 0
- 0
- 0
brightness_pct: 100
- id: bathroom_bathtub_button_call
alias: 'Bathroom Bathtube Button: Call'
trigger:
- trigger: device
domain: mqtt
device_id: f0a662efaa0eddc62b7028e4e5214d8d
type: action
subtype: double
- trigger: device
domain: mqtt
device_id: f0a662efaa0eddc62b7028e4e5214d8d
type: action
subtype: triple
- trigger: device
domain: mqtt
device_id: f0a662efaa0eddc62b7028e4e5214d8d
type: action
subtype: many
action:
- service: script.yandex_station_tts
data:
target: all
type: alert
pause_atv: true
text: "{{ [\n 'вызывают из ванной, сходи проверь',\n 'нужна помощь в ванной',\n\
\ 'тебя очень хотять видеть в ванной',\n ]|random\n}}\n"
- id: bedroom_ac_display_turn_off
alias: 'Bedroom AC Display: Turn off'
trigger:
- platform: state
entity_id: input_select.home_mode
to: Night
- platform: state
entity_id: climate.bedroom_ac
from: 'off'
condition:
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: climate.bedroom_ac
state:
- heat_cool
- cool
- heat
- dry
action:
- delay:
seconds: 2
- condition: state
entity_id: switch.bedroom_ac_display
state: 'on'
- service: switch.turn_off
entity_id: switch.bedroom_ac_display
- id: bedroom_ac_turn_off
alias: 'Bedroom AC: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.anyone_home
from: 'on'
to: 'off'
for:
minutes: 20
- platform: state
entity_id: climate.bedroom_ac
to:
- heat_cool
- cool
- heat
- dry
for:
hours: 24
- platform: state
entity_id: input_select.home_mode
from: Night
for:
minutes: 5
condition:
- condition: state
entity_id: climate.bedroom_ac
state:
- heat_cool
- cool
- heat
- dry
action:
- service: climate.turn_off
entity_id: climate.bedroom_ac
- id: bedroom_ac_display_update
alias: 'Bedroom AC Display: Update'
trigger:
- id: 'on'
platform: state
entity_id: climate.bedroom_ac
from: 'off'
to:
- heat_cool
- cool
- heat
- dry
- id: 'off'
platform: state
entity_id: climate.bedroom_ac
from:
- heat_cool
- cool
- heat
- dry
to: 'off'
action:
- if:
- condition: trigger
id: 'on'
then:
- service: input_boolean.turn_on
entity_id: input_boolean.bedroom_ac_display
else:
- service: input_boolean.turn_off
entity_id: input_boolean.bedroom_ac_display
- id: bedroom_ac_turn_off_protect
alias: 'Bedroom AC: Turn off (protect)'
trigger:
- platform: time_pattern
seconds: /30
- platform: state
entity_id:
- climate.bedroom_ac
- input_select.washing_machine_status
condition:
- condition: or
conditions:
- and:
- condition: state
entity_id: input_select.washing_machine_status
state: Running
- condition: state
entity_id: climate.workshop_ac
state:
- heat_cool
- cool
- heat
- dry
- condition: numeric_state
entity_id: sensor.outside_temperature
below: -15
- condition: state
entity_id: climate.bedroom_ac
state:
- heat_cool
- cool
- heat
- dry
action:
- service: climate.turn_off
entity_id: climate.bedroom_ac
- id: home_airing_turn_off
alias: 'Home Airing: Turn off'
trigger:
- platform: state
entity_id: switch.home_airing
from: 'off'
to: 'on'
for:
minutes: 20
action:
- service: switch.turn_off
entity_id: switch.home_airing
- id: climate_anomaly_alert
alias: 'Climate: Anomaly alert'
trigger:
- platform: numeric_state
entity_id:
- sensor.bathroom_temperature
- sensor.bedroom_temperature
- sensor.kitchen_temperature
- sensor.living_room_temperature
- sensor.wardrobe_temperature
- sensor.workshop_temperature
below: 15
- platform: numeric_state
entity_id:
- sensor.bathroom_temperature
- sensor.bedroom_temperature
- sensor.kitchen_temperature
- sensor.living_room_temperature
- sensor.wardrobe_temperature
- sensor.workshop_temperature
above: 29
action:
- service: notify.dextor
data:
message: 🤨 Подозрительная температура в доме
- id: living_room_hot
alias: 'Living Room: Hot'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Очень жарко
room: Гостиная
action:
- service: climate.set_temperature
entity_id:
- climate.bedroom_ac
- climate.workshop_ac
data:
temperature: 22
hvac_mode: cool
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Сейчас попробую тебя охладить
- id: living_room_cold
alias: 'Living Room: cold'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Я замёрз
room: Гостиная
action:
- service: climate.turn_off
entity_id:
- climate.bedroom_ac
- climate.workshop_ac
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Ну и ладно
- id: closet_light_turn_on
alias: 'Closet Light: Turn on'
mode: queued
trigger:
- platform: state
entity_id: binary_sensor.closet_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.closet_motion
from: 'off'
to: 'on'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.closet_light_control
state: 'on'
- condition: state
entity_id: light.closet
state: 'off'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
action:
- service: light.turn_on
entity_id: light.closet
- id: closet_light_turn_off
alias: 'Closet Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.closet_door
from: 'on'
to: 'off'
- platform: state
entity_id: binary_sensor.closet_motion
from: 'on'
to: 'off'
for:
minutes: 5
- platform: state
entity_id: light.closet
to: 'on'
for:
minutes: 30
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.closet_light_control
- light.closet
state: 'on'
action:
- service: light.turn_off
entity_id: light.closet
- id: closet_light_control_turn_on
alias: 'Closet Light Control: Turn on'
trigger:
- platform: state
entity_id: light.closet
to: 'off'
condition:
- condition: state
entity_id: input_boolean.closet_light_control
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.closet_light_control
- id: closet_light_control_turn_off
alias: 'Closet Light Control: Turn off'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Не выключай свет в кладовке
action:
- service: input_boolean.turn_off
entity_id: input_boolean.closet_light_control
- id: automations_turn_off
alias: 'Automations: Turn off'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Выключи всю автоматику
action:
- service: automation.turn_off
entity_id: all
data:
stop_actions: false
- service: automation.turn_on
entity_id: automation.automations_turn_on
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: 'Готово! Теперь дом снова глупый. Что бы включить все назад, скажи: Алиса,
включи всю автоматику'
- id: automations_turn_on
alias: 'Automations: Turn on'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Включи всю автоматику
action:
- choose:
- conditions:
- condition: state
entity_id: automation.automations_turn_on
state: 'on'
sequence:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Нет необходимости, всё уже работает
default:
- service: automation.turn_on
entity_id: all
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Включила, не делай больше так, мне страшно и обидно
- id: home_mode_night_auto_turn_on
alias: 'Home Mode Night: Auto turn on'
trigger:
- platform: time
at: 01:55
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: binary_sensor.motion_anywhere
state: 'off'
for:
hours: 1
- condition: not
conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
action:
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Night
- id: home_mode_manual_day
alias: 'Home Mode: Manual day'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Сейчас день
action:
- if:
- condition: state
entity_id: input_select.home_mode
state: Day
then:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Действительно, сейчас день
else:
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Day
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Переключила дом в дневной режим
- id: scene_delivery_turn_on
alias: 'Scene Delivery: Turn on'
triggers:
- trigger: event
event_type: yandex_intent
event_data:
text: Заказана еда
- id: event
trigger: event
event_type: living_room_heater_button_hold_down
actions:
- if:
- condition: state
entity_id: input_boolean.scene_delivery
state: 'on'
then:
- service: script.yandex_station_tts
data:
target: '{{ ''media_player.living_room_station'' if trigger.id == ''event''
else trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{% set elapsed_seconds = as_timestamp(now()) - state_attr('input_datetime.scene_delivery_started',\
\ 'timestamp') %} {{ 'Еда заказана' if trigger.id == 'event' else ['Ага,',\
\ 'Я знаю,', 'Наверняка,']|random }} уже как {{ (elapsed_seconds / 60)|int\
\ }}мин назад {% if elapsed_seconds > 40 * 60 * 60 %}\n и я немного волнуюсь\n\
{% endif %}\n"
- condition: state
entity_id: input_boolean.scene_delivery
state: 'off'
- service: input_boolean.turn_on
entity_id: input_boolean.scene_delivery
- service: input_datetime.set_datetime
entity_id: input_datetime.scene_delivery_started
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}
'
- if:
- condition: trigger
id: event
then:
- action: script.turn_on
entity_id: script.living_room_tv_status_light_ack_flash
- service: script.yandex_station_tts
data:
target: '{{ ''media_player.living_room_station'' if trigger.id == ''event''
else trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ [\n 'Еда заказана. Очень хочется кушать',\n 'Еда заказана.\
\ Скорей бы привезли кушать',\n 'Еда заказана. Ждём с нетерпением',\n\
\ 'Ждем курьера, но почему бы не приготовить самому?',\n 'Ждем курьера,\
\ но почему бы не приготовить самому?',\n 'Еда заказана. Не забудь всё\
\ подготовить.',\n ]|random\n}}\n"
else:
- service: script.yandex_station_tts
data:
target: '{{ ''media_player.living_room_station'' if trigger.id == ''event''
else trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ [\n 'Хорошо, ждём. Очень хочется кушать',\n 'Хорошо, скорей\
\ бы привезли кушать',\n 'Отлично, ждём с нетерпением',\n 'Ждем курьера,\
\ но почему бы не приготовить самому?',\n 'Ждем курьера, но почему бы\
\ не приготовить самому?',\n 'Хорошая новость. Не забудь всё подготовить.',\n\
\ ]|random\n}}\n"
- id: scene_delivery_30min_passed
alias: 'Scene Delivery: 30min passed'
trigger:
- platform: state
entity_id: input_boolean.scene_delivery
to: 'on'
for:
minutes: 30
condition:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
action:
- service: script.yandex_station_tts
data:
target: all
type: attention
text: "{{ [\n 'Уже прошло полчаса, курьер может уже выехал?',\n 'Тридцать\
\ минут прошло, голод только стал сильнее',\n 'Полчаса минуло, надеюсь\
\ курьер в пути'\n ]|random\n}}\n"
- id: scene_delivery_60min_passed
alias: 'Scene Delivery: 60min passed'
trigger:
- platform: state
entity_id: input_boolean.scene_delivery
to: 'on'
for:
minutes: 60
condition:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
action:
- service: script.yandex_station_tts
data:
target: all
type: attention
text: Тем временем еды уже нет целый час. Это вообще никуда не годится! Я буду
жаловаться!
- id: scene_delivery_turn_off
alias: 'Scene Delivery: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.front_door
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: input_boolean.scene_delivery
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_delivery
- delay:
seconds: 8
- service: script.yandex_station_tts
data:
target: all
type: attention
text: '{% set elapsed_seconds = as_timestamp(now()) - state_attr(''input_datetime.scene_delivery_started'',
''timestamp'') %} А вот и еда! {{ [''Еду привезли за'', ''Еда доставлена
за'', ''Мы смогли продержаться эти'']|random }} {{ (elapsed_seconds / 60)|int
}}мин
'
- id: scene_delivery_turn_off_fallback
alias: 'Scene Delivery: Turn off (fallback)'
trigger:
- platform: state
entity_id: input_boolean.scene_delivery
to: 'on'
for:
hours: 6
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_delivery
- id: scene_departure_sequence
alias: 'Scene Departure: Sequence'
mode: restart
trigger:
- platform: state
entity_id: lock.front_door
from: unlocked
to: locked
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.porch_door
from: 'on'
to: 'off'
for:
seconds: 2
timeout:
minutes: 1
continue_on_timeout: false
- if:
- condition: state
entity_id: binary_sensor.porch_door
state: 'off'
- condition: state
entity_id: lock.porch_door
state: unlocked
then:
- service: lock.lock
entity_id: lock.porch_door
- service: light.turn_off
entity_id:
- light.porch_path_light
- light.porch_lock_light
- id: device_unavailable_alert
alias: Device unavailable alert
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: state_changed
- platform: homeassistant
event: shutdown
id: shutdown
condition:
- or:
- condition: trigger
id: shutdown
- and:
- condition: template
value_template: '{{ trigger.event.data.new_state and trigger.event.data.new_state.state
== ''unavailable'' }}
'
- condition: template
value_template: "{{ (now() - state_attr('automation.device_unavailable_alert',\n\
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 1800 }}\n"
action:
- if:
- condition: trigger
id: shutdown
then:
- stop: Home Assistant is stopping
- delay:
minutes: 10
- condition: template
value_template: "{% set ns = namespace(break = false) %} {%- for entity in states\
\ if entity.state == 'unavailable' and entity.entity_id and ns.break == false\
\ -%}\n {%- if (now() - entity.last_changed).total_seconds() > 180 and\n \
\ not is_state_attr(entity.entity_id, 'volatile', true) and\n \
\ not is_state_attr(entity.entity_id, 'restored', true) and\n not\
\ 'xmas_' in entity.entity_id -%}\n {%- set ns.break = true -%}\n true\n\
\ {%- endif -%}\n{%- endfor %}\n"
- service: notify.dextor
data:
message: "⚠️ Некоторые устройства недоступны:{{ '\\n' }} {%- for entity\
\ in states if entity.state == 'unavailable' and\n \
\ not is_state_attr(entity.entity_id, 'volatile', true) and\n \
\ not is_state_attr(entity.entity_id, 'restored', true)\
\ -%}\n* {{ entity.name }}: {{ entity.last_changed|relative_time }}{{ '\\\
n' }} {%- endfor -%}\n"
- id: device_low_battery_alert
alias: Device low battery alert
trigger:
- platform: time
at: '18:00'
condition:
- condition: template
value_template: "{%- set ns = namespace(break = false) -%} {%- for entity in states\
\ if entity.entity_id.endswith('_battery') and ns.break == false -%} {%- if\
\ entity.state not in ['None', 'unavailable', 'unknown'] and entity.state|int\
\ <= 25 -%}\n {%- set ns.break = true -%}\n true\n{%- endif -%} {%- endfor\
\ -%}\n"
action:
- service: notify.dextor
data:
message: '⚠️ Батарея подходит к концу:{{ ''\n'' }} {%- for entity in
states if entity.entity_id.endswith(''_battery'') %} {%- if entity.state not
in [''None'', ''unavailable'', ''unknown''] and entity.state|int <= 25 -%}
* {{ entity.name }}: {{ entity.state }} %{{ ''\n'' }} {%- endif -%} {%- endfor
-%}
'
- id: device_unavailable_log
alias: Device unavailable log
mode: parallel
max_exceeded: silent
trigger:
- platform: event
event_type: state_changed
condition:
- condition: template
value_template: '{{ trigger.event.data.new_state and trigger.event.data.new_state.state
== ''unavailable'' }}
'
action:
- service: notify.send_message
data:
entity_id: notify.debug
message: 'Device unavailable: {{ trigger.event.data.new_state.entity_id }}'
- id: frozen_sensor_alert
alias: Frozen sensor alert
triggers:
- trigger: time
at: '12:00'
- trigger: time
at: '21:00'
conditions:
- condition: template
value_template: "{%- set ns = namespace(break = false) -%} {%- for entity in states\
\ if entity.attributes.get('device_class') in ('temperature', 'humidity', 'carbon_dioxide')\
\ and ns.break == false -%} {%- if (now() - entity.last_updated).total_seconds()\
\ > 6 * 60 * 60 and\n not set(entity.entity_id.split('_')).intersection(['target'])\
\ and\n not is_state_attr(entity.entity_id, 'sporadic', true) -%}\n \
\ {%- set ns.break = true -%}\n true\n{%- endif -%} {%- endfor -%}\n"
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Night
actions:
- action: notify.dextor
data:
message: "\U0001F4C9 Давно не обновлялись датчики:{{ '\\n' }} {%- for\
\ entity in states if entity.attributes.get('device_class') in ('temperature',\
\ 'humidity', 'carbon_dioxide') -%} {%- if (now() - entity.last_updated).total_seconds()\
\ > 6 * 60 * 60 and\n not set(entity.entity_id.split('_')).intersection(['target'])\
\ and\n not is_state_attr(entity.entity_id, 'sporadic', true) -%}\n\
* {{ entity.name }}: {{ entity.last_updated.strftime('%d.%m.%Y %H:%M') }}\
\ {{ '\\n' }} {%- endif -%} {%- endfor -%}\n"
- id: dishwasher_cycle
alias: 'Dishwasher: Cycle'
mode: restart
trigger:
platform: state
entity_id: sensor.dishwasher_progress
from: Idle
to:
- Pre-wash
- Wash
action:
- service: input_select.select_option
entity_id: input_select.dishwasher_status
data:
option: Running
- wait_for_trigger:
- platform: state
entity_id: sensor.dishwasher_progress
to:
- Complete
- Idle
timeout:
hours: 4
continue_on_timeout: true
- if:
- condition: state
entity_id: binary_sensor.dishwasher_door
state: 'off'
then:
- service: input_select.select_option
entity_id: input_select.dishwasher_status
data:
option: Done
else:
- service: input_select.select_option
entity_id: input_select.dishwasher_status
data:
option: Idle
- id: dishwasher_free
alias: 'Dishwasher: Free'
trigger:
platform: state
entity_id: binary_sensor.dishwasher_door
to: 'on'
for:
seconds: 10
condition:
- condition: state
entity_id: input_select.dishwasher_status
state: Done
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.dishwasher_door
to: 'off'
timeout:
minutes: 10
continue_on_timeout: true
- service: input_select.select_option
entity_id: input_select.dishwasher_status
data:
option: Idle
- id: dishwasher_dirty
alias: 'Dishwasher: Dirty'
trigger:
platform: state
entity_id: binary_sensor.dishwasher_door
to: 'on'
for:
seconds: 30
condition:
- condition: state
entity_id: input_select.dishwasher_status
state: Idle
action:
- service: input_select.select_option
entity_id: input_select.dishwasher_status
data:
option: Dirty
- id: dishwasher_status
alias: 'Dishwasher: Status'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Что с посудомойкой
action:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "Посудомойка {% if is_state('input_select.dishwasher_status', 'Dirty')\
\ %}\n с грязной посудой, в ожидании запуска.\n{% elif is_state('input_select.dishwasher_status',\
\ 'Running') %}\n {% if is_state('sensor.dishwasher_progress', 'Pre-wash')\
\ %}\n в процессе предварительной мойки\n {% elif is_state('sensor.dishwasher_progress',\
\ 'Wash') %}\n в процессе основной мойки\n {% elif is_state('sensor.dishwasher_progress',\
\ 'Rinse') %}\n вспаласкивает тарелочки\n {% elif is_state('sensor.dishwasher_progress',\
\ 'Dry') %}\n сушит кружечки\n {% else %}\n делает бурлык-бурлык, посуда\
\ скоро будет чистой\n {% endif %}\n{% elif is_state('input_select.dishwasher_status',\
\ 'Done') %}\n закончила, можно доставать посуду\n{% elif is_state('input_select.dishwasher_status',\
\ 'Idle') %}\n простаивает без дела\n{% else %}\n в каком-то непонятном\
\ состоянии, что я даже хз\n{% endif %}\n{% if states('sensor.dishwasher_time_remaining')\
\ | float(0) > 0 %}\n . Осталось {{ states('sensor.dishwasher_time_remaining')\
\ }} мин.\n{% endif %}\n"
- id: dishwasher_status_light_update
alias: 'Dishwasher: Status light update'
mode: queued
trigger:
- platform: state
entity_id:
- input_select.dishwasher_status
- input_select.home_mode
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_select.dishwasher_status
state: Running
sequence:
- service: light.turn_on
entity_id: light.dishwasher_status
data:
brightness_pct: 100
rgbw_color:
- 255
- 0
- 0
- 0
- conditions:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_select.dishwasher_status
state: Done
sequence:
- service: light.turn_on
entity_id: light.dishwasher_status
data:
brightness_pct: 30
rgbw_color:
- 0
- 255
- 0
- 0
- conditions:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_select.dishwasher_status
state: Dirty
sequence:
- service: light.turn_on
entity_id: light.dishwasher_status
data:
brightness_pct: 40
rgbw_color:
- 255
- 0
- 215
- 0
default:
- service: light.turn_off
entity_id: light.dishwasher_status
- id: dryer_cycle
alias: 'Dryer: Cycle'
max_exceeded: silent
trigger:
- platform: numeric_state
entity_id: sensor.dryer_power
above: 0
for:
seconds: 10
- platform: numeric_state
entity_id: sensor.dryer_power
above: 200
for:
seconds: 10
condition:
- condition: state
entity_id: input_select.dryer_status
state: Idle
action:
- service: input_select.select_option
entity_id: input_select.dryer_status
data:
option: Running
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.dryer_power
below: 1
for:
minutes: 2
- platform: state
entity_id: binary_sensor.dryer_door
from: 'off'
to: 'on'
timeout:
hours: 6
continue_on_timeout: true
- condition: state
entity_id: input_select.dryer_status
state: Running
- if:
- condition: state
entity_id: binary_sensor.dryer_door
state: 'on'
then:
- service: input_select.select_option
entity_id: input_select.dryer_status
data:
option: Idle
else:
- service: input_select.select_option
entity_id: input_select.dryer_status
data:
option: Done
- id: dryer_door_open
alias: 'Dryer: Door open'
trigger:
platform: state
entity_id: binary_sensor.dryer_door
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_select.dryer_status
state: Done
action:
- service: input_select.select_option
entity_id: input_select.dryer_status
data:
option: Idle
- id: dryer_idle
alias: 'Dryer: Idle'
trigger:
platform: state
entity_id: input_select.dryer_status
to: Idle
action:
- service: input_number.set_value
entity_id: input_number.dryer_done_alert_count
data:
value: 0
- id: dryer_done_alert
alias: 'Dryer: Done alert'
trigger:
- platform: time_pattern
minutes: /45
- platform: state
entity_id: input_select.dryer_status
from: Running
to: Done
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_select.dryer_status
state: Done
- condition: numeric_state
entity_id: input_number.dryer_done_alert_count
below: 4
- condition: template
value_template: '{{ (now() - states.input_number.dryer_done_alert_count.last_changed).total_seconds()
> 1200 }}
'
action:
- wait_template: '{{ not is_state(''media_player.atv'', [''playing'', ''pause''])
}}
'
timeout:
minutes: 33
continue_on_timeout: true
- service: script.yandex_station_tts
data:
target: all
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Сушилка ждёт тебя,\
\ пора раскладывать бельё по полочкам.',\n 'Сушилка ждет тебя, в ней тебя\
\ ждёт что-то особенное.',\n 'Сушилка закончила, пора достать из неё мягонькое\
\ бельё.',\n ]|random\n}} {% if states('input_number.dryer_done_alert_count')|int\
\ == 2 %}\n Если я ошиблась - закрой дверцу машины и открой снова.\n{% endif\
\ %} {% if states('input_number.dryer_done_alert_count')|int == 3 %}\n Это\
\ последнее предупреждение! Мятое белье останется там навсегда!\n{% endif\
\ %}\n"
- service: input_number.increment
entity_id: input_number.dryer_done_alert_count
- id: dryer_status
alias: 'Dryer: Status'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Что с сушильной машиной
action:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "Сушилка {% if is_state('input_select.dryer_status', 'Running') %}\n \
\ делает пух-пух. Скоро вещи будут сухими и мягонькими\n{% elif is_state('input_select.dryer_status',\
\ 'Done') %}\n закончила, доставай быстрее белье и развешивай в гардеробную\n\
{% elif is_state('input_select.dryer_status', 'Idle') %}\n простаивает без\
\ дела и скучает по мокрому бельёю\n{% endif %}\n"
- id: living_room_evening
alias: 'Living Room: Evening'
trigger:
- id: lock_unlocked
platform: state
entity_id: lock.front_door
from: locked
to: unlocked
- platform: state
entity_id: binary_sensor.evening_time
from: 'off'
to: 'on'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.living_room_balcony_door
from: 'on'
to: 'off'
for:
seconds: 20
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id: binary_sensor.evening_time
state: 'on'
- condition: or
conditions:
- condition: trigger
id: lock_unlocked
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: binary_sensor.living_room_balcony_door
state: 'off'
- condition: state
entity_id: cover.living_room
state: open
- condition: template
value_template: "{{ (now() - state_attr('automation.living_room_evening',\n \
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 8 * 60 * 60 }}\n"
action:
- if:
- condition: state
entity_id: binary_sensor.living_room_occupancy
state: 'on'
- condition: state
entity_id: light.living_room_main
state: 'off'
then:
- if:
- condition: state
entity_id: light.living_room_tv
state: 'off'
then:
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 45
transition: 2
- if:
- condition: state
entity_id: light.living_room_backlight
state: 'off'
then:
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 23
color_temp_kelvin: 3400
transition: 2
- delay:
seconds: 2
- service: cover.close_cover
entity_id: cover.living_room
- id: bedroom_evening
alias: 'Bedroom: Evening'
trigger:
- id: lock_unlocked
platform: state
entity_id: lock.front_door
from: locked
to: unlocked
- platform: state
entity_id: binary_sensor.evening_time
from: 'off'
to: 'on'
for:
minutes: 5
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id: binary_sensor.evening_time
state: 'on'
- condition: or
conditions:
- condition: trigger
id: lock_unlocked
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: binary_sensor.bedroom_window
state: 'off'
- condition: state
entity_id: cover.bedroom
attribute: current_position
state: 100
- condition: template
value_template: "{{ (now() - state_attr('automation.bedroom_evening',\n \
\ 'last_triggered')|default(now() - timedelta(days=1), true)).total_seconds()\
\ > 8 * 60 * 60 }}\n"
action:
- service: cover.close_cover
entity_id: cover.bedroom
- if:
- condition: state
entity_id: binary_sensor.bedroom_occupancy
state: 'on'
then:
- service: light.turn_on
entity_id: light.bedroom_cat
data:
color_temp_kelvin: 2700
brightness_pct: 100
- id: fridge_door_alert
alias: 'Fridge: Door alert'
trigger:
- platform: state
entity_id: binary_sensor.fridge_door
id: 2m
to: 'on'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.fridge_door
to: 'on'
for:
minutes: 4
- platform: state
entity_id: binary_sensor.fridge_door
to: 'on'
for:
minutes: 10
- platform: state
entity_id: binary_sensor.fridge_door
to: 'on'
for:
minutes: 15
action:
- if:
- condition: trigger
id: 2m
then:
- service: notify.dextor
data:
message: 🧊 Закрой холодильник!
else:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: Проверь холодильник, кажется он открыт
- id: fridge_temperature_alert
alias: 'Fridge: Temperature alert'
trigger:
- platform: numeric_state
entity_id: sensor.fridge_temperature
above: 16
for:
minutes: 4
- platform: numeric_state
entity_id: sensor.fridge_temperature
above: 16
for:
minutes: 25
action:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: В холодильнике очень жарко, проверь что там как
- id: freezer_door_alert
alias: 'Freezer: Door alert'
trigger:
- platform: state
entity_id: binary_sensor.freezer_door
id: 2m
to: 'on'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.freezer_door
to: 'on'
for:
minutes: 4
- platform: state
entity_id: binary_sensor.freezer_door
to: 'on'
for:
minutes: 10
- platform: state
entity_id: binary_sensor.freezer_door
to: 'on'
for:
minutes: 15
action:
- if:
- condition: trigger
id: 2m
then:
- service: notify.dextor
data:
message: 🧊 Закрой морозильник!
else:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: Проверь морозильник, кажется он открыт
- id: freezer_temperature_alert
alias: 'Freezer: Temperature alert'
trigger:
- platform: numeric_state
entity_id: sensor.freezer_temperature
above: 16
for:
minutes: 4
- platform: numeric_state
entity_id: sensor.freezer_temperature
above: 16
for:
minutes: 25
action:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: В морозильнике очень жарко, проверь что там как
- id: everybody_left_home
alias: Everybody Left Home
trigger:
- platform: state
entity_id: binary_sensor.anyone_home
from: 'on'
to: 'off'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.anyone_home_last_seen
data:
datetime: '{{ now().strftime("%Y-%m-%d %H:%M:%S") }}'
- id: anyone_home_last_seen_update
alias: 'Anyone Home Last Seen: Update'
trigger:
- platform: time_pattern
minutes: /4
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: template
value_template: '{{ (now() - states.binary_sensor.anyone_home.last_changed).total_seconds()
> 5 * 60 }}
'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.anyone_home_last_seen
data:
datetime: '{{ now().strftime("%Y-%m-%d %H:%M:%S") }}'
- id: anyone_near_home_detected
alias: Anyone Near Home Detected
triggers:
- trigger: state
entity_id: binary_sensor.anyone_near_home
from: 'off'
to: 'on'
actions:
- action: timer.start
entity_id: timer.anyone_near_home_recently
- id: kitchen_balcony_tracker_led_update
alias: 'Kitchen Balcony Tracker: LED Update'
mode: queued
triggers:
- trigger: state
entity_id: binary_sensor.anyone_near_home
to:
- 'on'
- 'off'
actions:
- action: switch.turn_{{ trigger.to_state.state }}
entity_id: switch.kitchen_balcony_tracker_led
- id: good_morning
alias: Good Morning
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Доброе утро
action:
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Day
- service: cover.open_cover
entity_id:
- cover.living_room
- cover.kitchen
- cover.bedroom
- cover.workshop
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get("entity_id", "last") }}'
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'доброе утро! Сегодня\
\ будет отличный день.',\n 'доброго утра! Продуктивно провести этот день.',\n\
\ 'с добрым утром! Прекрасный день ждёт впереди.',\n 'хорошего утра\
\ и удачного дня.',\n 'доброго утречка! Посмотри как прекрасно за окном!',\n\
\ 'утра доброго, хорошо спалось?',\n ]|random\n}}\n"
- if:
- condition: state
entity_id: climate.kettle
state: 'off'
- condition: numeric_state
entity_id: climate.kettle
attribute: current_temperature
below: 75
then:
- if:
- condition: numeric_state
entity_id: sensor.kettle_water_level_ml
above: 299
then:
- service: climate.set_hvac_mode
entity_id: climate.kettle
data:
hvac_mode: auto
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ [\n 'Чай скоро будет готов',\n 'Я включила чайник для\
\ %s' % states('sensor.person_pronoun_gen'),\n '%s пить чай, кипяток\
\ на подходе' % ('Умывайся и готовься' if states('sensor.person_pronoun_nom')\
\ == 'ты' else 'Умывайтесь и готовьтесь'),\n 'Какое утро без чая?\
\ Я позабочусь о нём',\n ]|random\n}}\n"
else:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ [\n 'Чая сегодня не будет, кто-то не долил воды с вечера,\
\ плак-плак',\n 'Не могу включить чайник, похоже там мало воды. Грусть\
\ печаль',\n 'Хватит валяться и иди включай чайник, без воды он сам\
\ себя не включит'\n ]|random\n}}\n"
- if:
- condition: state
entity_id: climate.kettle
state: unavailable
then:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ [\n 'Чая сегодня не будет, он недоступен, плак-плак',\n \
\ 'Не могу включить чайник, он отпал. Грусть печаль',\n 'Хватит валяться\
\ и иди включай чайник, а то у меня лапки'\n ]|random\n}}\n"
- if:
- condition: template
value_template: "{% if state_attr('input_datetime.scene_delivery_scheduled_from',\
\ 'has_date') %}\n {% if states('input_datetime.scene_delivery_scheduled_from').split('\
\ ')|first == now().date()|string %}\n true\n {% endif %}\n{% endif %}\n"
then:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: 'На сегодня запланирована доставка с {{ state_attr(''input_datetime.scene_delivery_scheduled_from'',
''hour'') }}:{{ ''%02d'' % state_attr(''input_datetime.scene_delivery_scheduled_from'',
''minute'') }} до {{ state_attr(''input_datetime.scene_delivery_scheduled_to'',
''hour'') }}:{{ ''%02d'' % state_attr(''input_datetime.scene_delivery_scheduled_to'',
''minute'') }}
'
- if:
- condition: template
value_template: '{{ 0 <= (states(''input_datetime.next_trip'') | as_datetime
| as_local - now()).days < 30 }}
'
then:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: До поездки осталось {{ (states('input_datetime.next_trip') | as_datetime
| as_local - now()).days }} дн.
- service: script.yandex_station_command
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
command: Какой сегодня день и время
- service: script.yandex_station_command
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
command: Погода на сегодня
- if:
- condition: template
value_template: '{{ now().month == 12 and now().day >= 15 }}
'
then:
- service: script.yandex_station_command
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
command: Сколько осталось до нового года
- id: good_morning_fallback
alias: Good Morning (fallback)
trigger:
- platform: state
entity_id: light.bedroom_main
to: 'on'
for:
minutes: 2
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: time
after: 07:00
before: '21:00'
- condition: not
conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
action:
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Day
- service: cover.open_cover
entity_id:
- cover.living_room
- cover.kitchen
- cover.bedroom
- id: good_night
alias: Good Night
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Спокойной ночи
action:
- service: script.turn_on
entity_id: script.yandex_station_tts
data:
variables:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: '{{ [''Спокойной ночи!'', ''Сладких снов!'', ''Приятных снов!'', ''Доброй
ночи!'']|random }}
'
- service: cover.close_cover
entity_id:
- cover.living_room
- cover.kitchen
- cover.bedroom
- service: light.turn_off
entity_id:
- group.bathroom_lights
- group.kitchen_lights
- group.living_room_lights
- group.path_lights
- light.entrance
- light.hallway
- light.wardrobe
- light.closet
- light.workshop_main
- light.bedroom_main
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Night
- service: light.turn_off
entity_id: light.bedroom_bed
data:
transition: 7
- service: light.turn_off
entity_id:
- light.bedroom_cat
- light.bedroom_moon
- light.bedroom_string
- service: media_player.turn_off
entity_id: media_player.tv
- service: switch.turn_off
entity_id: switch.bedroom_airing
- id: hallway_light_turn_off_welcome_home
alias: 'Hallway Light: Turn off (welcome home)'
trigger:
- platform: state
entity_id: binary_sensor.entrance_motion
to: 'off'
for:
minutes: 2
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id:
- light.hallway
- light.entrance
match: any
state: 'on'
- condition: state
entity_id: timer.scene_welcome_home
state: active
action:
- service: light.turn_off
entity_id:
- light.hallway
- light.entrance
- id: entrance_light_turn_off
alias: 'Entrance Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.entrance_motion
to: 'off'
for:
minutes: 15
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: light.entrance
state: 'on'
action:
- service: light.turn_off
entity_id: light.entrance
- id: bedroom_bed_button_single_press
alias: 'Bedroom Bed Button: Single press'
trigger:
- trigger: device
domain: mqtt
device_id: 620c20157f0cbf8a0249f3f083a531ff
type: action
subtype: single
condition:
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
action:
- choose:
- conditions:
- condition: state
entity_id:
- light.bedroom_bed
- light.hallway_path
match: any
state: 'on'
sequence:
- service: light.turn_off
entity_id:
- group.living_room_lights
- group.workshop_lights
- light.bedroom_bed
- light.bedroom_moon
- light.hallway_path
- light.wardrobe
- conditions:
- condition: state
entity_id: input_boolean.bedroom_airing_cold
state: 'on'
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.bedroom_airing_cold
- service: script.yandex_station_tts
data:
target: media_player.bedroom_station
text: '
'
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: light.turn_off
entity_id:
- group.living_room_lights
- group.workshop_lights
- light.bedroom_bed
- light.hallway_path
- light.wardrobe
- id: bedroom_bed_button_double_press
alias: 'Bedroom Bed Button: Double press'
trigger:
- trigger: device
domain: mqtt
device_id: 620c20157f0cbf8a0249f3f083a531ff
type: action
subtype: double
action:
- service: input_boolean.turn_on
entity_id: input_boolean.bedroom_airing_cold
- service: script.yandex_station_tts
data:
target: media_player.bedroom_station
text: '
'
- id: bedroom_bed_button_hold
alias: 'Bedroom Bed Button: Hold'
trigger:
- trigger: device
domain: mqtt
device_id: 620c20157f0cbf8a0249f3f083a531ff
type: action
subtype: hold
action:
- service: script.yandex_station_tts
data:
target: media_player.kitchen_station
text: '
'
- id: bedroom_light_switch_single_right
alias: 'Bedroom Light Switch: Single right'
trigger:
- trigger: device
domain: mqtt
device_id: c109a5cffc3ce01835ed7f55ce3b8cbc
type: action
subtype: single_right
action:
- if:
- condition: state
entity_id: input_select.home_mode
state: Night
then:
- service: light.turn_on
entity_id: light.bedroom_bed
data:
color_name: red
brightness_pct: 100
- service: light.turn_on
entity_id: light.bedroom_moon
data:
rgb_color:
- 255
- 10
- 10
brightness_pct: 100
else:
- if:
- condition: state
entity_id: light.bedroom_bed
state: 'on'
then:
- service: light.turn_off
entity_id: light.bedroom_bed
else:
- service: light.turn_on
entity_id: light.bedroom_bed
data:
rgb_color:
- 10
- 214
- 255
brightness_pct: 100
- id: bedroom_light_switch_double_right
alias: 'Bedroom Light Switch: Double right'
trigger:
- trigger: device
domain: mqtt
device_id: c109a5cffc3ce01835ed7f55ce3b8cbc
type: action
subtype: double_right
action:
- if:
- condition: state
entity_id: light.bedroom_moon
state: 'on'
then:
- service: light.turn_off
entity_id: light.bedroom_moon
else:
- service: light.turn_on
entity_id: light.bedroom_moon
data:
rgb_color:
- 10
- 214
- 255
brightness_pct: 100
- id: workshop_desk_button_turn_on
alias: 'Workshop Desk Button: Turn on'
mode: restart
trigger:
- trigger: device
domain: mqtt
device_id: b9daf61de1fcfea52aa888e18dcd46ee
type: action
subtype: 'on'
action:
- service: input_boolean.toggle
entity_id: input_boolean.workshop_airing_warm
- service: script.turn_on
entity_id: script.yandex_station_tts
data:
variables:
target: media_player.workshop_station
text: '
'
- id: workshop_desk_button_turn_off
alias: 'Workshop Desk Button: Turn off'
mode: restart
trigger:
- trigger: device
domain: mqtt
device_id: b9daf61de1fcfea52aa888e18dcd46ee
type: action
subtype: 'off'
action:
- service: input_boolean.toggle
entity_id: input_boolean.workshop_airing_cold
- service: script.turn_on
entity_id: script.yandex_station_tts
data:
variables:
target: media_player.workshop_station
text: '
'
- id: workshop_shades_close
alias: 'Workshop Shades: Close'
trigger:
- id: lock_unlocked
platform: state
entity_id: lock.front_door
from: locked
to: unlocked
- platform: state
entity_id: binary_sensor.evening_time
from: 'off'
to: 'on'
for:
minutes: 5
condition:
- condition: state
entity_id: binary_sensor.evening_time
state: 'on'
- condition: or
conditions:
- condition: trigger
id: lock_unlocked
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: binary_sensor.workshop_window
state: 'off'
- condition: state
entity_id: cover.workshop
attribute: current_position
state: 100
- condition: template
value_template: "{{ (now() - state_attr('automation.workshop_shades_close',\n\
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 8 * 60 * 60 }}\n"
action:
- service: cover.set_cover_position
entity_id: cover.workshop
data:
position: 20
- id: doorbell_ringing
alias: 'Doorbell: Ringing'
trigger:
- platform: state
entity_id: binary_sensor.doorbell_ringing
to: 'on'
action:
- service: notify.dextor
data:
message: 🔔 Динг-донг, кто-то звонит в дверь
- id: doorbell_mode_update
alias: 'Doorbell: Mode update'
trigger:
- platform: time_pattern
minutes: /10
- platform: state
entity_id: input_select.home_mode
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: select.select_option
entity_id: select.doorbell_mode
data:
option: Night
default:
- service: select.select_option
entity_id: select.doorbell_mode
data:
option: Day
- id: doorbell_stop_playing
alias: 'Doorbell: Stop playing'
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.doorbell_ringing
state: 'on'
action:
- service: esphome.doorbell_stop
- id: bedroom_humidifier_update
alias: 'Bedroom Humidifier: Update'
mode: queued
max: 4
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /7
- platform: state
entity_id:
- input_number.home_target_humidity
- input_select.home_mode
- input_boolean.scene_waking_up
- platform: state
entity_id: sensor.ups_status
from: On Battery
to: Online
for:
seconds: 30
condition:
- condition: template
value_template: '{{ states(''humidifier.bedroom_humidifier'') not in [''unavailable'',
''unknown''] }}
'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.bedroom_humidifier_control
state: 'on'
action:
- if:
- condition: state
entity_id: sensor.bedroom_humidifier_target_mode
state: 'off'
then:
- if:
- condition: state
entity_id: humidifier.bedroom_humidifier
state: 'on'
then:
- service: humidifier.turn_off
entity_id: humidifier.bedroom_humidifier
else:
- if:
- condition: state
entity_id: humidifier.bedroom_humidifier
state: 'off'
then:
- service: humidifier.turn_on
entity_id: humidifier.bedroom_humidifier
- wait_template: '{{ is_state(''humidifier.bedroom_humidifier'', ''on'') }}
'
timeout:
seconds: 15
continue_on_timeout: false
- if:
- condition: template
value_template: '{{ state_attr(''humidifier.bedroom_humidifier'', ''mode'')
!= states("sensor.bedroom_humidifier_target_mode") }}
'
then:
- service: humidifier.set_mode
entity_id: humidifier.bedroom_humidifier
data:
mode: '{{ states("sensor.bedroom_humidifier_target_mode") }}'
- if:
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: switch.bedroom_humidifier_screen
state: 'on'
then:
- delay:
seconds: 3
- service: switch.turn_off
entity_id: switch.bedroom_humidifier_screen
- if:
- or:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_boolean.scene_waking_up
state: 'on'
- condition: state
entity_id: switch.bedroom_humidifier_screen
state: 'off'
then:
- delay:
seconds: 3
- service: switch.turn_on
entity_id: switch.bedroom_humidifier_screen
- if:
- condition: state
entity_id: switch.bedroom_humidifier_filter_drying
state: 'on'
then:
- delay:
seconds: 3
- service: switch.turn_off
entity_id: switch.bedroom_humidifier_filter_drying
- if:
- condition: state
entity_id: switch.bedroom_humidifier_sound
state: 'on'
then:
- delay:
seconds: 3
- service: switch.turn_off
entity_id: switch.bedroom_humidifier_sound
- if:
- condition: template
value_template: '{{ not is_state("switch.bedroom_humidifier_heater", states("binary_sensor.bedroom_humidifier_target_heater"))
}}'
then:
- delay:
seconds: 3
- service: switch.turn_{{ states("binary_sensor.bedroom_humidifier_target_heater")
}}
entity_id: switch.bedroom_humidifier_heater
- if:
- condition: state
entity_id: number.bedroom_humidifier_screen_brightness
state: '1'
then:
- delay:
seconds: 3
- service: number.set_value
entity_id: number.bedroom_humidifier_screen_brightness
data:
value: '0'
- id: living_room_humidifier_update
alias: 'Living Room Humidifier: Update'
mode: queued
max: 4
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /7
- platform: state
entity_id:
- binary_sensor.anyone_home
- binary_sensor.living_room_occupancy
- input_boolean.scene_movie
- input_boolean.scene_sleepy_mood
- input_boolean.scene_waking_up
- input_number.home_target_humidity
- input_select.home_mode
- platform: state
entity_id: media_player.tv
to:
- 'on'
- 'off'
condition:
- condition: template
value_template: '{{ states(''humidifier.living_room_humidifier'') not in [''unavailable'',
''unknown''] }}
'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.living_room_humidifier_control
state: 'on'
action:
- delay:
seconds: 1
- if:
- condition: state
entity_id: sensor.living_room_humidifier_target_mode
state: 'off'
then:
- if:
- condition: state
entity_id: humidifier.living_room_humidifier
state: 'on'
then:
- service: humidifier.turn_off
entity_id: humidifier.living_room_humidifier
else:
- if:
- condition: state
entity_id: humidifier.living_room_humidifier
state: 'off'
then:
- service: humidifier.turn_on
entity_id: humidifier.living_room_humidifier
- wait_template: '{{ is_state(''humidifier.living_room_humidifier'', ''on'')
}}
'
timeout:
seconds: 15
continue_on_timeout: false
- if:
- condition: template
value_template: '{{ state_attr(''humidifier.living_room_humidifier'', ''mode'')
!= states("sensor.living_room_humidifier_target_mode") }}
'
then:
- service: humidifier.set_mode
entity_id: humidifier.living_room_humidifier
data:
mode: '{{ states("sensor.living_room_humidifier_target_mode") }}'
- delay:
seconds: 1
- if:
- condition: state
entity_id: humidifier.living_room_humidifier
attribute: mode
state: manual
- condition: template
value_template: '{{ states(''number.living_room_humidifier_fan_speed'')|string
!= states("sensor.living_room_humidifier_target_fan_speed")|string }}
'
then:
- service: number.set_value
entity_id: number.living_room_humidifier_fan_speed
data:
value: '{{ states("sensor.living_room_humidifier_target_fan_speed") }}'
- if:
- condition: state
entity_id: humidifier.living_room_humidifier
attribute: mode
state: auto
- condition: template
value_template: '{{ state_attr(''humidifier.living_room_humidifier'', ''humidity'')|string
!= states("sensor.living_room_humidifier_target_humidity") }}
'
then:
- service: humidifier.set_humidity
entity_id: humidifier.living_room_humidifier
data:
humidity: '{{ states("sensor.living_room_humidifier_target_humidity") }}'
- id: living_room_humidifier_water_leak
alias: 'Living Room Humidifier: Water Leak'
trigger:
- platform: state
entity_id:
- binary_sensor.living_room_humidifier_water_leak
- binary_sensor.living_room_humidifier_water_tank_leak
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.living_room_humidifier_water_leak
- binary_sensor.living_room_humidifier_water_tank_leak
from: 'off'
to: 'on'
for:
minutes: 5
action:
- if:
- condition: template
value_template: '{{ trigger.entity_id == ''binary_sensor.living_room_humidifier_water_leak''
}}
'
then:
- action: switch.turn_off
entity_id: switch.living_room_humidifier_socket
- service: notify.mobile_app_misaka
data:
message: '🚨 Обнаружена протечка {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
data:
push:
sound:
name: sms-received2.caf
critical: 1
volume: 1
continue_on_error: true
- service: script.yandex_station_tts
data:
target: all
type: alert
text: 'Обнаружена протечка {{ state_attr(trigger.from_state.entity_id, ''alert_text'')|default('''',
True) }}. Повторяю. Обнаружена протечка!
'
- service: notify.dextor
data:
message: '🚨 Обнаружена протечка {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
continue_on_error: true
- id: living_room_humidifier_water_tank_auto_refill_update
alias: 'Living Room Humidifier Water Tank: Auto Refill Update'
mode: queued
trigger:
- platform: time_pattern
minutes: /7
- platform: state
entity_id:
- input_select.home_mode
- binary_sensor.anyone_home
- input_boolean.scene_waking_up
- input_boolean.living_room_humidifier_control
conditions:
- condition: state
entity_id: switch.living_room_humidifier_water_tank_auto_refill
state:
- 'on'
- 'off'
actions:
- if:
- or:
- condition: state
entity_id: input_boolean.scene_waking_up
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Night
- condition: state
entity_id:
- binary_sensor.anyone_home
- input_boolean.living_room_humidifier_control
state: 'on'
then:
- if:
- condition: state
entity_id: switch.living_room_humidifier_water_tank_auto_refill
state: 'off'
then:
- action: switch.turn_on
entity_id: switch.living_room_humidifier_water_tank_auto_refill
- if:
- condition: state
entity_id: switch.living_room_humidifier_water_tank_maintenance
state: 'off'
then:
- action: button.press
entity_id: button.living_room_humidifier_water_tank_refill
else:
- action: switch.turn_off
entity_id: switch.living_room_humidifier_water_tank_auto_refill
- id: living_room_humidifier_water_tank_problem_alert
alias: 'Living Room Humidifier Water Tank: Problem alert'
trigger:
- platform: state
entity_id: binary_sensor.living_room_humidifier_water_tank_problem
to: 'on'
actions:
- delay:
seconds: 1
- service: notify.dextor
data:
message: '🌊 Что-то не так с доливом в увлажнитель: {{ states(''sensor.living_room_humidifier_water_tank_state'')
}}
'
- id: workshop_humidifier_update
alias: 'Workshop Humidifier: Update'
mode: queued
max: 4
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /7
- platform: state
entity_id:
- input_number.home_target_humidity
- input_select.home_mode
condition:
- condition: template
value_template: '{{ states(''humidifier.workshop_humidifier'') not in [''unavailable'',
''unknown''] }}
'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.workshop_humidifier_control
state: 'on'
action:
- if:
- condition: state
entity_id: sensor.workshop_humidifier_target_mode
state: 'off'
then:
- if:
- condition: state
entity_id: humidifier.workshop_humidifier
state: 'on'
then:
- service: humidifier.turn_off
entity_id: humidifier.workshop_humidifier
else:
- if:
- condition: state
entity_id: humidifier.workshop_humidifier
state: 'off'
then:
- service: humidifier.turn_on
entity_id: humidifier.workshop_humidifier
- wait_template: '{{ is_state(''humidifier.workshop_humidifier'', ''on'') }}
'
timeout:
seconds: 15
continue_on_timeout: false
- if:
- condition: template
value_template: '{{ state_attr(''humidifier.workshop_humidifier'', ''mode'')
!= states("sensor.workshop_humidifier_target_mode") }}
'
then:
- service: humidifier.set_mode
entity_id: humidifier.workshop_humidifier
data:
mode: '{{ states("sensor.workshop_humidifier_target_mode") }}'
- id: workshop_humidifier_x_update
alias: 'Workshop Humidifier X: Update'
mode: queued
max: 4
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /7
- platform: state
entity_id:
- input_number.home_target_humidity
- input_select.home_mode
condition:
- condition: template
value_template: '{{ states(''humidifier.workshop_humidifier_x'') not in [''unavailable'',
''unknown''] }}
'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.workshop_humidifier_control
state: 'on'
action:
- if:
- condition: state
entity_id: sensor.workshop_humidifier_target_mode
state: 'off'
then:
- if:
- condition: state
entity_id: humidifier.workshop_humidifier_x
state: 'on'
then:
- service: humidifier.turn_off
entity_id: humidifier.workshop_humidifier_x
else:
- if:
- condition: state
entity_id: humidifier.workshop_humidifier_x
state: 'off'
then:
- service: humidifier.turn_on
entity_id: humidifier.workshop_humidifier_x
- wait_template: '{{ is_state(''humidifier.workshop_humidifier_x'', ''on'')
}}
'
timeout:
seconds: 15
continue_on_timeout: false
- if:
- condition: template
value_template: '{{ state_attr(''humidifier.workshop_humidifier_x'', ''mode'')
!= states("sensor.workshop_humidifier_target_mode") }}
'
then:
- service: humidifier.set_mode
entity_id: humidifier.workshop_humidifier_x
data:
mode: '{{ states("sensor.workshop_humidifier_target_mode") }}'
- id: bedroom_intake_fan_update
alias: 'Bedroom Intake Fan: Update'
mode: single
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /5
- platform: state
entity_id:
- binary_sensor.bedroom_occupancy
- input_select.home_mode
- input_select.washing_machine_status
- input_boolean.bedroom_intake_fan_control
- id: room_airing
platform: state
entity_id:
- input_boolean.bedroom_airing_warm
- input_boolean.bedroom_airing_cold
to:
- 'on'
- 'off'
- id: recirculation
platform: state
entity_id: switch.bedroom_intake_fan_recirculation
to:
- 'on'
- 'off'
- platform: state
entity_id: sensor.ups_status
from: On Battery
to: Online
for:
seconds: 30
condition:
- condition: state
entity_id: climate.bedroom_intake_fan
state:
- heat
- fan_only
- 'off'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.bedroom_intake_fan_control
state: 'on'
action:
- if:
- condition: trigger
id: recirculation
then:
- delay:
seconds: 20
else:
- delay:
seconds: 1
- action: script.intake_fan_update
data:
area: bedroom
- id: bedroom_airing_swap_modes
alias: 'Bedroom Airing: Swap modes'
trigger:
- platform: state
entity_id:
- input_boolean.bedroom_airing_warm
- input_boolean.bedroom_airing_cold
to: 'on'
action:
- service: input_boolean.turn_off
data_template:
entity_id: "{%- if trigger.from_state.entity_id == 'input_boolean.bedroom_airing_warm'\
\ -%}\n input_boolean.bedroom_airing_cold\n{%- else -%}\n input_boolean.bedroom_airing_warm\n\
{%- endif -%}\n"
- id: bedroom_airing_auto_turn_off
alias: 'Bedroom Airing: Auto turn off'
trigger:
- platform: state
entity_id:
- input_boolean.bedroom_airing_warm
- input_boolean.bedroom_airing_cold
to: 'on'
for:
minutes: 40
action:
- service: input_boolean.turn_off
data_template:
entity_id: '{{ trigger.from_state.entity_id }}
'
- id: living_room_intake_fan_restore_circulation
alias: 'Living Room Intake Fan: Restore circulation'
trigger:
- platform: state
entity_id: switch.living_room_intake_fan_recirculation
to: 'on'
for:
minutes: 30
action:
- service: switch.turn_off
entity_id: switch.living_room_intake_fan_recirculation
- id: living_room_intake_fan_bad_air
alias: 'Living Room Intake Fan: Bad air'
mode: restart
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Воняет
- platform: state
entity_id: input_boolean.living_room_airing_bad_air
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.living_room_airing_bad_air
- service: switch.turn_on
entity_id: switch.living_room_intake_fan_recirculation
- service: script.turn_on
entity_id: script.yandex_station_tts
data:
variables:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') if ''event'' in
trigger else ''media_player.living_room_station'' }}
'
text: '{{ [''Бееее, закрываю приток'', ''Опять курево, отвратительно'', ''Закрываю
приток'', ''Выключаю приток'']|random }}
'
- delay:
minutes: 5
- service: switch.turn_off
entity_id: switch.living_room_intake_fan_recirculation
- id: living_room_intake_fan_update
alias: 'Living Room Intake Fan: Update'
mode: single
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /5
- platform: state
entity_id:
- input_select.home_mode
- input_boolean.scene_sleepy_mood
- input_boolean.living_room_intake_fan_control
- switch.ironing_board_socket
- id: room_airing
platform: state
entity_id:
- input_boolean.living_room_airing_warm
- input_boolean.living_room_airing_cold
to:
- 'on'
- 'off'
- id: recirculation
platform: state
entity_id: switch.living_room_intake_fan_recirculation
to:
- 'on'
- 'off'
- platform: state
entity_id: sensor.ups_status
from: On Battery
to: Online
for:
seconds: 45
condition:
- condition: state
entity_id: climate.living_room_intake_fan
state:
- heat
- fan_only
- 'off'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.living_room_intake_fan_control
state: 'on'
action:
- if:
- condition: trigger
id: recirculation
then:
- delay:
seconds: 20
else:
- delay:
seconds: 1
- action: script.intake_fan_update
data:
area: living_room
- id: living_room_airing_swap_modes
alias: 'Living Room Airing: Swap modes'
trigger:
- platform: state
entity_id:
- input_boolean.living_room_airing_warm
- input_boolean.living_room_airing_cold
to: 'on'
action:
- service: input_boolean.turn_off
data_template:
entity_id: "{%- if trigger.from_state.entity_id == 'input_boolean.living_room_airing_warm'\
\ -%}\n input_boolean.living_room_airing_cold\n{%- else -%}\n input_boolean.living_room_airing_warm\n\
{%- endif -%}\n"
- id: living_room_airing_auto_turn_off
alias: 'Living Room Airing: Auto turn off'
trigger:
- platform: state
entity_id:
- input_boolean.living_room_airing_warm
- input_boolean.living_room_airing_cold
to: 'on'
for:
minutes: 25
action:
- service: input_boolean.turn_off
data_template:
entity_id: '{{ trigger.from_state.entity_id }}
'
- id: workshop_intake_fan_update
alias: 'Workshop Intake Fan: Update'
mode: single
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /5
- platform: state
entity_id:
- input_select.home_mode
- input_select.washing_machine_status
- input_boolean.scene_sleepy_mood
- input_boolean.workshop_intake_fan_control
- binary_sensor.workshop_occupancy
- id: room_airing
platform: state
entity_id:
- input_boolean.workshop_airing_warm
- input_boolean.workshop_airing_cold
to:
- 'on'
- 'off'
- id: recirculation
platform: state
entity_id: switch.workshop_intake_fan_recirculation
to:
- 'on'
- 'off'
- platform: state
entity_id: sensor.ups_status
from: On Battery
to: Online
for:
seconds: 60
condition:
- condition: state
entity_id: climate.workshop_intake_fan
state:
- heat
- fan_only
- 'off'
- condition: state
entity_id:
- input_boolean.climate_control
- input_boolean.workshop_intake_fan_control
state: 'on'
action:
- if:
- condition: trigger
id: recirculation
then:
- delay:
seconds: 20
else:
- delay:
seconds: 1
- action: script.intake_fan_update
data:
area: workshop
- id: workshop_airing_swap_modes
alias: 'Workshop Airing: Swap modes'
trigger:
- platform: state
entity_id:
- input_boolean.workshop_airing_warm
- input_boolean.workshop_airing_cold
to: 'on'
action:
- service: input_boolean.turn_off
data_template:
entity_id: "{%- if trigger.from_state.entity_id == 'input_boolean.workshop_airing_warm'\
\ -%}\n input_boolean.workshop_airing_cold\n{%- else -%}\n input_boolean.workshop_airing_warm\n\
{%- endif -%}\n"
- id: workshop_airing_auto_turn_off
alias: 'Workshop Airing: Auto turn off'
trigger:
- platform: state
entity_id:
- input_boolean.workshop_airing_warm
- input_boolean.workshop_airing_cold
to: 'on'
for:
minutes: 35
action:
- service: input_boolean.turn_off
data_template:
entity_id: '{{ trigger.from_state.entity_id }}
'
- id: kettle_auto_turn_off
alias: 'Kettle: Auto turn off'
trigger:
- platform: state
entity_id: climate.kettle
to: heat
for:
minutes: 7
action:
- service: climate.turn_off
entity_id: climate.kettle
- id: kettle_boil_done_alert
alias: 'Kettle: Boil done alert'
trigger:
- platform: state
entity_id: climate.kettle
from: auto
to: 'off'
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: numeric_state
entity_id: climate.kettle
attribute: current_temperature
above: 93
action:
- service: script.yandex_station_tts
data:
target:
- media_player.living_room_station
- media_player.workshop_station
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Чайник вскипел, приятного\
\ чаяпития',\n 'Время пить чай!',\n 'Пойдём пить чай',\n 'Давай заварим\
\ чай!',\n 'Горячая вода готова, заваривай лапшу',\n ]|random }}\n"
- id: kettle_heat_done_alert
alias: 'Kettle: Heat done alert'
trigger:
- platform: state
entity_id: climate.kettle
from: 'off'
to: heat
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
action:
- wait_template: '{{ state_attr(''climate.kettle'', ''current_temperature'')|int(0)
> (state_attr(''climate.kettle'', ''temperature'')|int(0) - 4) }}
'
timeout:
minutes: 7
continue_on_timeout: false
- condition: state
entity_id: climate.kettle
state: heat
- service: script.yandex_station_tts
data:
target:
- media_player.living_room_station
- media_player.workshop_station
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Водичка нагрелась,\
\ приятного чаяпития',\n 'Время пить чай!',\n 'Пойдём пить чай',\n \
\ 'Давай заварим чай!'\n ]|random }}\n"
- id: kettle_stuck
alias: Kettle Stuck
trigger:
- trigger: time_pattern
minutes: 3
condition:
- condition: state
entity_id: switch.kettle_power
state: 'off'
- condition: template
value_template: '{{ (now() - states.sensor.kettle_uptime.last_changed).total_seconds()
> 3 * 60 }}
'
action:
- action: button.press
entity_id: button.kettle_restart
- id: bathroom_light_turn_on
alias: 'Bathroom Light: Turn on'
trigger:
- platform: state
entity_id: binary_sensor.bathroom_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: group.bathroom_lights
state: 'off'
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.dim_light
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 17
- conditions:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
sequence:
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 100
- id: bathroom_light_turn_on_night_fallback
alias: 'Bathroom Light: Turn on (night fallback)'
trigger:
- platform: state
entity_id:
- binary_sensor.bathroom_motion
- binary_sensor.hallway_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: input_boolean.scene_waking_up
state: 'off'
- condition: state
entity_id: group.bathroom_path_lights
state: unavailable
action:
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 7
- id: bathroom_light_turn_off
alias: 'Bathroom Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.bathroom_any_occupancy
from: 'on'
to: 'off'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.bathroom_any_occupancy
from: 'on'
to: 'off'
for:
hours: 1
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.bathroom_light_control
- group.bathroom_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.bathroom_lights
data:
transition: 6
- id: bathroom_light_control_turn_on
alias: 'Bathroom Light Control: Turn on'
trigger:
- platform: state
entity_id: group.bathroom_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.bathroom_light_control
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.bathroom_light_control
- id: bathroom_light_control_turn_off
alias: 'Bathroom Light Control: Turn off'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Не выключай свет в ванной
condition:
- condition: state
entity_id: input_boolean.bathroom_light_control
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.bathroom_light_control
- id: bathroom_bathtub_light_turn_on
alias: 'Bathroom Bathtub Light: Turn on'
trigger:
- platform: state
entity_id: binary_sensor.bathroom_bathtub_occupancy
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id:
- binary_sensor.dim_light
- light.bathroom_bathtub
state: 'off'
action:
- service: light.turn_on
entity_id: light.bathroom_bathtub
- id: bedroom_light_turn_on
alias: 'Bedroom Light: Turn on'
trigger:
- platform: state
entity_id: binary_sensor.bedroom_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: or
conditions:
- and:
- condition: time
after: '13:00:00'
before: 04:00:00
- condition: numeric_state
entity_id: sensor.illuminance_north_side
below: 20
- condition: state
entity_id: cover.bedroom
state: closed
- condition: state
entity_id:
- input_boolean.scene_sleepy_mood
- binary_sensor.bedroom_bed_occupancy
- group.bedroom_lights
state: 'off'
action:
- service: light.turn_on
entity_id:
- light.bedroom_bed
- light.bedroom_moon
data:
rgb_color:
- 10
- 214
- 255
brightness_pct: 100
- service: light.turn_on
entity_id:
- light.bedroom_cat
- light.bedroom_string
data:
color_temp_kelvin: 2700
brightness_pct: 100
- id: bedroom_bed_light_turn_on_night
alias: 'Bedroom Bed Light: Turn on (night)'
trigger:
- platform: state
entity_id: binary_sensor.bedroom_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: light.bedroom_bed
state: 'off'
action:
- service: light.turn_on
entity_id: light.bedroom_bed
data:
color_name: red
brightness_pct: 30
- id: bedroom_main_light_turn_off
alias: 'Bedroom Main Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.bedroom_any_occupancy
to: 'off'
for:
minutes: 3
condition:
- condition: state
entity_id:
- input_boolean.light_control
- light.bedroom_main
state: 'on'
- not:
- and:
- condition: state
entity_id: input_select.ironing_board_room
state: Bedroom
- condition: state
entity_id: switch.ironing_board_socket
state: 'on'
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
action:
- service: light.turn_off
entity_id: light.bedroom_main
- id: bedroom_bed_light_turn_off
alias: 'Bedroom Bed Light: Turn off'
trigger:
- platform: state
entity_id: light.bedroom_bed
to: 'on'
for:
hours: 1
- platform: state
entity_id: input_select.home_mode
from: Night
- id: motion
platform: state
entity_id: binary_sensor.bedroom_motion
from: 'on'
to: 'off'
for:
minutes: 1
- platform: state
entity_id: binary_sensor.bedroom_bed_full_occupancy
from: 'off'
to: 'on'
for:
seconds: 30
condition:
- condition: state
entity_id:
- input_boolean.light_control
- light.bedroom_bed
state: 'on'
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
action:
- if:
- condition: trigger
id: motion
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
then:
stop: null
- service: light.turn_off
entity_id: light.bedroom_bed
- id: bedroom_aux_light_turn_off
alias: 'Bedroom Aux Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.bedroom_any_occupancy
to: 'off'
for:
seconds: 15
- platform: state
entity_id: light.bedroom_main
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id:
- light.bedroom_moon
- light.bedroom_bed
- light.bedroom_cat
- light.bedroom_string
state: 'on'
match: any
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
action:
- service: light.turn_off
entity_id:
- light.bedroom_moon
- light.bedroom_bed
- light.bedroom_cat
- light.bedroom_string
- id: bedroom_moon_light_charger_turn_on
alias: 'Bedroom Moon Light Charger: Turn on'
trigger:
- platform: time
at: '18:00'
action:
- service: switch.turn_on
entity_id: switch.bedroom_moon_light_charger
- id: bedroom_moon_light_charger_turn_off
alias: 'Bedroom Moon Light Charger: Turn off'
trigger:
- platform: state
entity_id: switch.bedroom_moon_light_charger
to: 'on'
for:
hours: 1
minutes: 30
action:
- service: switch.turn_off
entity_id: switch.bedroom_moon_light_charger
- id: kitchen_light_turn_on_full
alias: 'Kitchen Light: Turn on (full)'
trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id:
- light.kitchen_main
- binary_sensor.dim_light
- input_boolean.scene_sleepy_mood
state: 'off'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- or:
- condition: state
entity_id: light.kitchen_mood
state: 'off'
- condition: template
value_template: '{{ state_attr(''light.kitchen_worktop'', ''brightness'')|int(0)
in (0, 50) }}
'
action:
- service: light.turn_on
entity_id: light.kitchen_worktop
data:
brightness: 255
- service: light.turn_on
entity_id: light.kitchen_mood
- id: kitchen_light_turn_on_dimmed
alias: 'Kitchen Light: Turn on (dimmed)'
trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion
to: 'on'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- binary_sensor.dim_light
state: 'on'
- condition: state
entity_id: light.kitchen_main
state: 'off'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
- or:
- condition: state
entity_id: light.kitchen_mood
state: 'off'
- condition: template
value_template: '{{ state_attr(''light.kitchen_worktop'', ''brightness'')|int(0)
in (0, 100) }}
'
action:
- service: light.turn_on
entity_id: light.kitchen_worktop
data:
brightness: 100
- service: light.turn_on
entity_id: light.kitchen_mood
- id: kitchen_light_dim_worktop
alias: 'Kitchen Light: Dim worktop'
trigger:
- platform: state
entity_id: binary_sensor.kitchen_occupancy
from: 'on'
to: 'off'
for:
minutes: 4
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- or:
- condition: state
entity_id: light.kitchen_main
state: 'on'
- condition: template
value_template: '{{ state_attr(''light.kitchen_worktop'', ''brightness'')|int(0)
> 250 }}
'
action:
- service: light.turn_on
entity_id: light.kitchen_worktop
data:
brightness: 50
- service: light.turn_off
entity_id: light.kitchen_main
- id: kitchen_light_turn_off
alias: 'Kitchen Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.kitchen_occupancy
from: 'on'
to: 'off'
for:
minutes: 10
- platform: state
entity_id: binary_sensor.kitchen_motion
from: 'on'
to: 'off'
for:
hours: 2
condition:
- condition: state
entity_id:
- input_boolean.light_control
- group.kitchen_lights
state: 'on'
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
action:
- service: light.turn_off
entity_id: group.kitchen_lights
- id: living_room_light_turn_on
alias: 'Living Room Light: Turn on'
trigger:
- platform: state
entity_id: binary_sensor.living_room_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.illuminance_south_side
below: 500
- condition: state
entity_id: cover.living_room
state: closed
- condition: state
entity_id: binary_sensor.winter_bright_light
state: 'on'
- condition: state
entity_id:
- group.living_room_lights
- binary_sensor.dim_light
state: 'off'
action:
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 45
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 23
color_temp_kelvin: 3400
- if:
- condition: state
entity_id: binary_sensor.winter_bright_light
state: 'on'
then:
- action: light.turn_on
entity_id: light.living_room_main
- id: living_room_light_turn_off
alias: 'Living Room Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.living_room_occupancy
from: 'on'
to: 'off'
for:
minutes: 20
- platform: state
entity_id: binary_sensor.living_room_motion
from: 'on'
to: 'off'
for:
hours: 2
condition:
- condition: state
entity_id:
- input_boolean.light_control
- group.living_room_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.living_room_lights
- id: living_room_main_light_turn_on
alias: 'Living Room Main Light: Turn on'
trigger:
- platform: state
entity_id: input_boolean.scene_meal
from: 'on'
to: 'off'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- binary_sensor.winter_bright_light
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id:
- light.living_room_main
- binary_sensor.dim_light
state: 'off'
action:
- action: light.turn_on
entity_id: light.living_room_main
- id: workshop_main_light_state_update
alias: 'Workshop Main Light: State update'
description: Включает правую ленту при включении левой, жене лень нажимать две кнопки
mode: queued
trigger:
- platform: state
entity_id: light.workshop_main_1_1
from:
- 'on'
- 'off'
to:
- 'on'
- 'off'
action:
- delay:
milliseconds: 500
- condition: template
value_template: '{{ not is_state(''light.workshop_main_2_1'', trigger.to_state.state)
}}
'
- if:
- condition: template
value_template: '{{ trigger.to_state.state == ''on'' }}
'
then:
- service: light.turn_on
entity_id:
- light.workshop_main_2_1
- light.workshop_main_2_2
data:
transition: 2
brightness_pct: 100
else:
- service: light.turn_off
entity_id:
- light.workshop_main_2_1
- light.workshop_main_2_2
- id: workshop_main_light_turn_on
alias: 'Workshop Main Light: Turn on'
max_exceeded: silent
trigger:
- platform: state
entity_id: binary_sensor.workshop_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.workshop_motion
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: light.workshop_main
state: 'off'
action:
- if:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.dim_light
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Night
then:
- service: light.turn_on
entity_id:
- light.workshop_main_2_1
- light.workshop_main_2_2
data:
brightness_pct: 1
transition: 0
else:
- service: light.turn_on
entity_id: light.workshop_main
data:
brightness_pct: 100
- id: workshop_main_light_turn_off
alias: 'Workshop Main Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.workshop_occupancy
from: 'on'
to: 'off'
for:
minutes: 10
- platform: state
entity_id: binary_sensor.workshop_occupancy
from: 'on'
to: 'off'
for:
minutes: 15
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: binary_sensor.workshop_motion
state: 'off'
- condition: state
entity_id: light.workshop_main
state: 'on'
action:
- service: light.turn_off
entity_id: light.workshop_main
data:
transition: 10
- id: workshop_main_light_turn_off_door
alias: 'Workshop Main Light: Turn off (door)'
trigger:
- id: door
platform: state
entity_id: binary_sensor.workshop_door
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: light.workshop_main
state: 'on'
action:
- if:
- condition: numeric_state
entity_id: light.workshop_main
attribute: brightness
below: 40
then:
- service: light.turn_off
entity_id: light.workshop_main
data:
transition: 0
else:
- service: light.turn_off
entity_id: light.workshop_main
data:
transition: 4
- id: workshop_light_control_turn_on
alias: 'Workshop Light Control: Turn on'
trigger:
- platform: state
entity_id: light.workshop_main
to: 'off'
condition:
- condition: state
entity_id: input_boolean.workshop_light_control
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.workshop_light_control
- id: workshop_light_control_turn_off
alias: 'Workshop Light Control: Turn off'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Не выключай свет в мастерской
action:
- service: input_boolean.turn_off
entity_id: input_boolean.workshop_light_control
- id: avr_turn_on
alias: 'AVR: Turn on'
mode: restart
trigger:
- trigger: state
entity_id: media_layer.tv
from: 'off'
to: 'on'
for:
seconds: 20
- trigger: state
entity_id: media_layer.tv
from: 'off'
to: 'on'
for:
seconds: 45
condition:
- condition: state
entity_id: switch.avr_power
state: 'off'
action:
- action: switch.turn_on
entity_id: switch.avr_power
- id: avr_turn_off_no_tv
alias: 'AVR: Turn off (no TV)'
mode: restart
trigger:
- platform: state
entity_id: switch.avr_power
to: 'on'
action:
- delay:
minutes: 1
- condition: state
entity_id: media_player.tv
state: 'off'
- condition: state
entity_id: switch.avr_power
state: 'on'
- action: switch.turn_off
entity_id: switch.avr_power
- id: avr_fix_sound
alias: 'AVR: Fix sound'
trigger:
- trigger: event
event_type: yandex_intent
event_data:
text: Почини звук
action:
- if:
- condition: state
entity_id: switch.avr_power
state: 'off'
then:
- action: switch.turn_on
entity_id: switch.avr_power
else:
- action: switch.toggle
entity_id: switch.avr_power
- delay:
seconds: 5
- action: switch.toggle
entity_id: switch.avr_power
- id: bathroom_bathtub_region_enter
alias: 'Bathroom Bath: Region enter'
trigger:
- platform: device
domain: mqtt
device_id: dfc039d7f269372836ab2b62aaf4401b
type: action
subtype: region_1_enter
discovery_id: 0x54ef441000585ebc action_region_1_enter
action:
- service: timer.cancel
entity_id: timer.bathroom_bathtub_region_free
- service: input_boolean.turn_on
entity_id: input_boolean.bathroom_bathtub_occupancy
- id: bathroom_bathtub_region_leave
alias: 'Bathroom Bath: Region leave'
trigger:
- platform: device
domain: mqtt
device_id: dfc039d7f269372836ab2b62aaf4401b
type: action
subtype: region_1_leave
discovery_id: 0x54ef441000585ebc action_region_1_leave
action:
- service: timer.start
entity_id: timer.bathroom_bathtub_region_free
- id: bathroom_bathtub_region_free
alias: 'Bathroom Bath: Region free'
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.bathroom_bathtub_region_free
action:
- service: input_boolean.turn_off
entity_id: input_boolean.bathroom_bathtub_occupancy
- id: kitchen_applicances_status_update
alias: Kichen Applicances Status Update
trigger:
- platform: state
entity_id: sensor.kitchen_power_supply_power
condition:
- condition: template
value_template: '{{ trigger.to_state.state|int(0) >= 700 }}
'
action:
- service: timer.start
entity_id: timer.kitchen_appliances_running
- id: appliance_left_on_alert
alias: Appliance Left On Alert
trigger:
- platform: state
entity_id: binary_sensor.kitchen_occupancy
from: 'on'
to: 'off'
for:
minutes: 20
- platform: state
entity_id: binary_sensor.anyone_home
to: 'off'
- platform: state
entity_id: input_boolean.scene_meal
to: 'on'
for:
minutes: 3
condition:
- condition: state
entity_id:
- binary_sensor.stove
- binary_sensor.kitchen_appliances
match: any
state: 'on'
for:
minutes: 5
action:
- service: notify.dextor
data:
message: '⚡️ Похоже кто-то забыл выключить плиту или печку
'
- id: certificate_renew
alias: Certificate renew
trigger:
- platform: time
at: '10:00:00'
action:
- service: hassio.addon_start
data:
addon: core_letsencrypt
- id: humidifiers_maintenance_alert
alias: 'Humidifiers: Maintenance Alert'
trigger:
- platform: time_pattern
minutes: /10
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: or
conditions:
- and:
- condition: numeric_state
entity_id: sensor.bedroom_humidifier_water_level
below: 25
- condition: state
entity_id: input_boolean.bedroom_humidifier_control
state: 'on'
- and:
- condition: state
entity_id: switch.living_room_humidifier_water_tank_maintenance
state:
- 'off'
- unavailable
- condition: numeric_state
entity_id: sensor.living_room_humidifier_water_level
below: 25
- condition: state
entity_id: input_boolean.living_room_humidifier_control
state: 'on'
- and:
- condition: numeric_state
entity_id: sensor.workshop_humidifier_water_level
below: 25
- condition: state
entity_id: binary_sensor.workshop_humidifier_water_tank
state: 'on'
- condition: state
entity_id: input_boolean.workshop_humidifier_control
state: 'on'
- condition: state
entity_id:
- input_boolean.scene_movie
- input_boolean.scene_meal
state: 'off'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: template
value_template: '{{ (now() - states.input_select.home_mode.last_changed).total_seconds()
> 3600 }}
'
- condition: template
value_template: "{{ (now() - state_attr('automation.humidifiers_maintenance_alert',\n\
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 60 * 60 }}\n"
action:
- wait_template: '{{ not is_state(''media_player.atv'', [''playing'', ''pause''])
}}
'
timeout:
minutes: 28
continue_on_timeout: true
- if:
- condition: state
entity_id: binary_sensor.humidifier_cleanup_notice
state: 'on'
then:
- service: script.yandex_station_tts
data:
target: all
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Я чувствую новую\
\ жизнь! Давай помоем увлажнители',\n 'Пахнет болотом, понимаешь к чем\
\ я клоню?',\n 'Не хотела тебе говорить, но увлажнители надо помыть',\n\
\ 'Сегодня доливом воды не отделаешься, время мыть увлажнители',\n \
\ 'Даже кот не идёт вейпить увлажнитель, там очень пахнет'\n ]|random\n\
}}\n"
else:
- service: script.yandex_station_tts
data:
target: all
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Добавь водички\
\ в увлажнители',\n 'Увлажнители хотят пить',\n 'У увлажнителей пересохло\
\ в горле, напои их пожалуйста',\n 'Как-то суховато, может воды?',\n\
\ 'Пора размяться и налить в увлажнители воды',\n 'Не любишь сухие\
\ губы? Налей воды в увлажнители!',\n 'Увлажните меня!',\n ]|random\n\
}} {% if not is_state('sensor.humidifier_need_refill', 'unavailable') %}\n\
\ {{ states('sensor.humidifier_need_refill') }}\n{% endif %}\n"
- id: humidifiers_cleanup
alias: 'Humidifiers: Cleanup'
trigger:
- platform: state
entity_id: binary_sensor.workshop_humidifier_water_tank
from: 'on'
to: 'off'
for:
seconds: 30
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.humidifiers_last_cleanup
data:
date: '{{ now().strftime("%Y-%m-%d") }}'
- id: Intake Fan Error
alias: Intake Fan Error
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: state_changed
condition:
- condition: template
value_template: "{{ trigger.event.data.new_state and\n trigger.event.data.new_state.entity_id.endswith('intake_fan_errors')\
\ and\n trigger.event.data.new_state.state and\n trigger.event.data.new_state.state\
\ not in ['unavailable', 'unknown'] }}\n"
action:
- service: notify.dextor
data:
message: '😨 Ошибки в бризере {{ trigger.event.data.new_state.entity_id }}: {{
trigger.event.data.new_state.state }}
'
- id: intercom_night_ring
alias: 'Intercom: Night ring'
trigger:
- platform: state
entity_id: sensor.intercom_status
to: Incoming call
condition:
- condition: state
entity_id: input_select.home_mode
state: Night
action:
- service: notify.dextor
data:
message: 🐷 Кто-то ломится в дверь когда все спят. Может курьер?
- id: intercom_unexpected_ring
alias: 'Intercom: Unexpected ring'
trigger:
- platform: state
entity_id: sensor.intercom_status
to: Incoming call
condition:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id:
- binary_sensor.anyone_home
- binary_sensor.anyone_near_home
state: 'off'
action:
- service: notify.dextor
data:
message: 🐷 Кто-то ломится в дверь когда никого нет дома
- id: intercom_mode_update
alias: 'Intercom: Mode update'
mode: single
max_exceeded: silent
trigger:
- platform: time_pattern
minutes: /5
- platform: state
entity_id:
- input_select.home_mode
- input_boolean.scene_delivery
- input_boolean.scene_wait_guests
- binary_sensor.anyone_near_home
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.scene_delivery
state: 'on'
sequence:
- service: select.select_option
entity_id: select.intercom_mode
data:
option: Delivery
- conditions:
- condition: state
entity_id: input_boolean.scene_wait_guests
state: 'on'
sequence:
- service: select.select_option
entity_id: select.intercom_mode
data:
option: Guests
- conditions:
- condition: or
conditions:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: binary_sensor.anyone_near_home
state: 'on'
sequence:
- service: select.select_option
entity_id: select.intercom_mode
data:
option: Always accept
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: template
value_template: "{{ (now() - state_attr('automation.ios_intercom_mode_accept',\n\
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 300 }}\n"
sequence:
- service: select.select_option
entity_id: select.intercom_mode
data:
option: Always reject
- id: intercom_door_opened
alias: 'Intercom: Door opened'
trigger:
- platform: state
entity_id: sensor.intercom_status
to: Door opened
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: template
value_template: "{{ (now() - state_attr('automation.intercom_door_opened',\n \
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 60 }}\n"
action:
- service: media_player.media_pause
entity_id: group.yandex_stations
- if:
- condition: state
entity_id: media_player.atv
state: playing
then:
- service: media_player.media_pause
entity_id: media_player.atv
- service: scene.create
data:
scene_id: intercom_door_opened
snapshot_entities:
- light.bathroom_main
- light.kitchen_worktop
- light.living_room_backlight_1
- light.living_room_backlight_6
- light.living_room_tv
- light.workshop_main
- repeat:
for_each:
- light.bathroom_main
- light.kitchen_worktop
- light.living_room_backlight_1
- light.living_room_backlight_6
- light.living_room_tv
- light.workshop_main
sequence:
- service: script.turn_on
entity_id: script.flash_light
data:
variables:
entity_id: '{{ repeat.item }}'
rgb_color: "{% if repeat.item == 'light.living_room_backlight' %}\n [0,\
\ 86, 255]\n{% else %}\n []\n{% endif %}\n"
- delay:
seconds: 2
milliseconds: 200
- service: scene.turn_on
entity_id: scene.intercom_door_opened
data:
transition: 0.6
- choose:
- conditions:
- condition: state
entity_id: input_boolean.scene_wait_guests
state: 'on'
sequence:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: "{{ [\n 'Гости уже почти на пороге',\n 'Впустила гостей в подъезд',\n\
\ 'Гости вот-вот зайдут, беги встречать',\n ]|random\n}}\n"
- conditions:
- condition: state
entity_id: input_boolean.scene_delivery
state: 'on'
sequence:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: "{{ [\n 'Курьер проник в подьезд, срочно надевай труселя и накрывай\
\ стол',\n 'Курьер в лифте, наливай напитки!',\n 'Курьер уже здесь,\
\ карауль дверь',\n 'Как же вкусно пахнет! Курьер почти у двери!'\n\
\ ]|random\n}}\n"
- conditions:
- condition: template
value_template: '{{ state_attr(''input_datetime.scene_delivery_scheduled_from'',
''timestamp'') <= as_timestamp(now()) <= state_attr(''input_datetime.scene_delivery_scheduled_to'',
''timestamp'') }}
'
sequence:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: "Открыла дверь курьеру для плановой доставки, готовься встречать {%\
\ if is_state('person.dextor', 'Near Home') %}\n , а может это и Тёмушка\n\
{% endif %}\n"
- conditions:
- condition: state
entity_id: person.dextor
state: Near Home
sequence:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: "{{ [\n 'Кажется Тёмушка поднимается, скорее беги встречать',\n\
\ 'Тёмушка поднимается, он будет рад встретить тебя у двери',\n \
\ 'Вот-вот зайдёт Тёмушка, и это очень здорово!',\n ]|random\n}}\n"
- conditions:
- condition: state
entity_id: person.layma
state: Near Home
sequence:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: Жёнушка на пороге, готовься встречать
default:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: "{{ [\n 'Незванные гости на пороге, готовься!',\n 'Скоро позвонят\
\ в дверь, самое время надеть труселя',\n 'Я кого-то впустила в подъезд,\
\ скоро узнаем кого'\n ]|random\n}}\n"
- alias: 'iOS: Notification / DND announce'
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionName: 'Анонс: Не могу подойти'
action:
- service: script.yandex_station_tts
data:
target: all
type: attention
text: Слышу тебя, но подойти не могу. Мур-мур.
- id: ios_intercom_mode_accept
alias: 'iOS: Intercom mode - Accept'
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionName: Открыть домофон
action:
- service: select.select_option
entity_id: select.intercom_mode
data:
option: Always accept
- id: ironing_board_turn_off_occupance_living_room
alias: 'Ironing Board: Turn off (Occupancy / Living Room)'
trigger:
- platform: state
entity_id: binary_sensor.living_room_occupancy
to: 'off'
for:
minutes: 18
condition:
- condition: state
entity_id: switch.ironing_board_socket
state: 'on'
- condition: state
entity_id: input_select.ironing_board_room
state: Living Room
action:
- action: switch.turn_off
entity_id: switch.ironing_board_socket
- id: ironing_board_turn_off_idle_living_room
alias: 'Ironing Board: Turn off (Idle / Living Room)'
trigger:
- platform: state
entity_id: switch.ironing_board_socket
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.living_room_motion
state:
- 'off'
- unavailable
- condition: state
entity_id: input_select.ironing_board_room
state: Living Room
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.living_room_motion
to: 'on'
timeout:
minutes: 10
continue_on_timeout: true
- if:
- condition: state
entity_id: binary_sensor.living_room_motion
state:
- 'off'
- unavailable
then:
- action: switch.turn_off
entity_id: switch.ironing_board_socket
- id: ironing_board_turn_off_occupancy_bedroom
alias: 'Ironing Board: Turn off (Occupancy / Bedroom)'
trigger:
- platform: state
entity_id: binary_sensor.bedroom_any_occupancy
to: 'off'
for:
minutes: 18
condition:
- condition: state
entity_id: switch.ironing_board_socket
state: 'on'
- condition: state
entity_id: input_select.ironing_board_room
state: Bedroom
action:
- action: switch.turn_off
entity_id: switch.ironing_board_socket
- id: ironing_board_turn_off_idle_bedroom
alias: 'Ironing Board: Turn off (Idle / Bedroom)'
trigger:
- platform: state
entity_id: switch.ironing_board_socket
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.bedroom_motion
state:
- 'off'
- unavailable
- condition: state
entity_id: input_select.ironing_board_room
state: Bedroom
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.bedroom_motion
to: 'on'
timeout:
minutes: 10
continue_on_timeout: true
- if:
- condition: state
entity_id: binary_sensor.bedroom_motion
state:
- 'off'
- unavailable
then:
- action: switch.turn_off
entity_id: switch.ironing_board_socket
- id: ironing_board_turn_off_no_one_home
alias: 'Ironing Board: Turn off (no one home)'
trigger:
- platform: state
entity_id: switch.ironing_board_socket
to: 'on'
- platform: time_pattern
minutes: /1
- platform: state
entity_id: binary_sensor.anyone_home
to: 'off'
condition:
- condition: state
entity_id: switch.ironing_board_socket
state: 'on'
- condition: state
entity_id: binary_sensor.anyone_home
state: 'off'
action:
- action: switch.turn_off
entity_id: switch.ironing_board_socket
- id: ironing_board_turn_off_overload
alias: 'Ironing Board: Turn off (overload)'
mode: restart
trigger:
- platform: numeric_state
entity_id: sensor.ironing_board_socket_power
above: 2600
- platform: numeric_state
entity_id: sensor.ironing_board_socket_power
above: 2590
condition:
- condition: state
entity_id: switch.ironing_board_socket
state: 'on'
action:
- action: switch.turn_off
entity_id: switch.ironing_board_socket
- service: script.turn_on
entity_id: script.yandex_station_tts
data:
variables:
target: media_player.{{ states('input_select.ironing_board_room')|lower|replace('
', '_') }}_station
text: Выключи утюг
- id: ironing_board_alarm
alias: 'Ironing Board: Alarm'
trigger:
- platform: state
entity_id: switch.ironing_board_socket
to: 'on'
for:
minutes: 50
action:
- action: notify.dextor
data:
message: 🪠 Гладильная доска долго включена, вряд ли так должно быть
continue_on_error: true
- action: script.yandex_station_tts
data:
target: all
type: alert
text: Гладильная доска долго включена, вряд ли так должно быть
- id: kitchen_worktop_button_turn_on
alias: 'Kitchen Worktop Button: Turn on'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_short_press
subtype: turn_on
actions:
- if:
- condition: state
entity_id: light.kitchen_worktop
state: 'off'
then:
- action: light.turn_on
entity_id: light.kitchen_worktop
data:
brightness_pct: 100
else:
- action: light.turn_off
entity_id: light.kitchen_worktop
- id: kitchen_worktop_button_dim_down_short_press_day
alias: 'Kitchen Worktop Button: Dim down short press (Day)'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_short_press
subtype: dim_down
conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
actions:
- action: script.turn_on
entity_id: script.kitchen_worktop_right_light_ack_flash
- action: script.yandex_station_tts
data:
target:
- media_player.living_room_station
- media_player.workshop_station
type: attention
pause_atv: true
text: "{{ [\n 'требуется помощь на кухне',\n 'скорее подойди на кухню',\n\
\ 'тебя очень ждут на кухне',\n ]|random\n}}\n"
- id: kitchen_worktop_button_dim_down_short_press_night
alias: 'Kitchen Worktop Button: Dim down short press (Night)'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_short_press
subtype: dim_down
conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
actions:
- action: light.turn_on
entity_id: light.kitchen_worktop
data:
brightness_pct: 20
- id: kitchen_worktop_button_dim_up_short_press
alias: 'Kitchen Worktop Button: Dim up short press'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_short_press
subtype: dim_up
conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
actions:
- action: script.turn_on
entity_id: script.kitchen_worktop_right_light_ack_flash
- action: script.yandex_station_tts
data:
target:
- media_player.living_room_station
- media_player.workshop_station
type: attention
pause_atv: true
text: "{{ [\n 'еда почти готова, время накрывать стол',\n 'еда на подходе,\
\ скоро будем кушать',\n 'бросай всё и давай поедим!',\n ]|random\n\
}}\n"
- id: kitchen_worktop_button_dim_up_long_press
alias: 'Kitchen Worktop Button: Dim up long press'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_long_press
subtype: dim_up
conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
actions:
- action: script.turn_on
entity_id: script.kitchen_worktop_right_light_ack_flash
- event: kitchen_worktop_button_brightness_up_hold
- id: kitchen_worktop_button_left_short_press
alias: 'Kitchen Worktop Button: Left short press'
mode: single
max_exceeded: silent
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_short_press
subtype: left
conditions:
- condition: state
entity_id: person.dextor
state: home
actions:
- action: input_number.increment
entity_id: input_number.humidifiers_water_consumption
- action: script.kitchen_worktop_right_light_ack_flash
- action: script.kitchen_worktop_right_light_ack_flash
- delay:
seconds: 10
- id: kitchen_worktop_button_left_long_press
alias: 'Kitchen Worktop Button: Left long press'
mode: single
max_exceeded: silent
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_long_press
subtype: left
actions:
- action: input_select.select_next
entity_id: input_select.dishwasher_status
- id: kitchen_worktop_button_right_short_press
alias: 'Kitchen Worktop Button: Right short press'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_short_press
subtype: right
conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
actions:
- if:
- condition: state
entity_id: timer.rice_cooking
state: active
then:
- action: timer.pause
entity_id: timer.rice_cooking
- action: timer.start
entity_id: timer.rice_cooking
- service: script.yandex_station_tts
data:
target: media_player.kitchen_station
text: 'Осталось примерно {{ state_attr(''timer.rice_cooking'', ''remaining'').split('':'')[1]
}} мин. до полной готовности риса
'
else:
- action: timer.start
entity_id:
- timer.rice_cooking
- timer.rice_almost_ready
- action: script.turn_on
entity_id: script.kitchen_worktop_right_light_ack_flash
- id: kitchen_worktop_button_right_long_press
alias: 'Kitchen Worktop Button: Right long press'
triggers:
- trigger: device
domain: zha
device_id: 7abc62119d4a89a29846de67a65da2f8
type: remote_button_long_press
subtype: right
actions:
- action: timer.cancel
entity_id: timer.rice_cooking
- action: script.turn_on
entity_id: script.kitchen_worktop_right_light_ack_flash
- id: leave_kombucha_alone
alias: Leave Kombucha Alone
trigger:
- platform: state
entity_id: binary_sensor.closet_door
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: template
value_template: "{{ (now() - state_attr('automation.leave_kombucha_alone',\n \
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 600 }}\n"
action:
- service: script.yandex_station_tts
data:
target: media_player.kitchen_station
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'хватит смотреть на\
\ гриб, с ним всё хорошо',\n 'гриб в полном порядке, цветёт и пахнет',\n\
\ 'будешь часто смотреть, гриб не всплывёт',\n 'с грибом всё стабильно,\
\ сахар ням-ням',\n 'грибы любят покой и темноту, хватит зыркать',\n \
\ 'нееет, опять яркий свет, дай грибу спокойно расти',\n 'нетерпится увидеть\
\ гриб? всему своё время',\n 'гриб спешки не любит, не нужно его постоянно\
\ дёргать',\n ]|random\n}}\n"
- id: light_control_turn_on
alias: 'Light Control: Turn on'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Включи управление светом
- platform: state
entity_id: input_select.home_mode
to: Day
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.light_control
- id: light_control_turn_off
alias: 'Light Control: Turn off'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Не выключай свет
action:
- service: input_boolean.turn_off
entity_id: input_boolean.light_control
- id: living_room_dinner_table_button_single_press
alias: 'Living Room Dinner Table Button: Single press'
trigger:
- trigger: device
domain: mqtt
device_id: 9c3b7479025f7d66f4dd23a779acfd86
type: action
subtype: single
condition:
- condition: state
entity_id: media_player.tv
state: 'on'
action:
- service: script.tv_press_button
data:
button: play
- id: living_room_dinner_table_button_double_press
alias: 'Living Room Dinner Table Button: Double press'
trigger:
- trigger: device
domain: mqtt
device_id: 9c3b7479025f7d66f4dd23a779acfd86
type: action
subtype: double
condition:
- condition: state
entity_id: media_player.tv
state: 'on'
action:
- service: script.tv_press_button
data:
button: left
- id: living_room_dinner_table_button_triple_press
alias: 'Living Room Dinner Table Button: Triple press'
trigger:
- trigger: device
domain: mqtt
device_id: 9c3b7479025f7d66f4dd23a779acfd86
type: action
subtype: triple
condition:
- condition: state
entity_id: media_player.tv
state: 'on'
action:
- service: script.tv_press_button
data:
button: enter
- id: living_room_dinner_table_button_hold
alias: 'Living Room Dinner Table Button: Hold'
trigger:
- trigger: device
domain: mqtt
device_id: 9c3b7479025f7d66f4dd23a779acfd86
type: action
subtype: hold
action:
- event: living_room_dinner_table_button_hold
- id: living_room_light_switch_single_right
alias: 'Living Room Light Switch: Single right'
trigger:
- trigger: device
domain: mqtt
device_id: e0a2386c0fbe8ec9b50b6bc773b4d635
type: action
subtype: single_right
action:
- choose:
- conditions:
- condition: state
entity_id: light.living_room_backlight
state: 'on'
- condition: state
entity_id: light.living_room_backlight
attribute: color_mode
state: color_temp
- condition: numeric_state
entity_id: light.living_room_backlight
attribute: color_temp_kelvin
below: 4000
sequence:
- service: light.turn_off
entity_id: light.living_room_backlight
- conditions:
- condition: state
entity_id: light.living_room_backlight
state: 'on'
- condition: state
entity_id: light.living_room_backlight
attribute: color_mode
state: color_temp
- condition: numeric_state
entity_id: light.living_room_backlight
attribute: color_temp_kelvin
above: 4000
sequence:
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 100
color_temp_kelvin: 2700
default:
- if:
- condition: state
entity_id: input_select.home_mode
state: Night
then:
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 50
rgb_color:
- 255
- 0
- 0
else:
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: "{% if is_state('binary_sensor.dim_light', 'on') %}\n 40\n\
{% else %}\n 100\n{% endif %}\n"
color_temp_kelvin: 4200
- id: living_room_light_switch_double_right
alias: 'Living Room Light Switch: Double right'
trigger:
- trigger: device
domain: mqtt
device_id: e0a2386c0fbe8ec9b50b6bc773b4d635
type: action
subtype: double_right
action:
- if:
- condition: state
entity_id: light.living_room_tv
state: 'off'
then:
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 100
else:
- service: light.turn_off
entity_id: light.living_room_tv
- id: living_room_heater_button_turn_on
alias: 'Living Room Heater Button: Turn on'
trigger:
- trigger: device
domain: mqtt
device_id: 624d122c903dda63a2c71e9d636f4a0c
type: action
subtype: 'on'
action:
- action: switch.turn_on
entity_id: switch.living_room_heater
- id: living_room_heater_button_turn_off
alias: 'Living Room Heater Button: Turn off'
trigger:
- trigger: device
domain: mqtt
device_id: 624d122c903dda63a2c71e9d636f4a0c
type: action
subtype: 'off'
action:
- action: switch.turn_off
entity_id: switch.living_room_heater
- id: living_room_heater_button_hold_down
alias: 'Living Room Heater Button: Hold down'
triggers:
- trigger: device
domain: mqtt
device_id: 624d122c903dda63a2c71e9d636f4a0c
type: action
subtype: brightness_move_down
actions:
- event: living_room_heater_button_hold_down
- id: living_room_tv_light_turn_on
alias: 'Living Room TV Light: Turn on'
trigger:
- platform: state
entity_id: media_player.tv
to: 'on'
condition:
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: light.living_room_tv
state: 'off'
action:
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 45
- id: living_room_tv_light_turn_off
alias: 'Living Room TV Light: Turn off'
trigger:
- platform: state
entity_id: media_player.tv
to: 'off'
condition:
- condition: numeric_state
entity_id: sensor.illuminance_south_side
above: 500
- condition: state
entity_id: binary_sensor.winter_bright_light
state: 'off'
- condition: state
entity_id:
- input_boolean.light_control
- light.living_room_tv
state: 'on'
action:
- service: light.turn_off
entity_id: light.living_room_tv
- id: front_door_locked
alias: 'Front Door: Locked'
mode: restart
trigger:
- platform: state
entity_id: lock.front_door
from: unlocked
to: locked
action:
- service: script.turn_on
entity_id: script.porch_lock_light_flash
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.anyone_home
to: 'off'
timeout:
minutes: 10
continue_on_timeout: false
- service: light.turn_off
entity_id: group.home_lights
continue_on_error: true
- service: media_player.turn_off
entity_id:
- media_player.tv
- media_player.bedroom_station
- media_player.living_room_station
- media_player.workshop_station
- media_player.kitchen_station
continue_on_error: true
- id: front_door_unlocked
alias: 'Front Door: Unlocked'
trigger:
- platform: state
entity_id: lock.front_door
from: locked
to: unlocked
action:
- service: timer.start
entity_id: timer.front_door_unlocked
- id: front_door_unlock
alias: 'Front Door: Unlock'
max_exceeded: silent
trigger:
- platform: state
entity_id: sensor.intercom_status
to: Door opened
condition:
- condition: state
entity_id: lock.front_door
state: locked
- condition: state
entity_id: input_boolean.scene_wait_guests
state: 'on'
action:
- service: lock.unlock
entity_id: lock.front_door
- id: porch_door_unlock
alias: 'Porch Door: Unlock'
mode: restart
trigger:
- platform: state
entity_id: sensor.intercom_status
to: Door opened
condition:
- condition: state
entity_id: lock.porch_door
state: locked
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.anyone_near_home
state: 'on'
- condition: state
entity_id: input_boolean.scene_wait_guests
state: 'on'
action:
- service: lock.unlock
entity_id: lock.porch_door
- delay:
minutes: 7
- if:
- condition: state
entity_id: lock.porch_door
state: unlocked
- condition: state
entity_id: binary_sensor.porch_door
state: 'off'
then:
- service: lock.lock
entity_id: lock.porch_door
- id: porch_door_presence_unlock
alias: 'Porch Door: Presence Unlock'
mode: restart
triggers:
- trigger: state
entity_id:
- person.dextor
- person.layma
to: home
conditions:
- condition: state
entity_id: lock.porch_door
state: locked
- condition: state
entity_id: timer.anyone_near_home_recently
state: active
actions:
- action: lock.unlock
entity_id: lock.porch_door
- delay:
minutes: 3
- if:
- condition: state
entity_id: lock.porch_door
state: unlocked
- condition: state
entity_id: binary_sensor.porch_door
state: 'off'
then:
- service: lock.lock
entity_id: lock.porch_door
- id: scene_meal_turn_on
alias: 'Scene Meal: Turn on'
trigger:
- trigger: event
event_type: yandex_intent
event_data:
text: Время ужинать
- trigger: event
event_type: kitchen_worktop_button_brightness_up_hold
- trigger: event
event_type: living_room_dinner_table_button_hold
action:
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 100
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 100
color_temp_kelvin: 4500
- service: script.yandex_station_tts
data:
target: all
text: "{{ [\n 'Приятного аппетита',\n 'Кушайте много, кушайте вкусно',\n\
\ 'Вкуснятина! Давай скорее кушать',\n ]|random\n}}\n"
- service: input_boolean.turn_on
entity_id: input_boolean.scene_meal
- if:
- condition: state
entity_id: media_player.tv
state: 'off'
then:
- service: media_player.turn_on
entity_id:
- media_player.tv
- media_player.atv
- service: light.turn_off
entity_id:
- light.living_room_main
- group.aux_lights
- group.bedroom_lights
- id: scene_meal_turn_off
alias: 'Scene Meal: Turn off'
trigger:
- platform: state
entity_id: media_player.tv
to: 'off'
- platform: state
entity_id: input_boolean.scene_meal
to: 'on'
for:
minutes: 52
condition:
- condition: state
entity_id: input_boolean.scene_meal
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_meal
- id: rice_cooking_status
alias: 'Rice Cooking: Status'
triggers:
- trigger: event
event_type: yandex_intent
event_data:
text: Что с рисоваркой
actions:
- if:
- condition: state
entity_id: timer.rice_cooking
state: active
then:
- action: timer.pause
entity_id: timer.rice_cooking
- action: timer.start
entity_id: timer.rice_cooking
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{% if is_state('timer.rice_cooking', 'idle') %}\n Рисоварка не запущена\n\
{% else %}\n Осталось примерно {{ state_attr('timer.rice_cooking', 'remaining').split(':')[1]\
\ }} мин. до полной готовности\n{% endif %}\n"
- id: rice_almost_ready_alert
alias: Rice almost ready alert
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.rice_almost_ready
conditions:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
actions:
- action: script.yandex_station_tts
data:
target: all
type: attention
text: "{{ [\n 'рис почти готов',\n 'рис на подходе, давай накрывать стол',\n\
\ 'пахнет рисом на всю кухню, он почти готов',\n ]|random\n}}\n"
- id: scene_movie_turn_on
alias: 'Scene Movie: Turn on'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Посмотрим кино
action:
- if:
- condition: state
entity_id: binary_sensor.living_room_balcony_door
state: 'on'
then:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Давай, только закрой дверь на балкон
- condition: state
entity_id: binary_sensor.living_room_balcony_door
state: 'off'
- if:
- condition: state
entity_id: binary_sensor.evening_time
state: 'off'
then:
- service: cover.close_cover
entity_id:
- cover.bedroom
- cover.workshop
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 23
rgb_color:
- 215
- 150
- 255
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 14
- service: cover.close_cover
entity_id: cover.living_room
- if:
- condition: state
entity_id: media_player.tv
state: 'off'
then:
- service: media_player.turn_on
entity_id:
- media_player.tv
- media_player.atv
- service: light.turn_off
entity_id:
- group.bedroom_lights
- group.path_lights
- group.workshop_lights
- light.entrance
- light.hallway
- light.wardrobe
- service: input_boolean.turn_on
entity_id: input_boolean.scene_movie
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Приятного просмотра!
- service: script.yandex_station_command
data:
target: media_player.living_room_station
command: выключи часы
- action: select.select_option
entity_id: select.avr_display_brightness
data:
option: Low
- wait_for_trigger:
- platform: state
entity_id: media_player.atv
to:
- standby
- idle
timeout:
seconds: 5
continue_on_timeout: true
- if:
- condition: state
entity_id: media_player.atv
state:
- standby
- idle
then:
- service: media_player.select_source
target:
entity_id: media_player.atv
data:
source: Plex
- id: scene_movie_turn_off
alias: 'Scene Movie: Turn off'
trigger:
- platform: event
id: yandex_intent
event_type: yandex_intent
event_data:
text: Просмотр окончен
- platform: state
entity_id: media_player.tv
to: 'off'
- platform: state
entity_id: media_player.atv
from:
- playing
- paused
to: standby
- platform: state
entity_id: media_player.atv
attribute: app_id
from: com.plexapp.plex
condition:
- condition: state
entity_id: input_boolean.scene_movie
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_movie
- if:
- condition: state
entity_id: binary_sensor.evening_time
state: 'off'
then:
- service: cover.open_cover
entity_id:
- cover.bedroom
- cover.living_room
- cover.workshop
- if:
- condition: numeric_state
entity_id: sensor.illuminance_south_side
below: 500
then:
- service: light.turn_on
entity_id: light.living_room_tv
data:
brightness_pct: 45
transition: 5
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 23
color_temp_kelvin: 3400
transition: 5
- service: script.yandex_station_command
data:
target: media_player.living_room_station
command: включи часы
- action: select.select_option
entity_id: select.avr_display_brightness
data:
option: High
- id: scene_movie_playing
alias: 'Scene Movie: Playing'
trigger:
- platform: state
entity_id: media_player.atv
to: playing
condition:
- condition: state
entity_id: input_boolean.scene_movie
state: 'on'
- condition: state
entity_id: light.living_room_tv
state: 'on'
- condition: state
entity_id: light.living_room_tv
attribute: brightness
state: '115'
action:
- service: light.turn_off
entity_id:
- light.living_room_tv
- light.living_room_backlight
data:
transition: 5
- id: scene_movie_pause
alias: 'Scene Movie: Pause'
trigger:
- platform: state
entity_id: media_player.atv
from: playing
to: paused
condition:
- condition: state
entity_id: input_boolean.scene_movie
state: 'on'
- condition: template
value_template: "{{ (now() - state_attr('automation.scene_movie_pause',\n \
\ 'last_triggered')|default(now() - timedelta(days=1), true)).seconds\
\ > 30 }}\n"
action:
- service: light.turn_on
entity_id: light.living_room_backlight
data:
brightness_pct: 30
rgb_color:
- 255
- 68
- 71
- id: scene_movie_resume
alias: 'Scene Movie: Resume'
trigger:
- platform: state
entity_id: media_player.atv
to: playing
condition:
- condition: state
entity_id: input_boolean.scene_movie
state: 'on'
action:
- service: light.turn_off
entity_id: group.home_lights
- id: scene_overnight_guests_turn_off
alias: 'Scene Overnight Guests: Turn off'
trigger:
- platform: state
entity_id: input_boolean.scene_overnight_guests
to: 'on'
for:
hours: 14
condition:
- condition: state
entity_id: input_boolean.scene_overnight_guests
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_overnight_guests
- id: bathroom_path_light_turn_on_night
alias: 'Bathroom Path Light: Turn on (night)'
trigger:
- platform: state
entity_id:
- binary_sensor.bathroom_motion
- binary_sensor.hallway_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id:
- group.bathroom_path_lights
- input_boolean.scene_waking_up
state: 'off'
action:
- service: light.turn_on
entity_id:
- light.bathroom_sink_path
- light.bathroom_toilet_path
data:
rgbw_color:
- 255
- 0
- 0
- 0
brightness_pct: 100
- id: bathroom_path_light_turn_off
alias: 'Bathroom Path Light: Turn off'
trigger:
- id: no_occupancy_1
platform: state
entity_id: binary_sensor.bathroom_occupancy
from: 'on'
to: 'off'
for:
minutes: 1
- id: no_occupancy_10
platform: state
entity_id: binary_sensor.bathroom_occupancy
from: 'on'
to: 'off'
for:
minutes: 10
- id: no_motion
platform: state
entity_id: binary_sensor.bathroom_motion
from: 'on'
to: 'off'
for:
hours: 1
condition:
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.bathroom_light_control
- group.bathroom_path_lights
state: 'on'
- condition: or
conditions:
- condition: trigger
id: no_motion
- condition: state
entity_id: binary_sensor.bathroom_occupancy
state:
- 'on'
- 'off'
action:
- service: light.turn_off
entity_id: group.bathroom_path_lights
- id: hallway_path_light_turn_on_day
alias: 'Hallway Path Light: Turn on (day)'
trigger:
- platform: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
to: 'on'
- platform: state
entity_id:
- light.entrance
- light.hallway
from: 'on'
to: 'off'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.illuminance_south_side
below: 200
- condition: state
entity_id: cover.living_room
state: closed
- condition: state
entity_id:
- light.hallway_path
- light.entrance
- light.hallway
state: 'off'
action:
- if:
- condition: template
value_template: '{{ states(''light.xmas_hallway_wall'') not in [''unavailable'',
''unknown''] }}
'
then:
- service: light.turn_on
entity_id: light.hallway_path
data:
brightness_pct: 56
rgbw_color:
- 255
- 105
- 0
- 18
else:
- service: light.turn_on
entity_id: light.hallway_path
data:
brightness_pct: 25
rgbw_color:
- 255
- 65
- 0
- 166
- id: hallway_path_light_turn_on_night
alias: 'Hallway Path Light: Turn on (night)'
trigger:
- platform: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.bedroom_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: light.hallway_path
state: 'off'
action:
- service: light.turn_on
entity_id: light.hallway_path
data:
brightness_pct: 3
rgbw_color:
- 255
- 0
- 0
- 0
- id: hallway_path_light_turn_off
alias: 'Hallway Path Light: Turn off'
trigger:
- id: no_motion
platform: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
from: 'on'
to: 'off'
for:
seconds: 30
- platform: state
entity_id:
- light.entrance
- light.hallway
from: 'off'
to: 'on'
- platform: state
entity_id: input_select.home_mode
from: Night
condition:
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
- or:
- not:
- condition: trigger
id: no_motion
- condition: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
state: 'off'
- condition: state
entity_id:
- input_boolean.light_control
- light.hallway_path
state: 'on'
action:
- service: light.turn_off
entity_id: light.hallway_path
- id: kitchen_path_light_turn_on_day
alias: 'Kitchen Path Light: Turn on (day)'
trigger:
- platform: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.illuminance_north_side
below: 150
- condition: state
entity_id: cover.kitchen
state: closed
- condition: state
entity_id:
- group.kitchen_lights
- input_boolean.scene_sleepy_mood
- light.entrance
- light.hallway
- light.kitchen_path
state: 'off'
action:
- service: light.turn_on
entity_id: light.kitchen_path
data:
brightness_pct: 40
rgbw_color:
- 255
- 65
- 0
- 133
- id: kitchen_path_light_turn_on_night
alias: 'Kitchen Path Light: Turn on (night)'
trigger:
- platform: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
- binary_sensor.kitchen_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Night
- condition: state
entity_id: light.kitchen_path
state: 'off'
action:
- service: light.turn_on
entity_id: light.kitchen_path
data:
brightness_pct: 20
rgbw_color:
- 255
- 0
- 0
- 0
- id: kitchen_path_light_turn_off
alias: 'Kitchen Path Light: Turn off'
trigger:
- id: no_motion
platform: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
- binary_sensor.kitchen_occupancy
from: 'on'
to: 'off'
for:
minutes: 2
- platform: state
entity_id: group.kitchen_lights
from: 'off'
to: 'on'
- platform: state
entity_id: input_select.home_mode
from: Night
condition:
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'off'
- or:
- not:
- condition: trigger
id: no_motion
- condition: state
entity_id:
- binary_sensor.hallway_motion
- binary_sensor.entrance_motion
- binary_sensor.kitchen_occupancy
state: 'off'
- condition: state
entity_id:
- input_boolean.light_control
- light.kitchen_path
state: 'on'
action:
- service: light.turn_off
entity_id: light.kitchen_path
- id: Pills taken
alias: Pills taken
mode: single
max_exceeded: silent
trigger:
- trigger: device
domain: mqtt
device_id: 9be5a240d99a0f8b0fc13585cda78fba
type: action
subtype: single
- trigger: device
domain: mqtt
device_id: 9be5a240d99a0f8b0fc13585cda78fba
type: action
subtype: double
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.pills_takes
data:
datetime: '{{ now().strftime("%Y-%m-%d %H:%M:%S") }}'
- service: script.yandex_station_tts
data:
target: media_player.kitchen_station
text: '
'
volume: 0.4
- id: porch_light_turn_on_front_door
alias: 'Porch Light: Turn on (front door)'
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id:
- light.porch
- light.porch_path_light
state: 'off'
action:
- if:
- condition: state
entity_id: input_select.home_mode
state: Night
then:
- service: light.turn_on
entity_id: light.porch_path_light
data:
rgbw_color:
- 255
- 0
- 0
- 0
brightness_pct: 45
else:
- service: light.turn_on
entity_id: light.porch
- id: porch_light_turn_on
alias: 'Porch Light: Turn on'
trigger:
- platform: state
entity_id:
- binary_sensor.porch_motion
- binary_sensor.porch_door
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id:
- light.porch
- light.porch_path_light
state: 'off'
action:
- service: light.turn_on
entity_id: light.porch
- id: porch_light_turn_off
alias: 'Porch Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.porch_motion
to: 'off'
for:
minutes: 10
- platform: state
entity_id: binary_sensor.porch_motion
to: 'off'
for:
minutes: 20
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id:
- light.porch
- light.porch_path_light
match: any
state: 'on'
action:
- service: light.turn_off
entity_id:
- light.porch
- light.porch_path_light
- id: living_room_heater_turn_off
alias: 'Living Room Heater: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.anyone_home
from: 'on'
to: 'off'
- platform: state
entity_id: input_boolean.scene_sleepy_mood
from: 'off'
to: 'on'
- platform: state
entity_id: input_select.home_mode
from: Day
- platform: numeric_state
entity_id: sensor.living_room_temperature
above: 25.5
- platform: state
entity_id:
- input_boolean.living_room_airing_warm
- input_boolean.living_room_airing_cold
from: 'off'
to: 'on'
- platform: state
entity_id: switch.ironing_board_socket
to: 'on'
- platform: numeric_state
entity_id: sensor.sockets_power_supply_power
above: 3600
condition:
- condition: state
entity_id: switch.living_room_heater
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.living_room_heater
- id: living_room_heater_turn_off_protect
alias: 'Living Room Heater: Turn off (protect)'
trigger:
- platform: state
entity_id: switch.living_room_heater
to: 'on'
condition:
- condition: state
entity_id: switch.ironing_board_socket
state: 'on'
action:
- action: switch.turn_off
entity_id: switch.living_room_heater
- id: living_room_heater_turn_off_idle
alias: 'Living Room Heater: Turn off (idle)'
trigger:
- platform: state
entity_id: switch.living_room_heater
to: 'on'
for:
hours: 6
- platform: state
entity_id: switch.living_room_heater
to: 'on'
for:
hours: 7
condition:
- condition: state
entity_id: switch.living_room_heater
state: 'on'
- condition: numeric_state
entity_id: sensor.living_room_temperature
above: 23
action:
- service: switch.turn_off
entity_id: switch.living_room_heater
- id: power_budget_alert
alias: Power Budget Alert
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id:
- sensor.cb_power_supply_power
- sensor.sockets_power_supply_power
condition:
- condition: template
value_template: '{{ trigger.to_state.state|int(0) >= 3700 }}
'
- condition: template
value_template: "{{ (now() - state_attr('automation.power_budget_alert',\n \
\ 'last_triggered')|default(now() - timedelta(days=1), true)).total_seconds()\
\ > 600 }}\n"
action:
- service: notify.dextor
data:
message: '⚡️ Превышена мощность по {{ trigger.to_state.entity_id }}: {{ trigger.to_state.state
}} Вт.
'
- id: scooter_charging
alias: 'Scooter: Charging'
max_exceeded: silent
trigger:
- platform: numeric_state
entity_id: sensor.scooter_charger_socket_power
above: 30
for:
seconds: 15
action:
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.scooter_charger_socket_power
below: 1
for:
minutes: 1
timeout:
hours: 8
continue_on_timeout: true
- service: switch.turn_off
entity_id: switch.scooter_charger_socket
- id: scooter_charging_socket_turn_off
alias: 'Scooter Charging Socket: Turn off'
trigger:
- platform: state
entity_id: switch.scooter_charger_socket
to: 'on'
for:
hours: 10
- platform: state
entity_id: binary_sensor.porch_smoke
to: 'on'
action:
- service: switch.turn_off
entity_id: switch.scooter_charger_socket
- id: all_left_recently_alert
alias: All left recently alert
trigger:
platform: state
entity_id: binary_sensor.anyone_home
from: 'on'
to: 'off'
for: 00:03:00
condition:
- condition: state
entity_id: lock.front_door
state: unlocked
action:
- service: notify.dextor
data:
message: 🔑 Никого нет дома, а дверь не закрыта. Страшно?
- id: motion_alarm_no_one_home
alias: 'Motion Alarm: No one home'
trigger:
- platform: state
entity_id: binary_sensor.motion_anywhere
from: 'off'
to: 'on'
condition:
- condition: state
entity_id:
- binary_sensor.anyone_home
- binary_sensor.anyone_near_home
state: 'off'
- condition: template
value_template: "{{ (now() - state_attr('automation.motion_alarm_no_one_home',\n\
\ 'last_triggered')|default(now() - timedelta(days=1),\
\ true)).total_seconds() > 600 }}\n"
action:
- service: notify.dextor
data:
message: 👮 Движение дома, хотя там никого нет? Нас грабют! Ну или кормят котиков.
- id: front_door_opened_alert
alias: 'Front Door: Opened alert'
trigger:
- platform: state
entity_id: binary_sensor.front_door
from: 'off'
to: 'on'
for:
minutes: 15
- platform: state
entity_id: binary_sensor.front_door
from: 'off'
to: 'on'
for:
minutes: 30
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: lock.front_door
state: unlocked
action:
- service: script.yandex_station_tts
data:
target: all
type: alert
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Входная дверь не\
\ защелкнута, сходи проверь',\n 'Мы кого-то ждем? Входная дверь не прикрыта',\n\
\ 'Прикрой входную дверь, а то украдут!'\n ]|random\n}}\n"
- id: porch_door_opened_alert
alias: 'Porch Door: Opened alert'
trigger:
- platform: state
entity_id: binary_sensor.porch_door
to: 'on'
for:
hours: 6
- platform: state
entity_id: lock.porch_door
to: unlocked
for:
hours: 6
action:
- service: notify.dextor
data:
message: 🔑 Дверь на крыльцо долго открыта. Это вообще нормально?!
- id: scene_sleepy_mood_turn_on
alias: 'Scene Sleepy Mood: Turn on'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Хочется спать
action:
- service: input_boolean.turn_on
entity_id:
- input_boolean.scene_sleepy_mood
- input_boolean.bedroom_airing_cold
- service: media_player.turn_off
entity_id: media_player.tv
- service: light.turn_on
entity_id:
- light.bedroom_bed
- light.bedroom_moon
data:
rgb_color: "{{ [\n [255, 71, 51],\n [202, 255, 10],\n [10, 255, 173],\n \
\ [10, 255, 243],\n [10, 214, 255],\n [229, 233, 255],\n [133, 10, 255],\n\
\ [173, 10, 255],\n [255, 10, 231],\n]|random }}\n"
brightness_pct: 100
- service: light.turn_on
entity_id:
- light.bedroom_cat
- light.bedroom_string
data:
color_temp_kelvin: 2700
brightness_pct: 12
- delay:
milliseconds: 500
- service: light.turn_on
entity_id:
- light.hallway_path
- light.kitchen_path
data:
rgbw_color: '{{ state_attr(''light.bedroom_bed'', ''rgb_color'')|list + [0]
}}
'
brightness_pct: 15
- service: light.turn_on
entity_id:
- light.bathroom_sink_path
- light.bathroom_toilet_path
data:
rgbw_color: '{{ state_attr(''light.bedroom_bed'', ''rgb_color'')|list + [0]
}}
'
brightness_pct: 75
- service: light.turn_on
entity_id: light.living_room_backlight
data:
rgb_color: '{{ state_attr(''light.bedroom_bed'', ''rgb_color'')|list }}
'
brightness_pct: 40
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 10
- service: light.turn_on
entity_id: light.kitchen_worktop
data:
brightness_pct: 25
- if:
- condition: state
entity_id: light.wardrobe
state: 'on'
then:
- service: light.turn_on
entity_id: light.wardrobe
data:
brightness_pct: 20
- if:
- condition: state
entity_id: binary_sensor.porch_motion
state: 'off'
then:
- service: light.turn_off
entity_id: light.porch
- service: light.turn_off
entity_id:
- group.workshop_lights
- light.bathroom_bathtub
- light.bathroom_mirror
- light.bedroom_main
- light.closet
- light.entrance
- light.hallway
- light.kitchen_main
- light.kitchen_mood
- light.living_room_main
- light.living_room_tv
- service: cover.close_cover
entity_id:
- cover.bedroom
- cover.kitchen
- cover.living_room
- cover.workshop
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ ['Хорошая мысль', 'Готовимся к погружению в мир грёз', 'Ммм, подушка\
\ душистая и одеяло пустишое', 'Постелька уже ждет', 'Пойдём в кроватку',\
\ 'Сон - это хорошо']|random }}.\n{% if states('sensor.chores')|length > 0\
\ %}\n Только не забудь {{ states('sensor.chores') }}\n{% endif %}\n"
- if:
- condition: state
entity_id: climate.bedroom_ac
state:
- 'off'
- heat_cool
- cool
- heat
- dry
- condition: numeric_state
entity_id: sensor.outside_temperature
above: 10
- condition: numeric_state
entity_id: sensor.bedroom_temperature
above: 24
then:
- service: climate.set_temperature
entity_id: climate.bedroom_ac
data:
hvac_mode: cool
temperature: 23.5
- if:
- condition: state
entity_id: lock.front_door
state: unlocked
then:
- service: lock.lock
entity_id: lock.front_door
- if:
- condition: state
entity_id: binary_sensor.porch_door
state: 'off'
- condition: state
entity_id: lock.porch_door
state: unlocked
then:
- service: lock.lock
entity_id: lock.porch_door
- id: scene_sleepy_mood_turn_off
alias: 'Scene Sleepy Mood: Turn off'
trigger:
- platform: state
entity_id: light.bedroom_bed
from: 'on'
to: 'off'
- platform: state
entity_id:
- light.bedroom_main
- light.living_room_main
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.scene_sleepy_mood
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_sleepy_mood
- id: smoke_detected
alias: 'Smoke: Detected'
trigger:
- platform: state
entity_id:
- binary_sensor.kitchen_smoke
- binary_sensor.hallway_smoke
- binary_sensor.porch_smoke
from: 'off'
to: 'on'
- platform: state
id: not_a_drill
entity_id:
- binary_sensor.kitchen_smoke
- binary_sensor.hallway_smoke
- binary_sensor.porch_smoke
from: 'off'
to: 'on'
for:
minutes: 1
action:
- service: notify.mobile_app_misaka
data:
message: '🚨 Обнаружено задымление {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
data:
push:
sound:
name: sms-received2.caf
critical: 1
volume: 1
continue_on_error: true
- service: notify.dextor
data:
message: '🚨 Обнаружено задымление {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
continue_on_error: true
- id: smoke_resolved
alias: 'Smoke: Resolved'
trigger:
- platform: state
entity_id:
- binary_sensor.kitchen_smoke
- binary_sensor.hallway_smoke
- binary_sensor.porch_smoke
from: 'on'
to: 'off'
action:
- service: notify.dextor
data:
message: '🎉 Устранено задымление {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
- id: kitchen_status_light_update
alias: 'Kitchen: Status light update'
mode: queued
trigger:
- platform: state
entity_id:
- binary_sensor.anyone_home
- binary_sensor.freezer_door
- binary_sensor.fridge_door
- binary_sensor.time_to_take_pills
- input_select.home_mode
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.fridge_door
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.kitchen_status
data:
brightness_pct: 50
rgbw_color:
- 7
- 44
- 255
- 0
effect: None
transition: 0.5
- conditions:
- condition: state
entity_id: binary_sensor.freezer_door
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.kitchen_status
data:
brightness_pct: 50
rgbw_color:
- 255
- 110
- 0
- 0
effect: None
transition: 0.5
- conditions:
- condition: state
entity_id:
- binary_sensor.time_to_take_pills
- binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
sequence:
- service: light.turn_on
entity_id: light.kitchen_status
data:
brightness_pct: 100
rgbw_color:
- 252
- 0
- 181
- 0
effect: pulse
transition: 2
default:
- service: light.turn_off
entity_id: light.kitchen_status
data:
transition: 0.5
- id: living_room_tv_status_light_update
alias: 'Living Room TV Status Light: Update'
mode: queued
trigger:
- platform: state
entity_id:
- binary_sensor.anyone_home
- binary_sensor.humidifier_cleanup_notice
- input_boolean.scene_movie
- input_select.dryer_status
- input_select.home_mode
- input_select.washing_machine_status
- sensor.living_room_humidifier_water_level
- sensor.living_room_humidifier_water_tank_level
- platform: time_pattern
minutes: /10
- platform: event
event_type: living_room_tv_status_light_ack_flash_done
action:
- if:
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_boolean.scene_movie
state: 'off'
then:
- choose:
- conditions:
- condition: state
entity_id:
- input_select.washing_machine_status
- input_select.dryer_status
state: Done
match: any
sequence:
- service: light.turn_on
entity_id:
- light.living_room_tv_status_left
- light.living_room_tv_status_right
data:
brightness_pct: 100
rgb_color:
- 0
- 225
- 255
- conditions:
- or:
- condition: state
entity_id: binary_sensor.humidifier_cleanup_notice
state: 'on'
- and:
- condition: state
entity_id: input_boolean.living_room_humidifier_control
state: 'on'
- condition: state
entity_id: humidifier.living_room_humidifier
state:
- 'on'
- 'off'
- or:
- and:
- condition: numeric_state
entity_id: sensor.living_room_humidifier_water_level
below: 35
above: 0
- condition: numeric_state
entity_id: sensor.living_room_humidifier_water_tank_level
below: 15
sequence:
- if:
- condition: state
entity_id: binary_sensor.humidifier_cleanup_notice
state: 'on'
then:
- service: light.turn_on
entity_id: light.living_room_tv_status_left
data:
brightness_pct: 25
rgb_color:
- 255
- 36
- 0
else:
- service: light.turn_on
entity_id: light.living_room_tv_status_left
data:
brightness_pct: 25
rgb_color:
- 255
- 110
- 0
- if:
- condition: state
entity_id: input_boolean.living_room_humidifier_control
state: 'on'
- condition: state
entity_id: humidifier.living_room_humidifier
state:
- 'on'
- 'off'
- or:
- condition: numeric_state
entity_id: sensor.living_room_humidifier_water_level
below: 35
- condition: numeric_state
entity_id: sensor.living_room_humidifier_water_tank_level
below: 15
then:
- service: light.turn_on
entity_id: light.living_room_tv_status_right
data:
brightness_pct: 25
rgb_color:
- 255
- 110
- 0
default:
- if:
- condition: state
entity_id:
- light.living_room_tv_status_left
- light.living_room_tv_status_right
state: 'on'
match: any
then:
- service: light.turn_off
entity_id:
- light.living_room_tv_status_left
- light.living_room_tv_status_right
else:
- if:
- condition: state
entity_id:
- light.living_room_tv_status_left
- light.living_room_tv_status_right
state: 'on'
match: any
then:
- service: light.turn_off
entity_id:
- light.living_room_tv_status_left
- light.living_room_tv_status_right
- id: stove_status_update
alias: Stove Status Update
trigger:
- platform: state
entity_id: sensor.kitchen_stove_power
condition:
- condition: template
value_template: '{{ trigger.to_state.state|int(0) >= 200 }}
'
action:
- service: timer.start
entity_id: timer.stove_running
- id: tuya_reload
alias: Tuya reload
trigger:
- platform: event
event_type: system_log_event
event_data:
level: ERROR
name: tuya_iot
condition:
- condition: template
value_template: '{{ ''error while get mqtt config'' in trigger.event.data.message[0]
}}'
action:
- service: logbook.log
data:
name: Tuya
message: reloaded
- delay:
seconds: 20
- service: homeassistant.reload_config_entry
data:
entry_id: 96e5c6dadc086fb3268126198c95a21d
- id: tv_warming_up
alias: 'TV: Warming up'
trigger:
- trigger: state
entity_id: media_player.tv
from: 'off'
to: 'on'
action:
- action: timer.start
entity_id: timer.tv_warming_up
- id: tv_switch_to_atv
alias: 'TV: Switch to ATV'
trigger:
- trigger: state
entity_id: switch.ps5_power
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: media_player.tv
state: 'on'
- condition: state
entity_id: media_player.tv
attribute: source
state: PS5
action:
- action: media_player.select_source
entity_id: media_player.tv
data:
source: ATV
- delay:
seconds: 2
- action: remote.send_command
entity_id: remote.atv
data:
command: wakeup
- delay:
seconds: 5
- action: remote.send_command
entity_id: remote.atv
data:
command: screensaver
- id: tv_switch_to_ps5
alias: 'TV: Switch to PS5'
max_exceeded: silent
trigger:
- trigger: state
entity_id: media_player.tv
from: 'off'
to: 'on'
for:
seconds: 1
- trigger: state
entity_id: switch.ps5_power
from: 'off'
to: 'on'
for:
seconds: 20
- trigger: event
event_type: call_service
event_data:
domain: switch
service: turn_on
service_data:
entity_id: switch.ps5_power
action:
- if:
- condition: state
entity_id: timer.tv_warming_up
state: active
then:
- wait_for_trigger:
- platform: state
entity_id: timer.tv_warming_up
to: idle
timeout:
seconds: 25
continue_on_timeout: true
- condition: state
entity_id:
- media_player.tv
- switch.ps5_power
state: 'on'
- service: media_player.select_source
entity_id: media_player.living_room_tv_base
data:
source: PS5
- id: tv_set_volume_ps5
alias: 'TV: Set volume (PS5)'
trigger:
- platform: state
entity_id: media_player.tv
attribute: source
to: PS5
for:
seconds: 8
condition:
- condition: template
value_template: '{{ state_attr(''media_player.tv'', ''volume_level'')|float(0)
>= 0.41 }}
'
action:
- if:
- condition: state
entity_id: timer.tv_warming_up
state: active
then:
- wait_for_trigger:
- trigger: state
entity_id: timer.tv_warming_up
to: idle
timeout:
minutes: 1
continue_on_timeout: false
- condition: state
entity_id: switch.avr_power
state: 'on'
- service: media_player.volume_set
entity_id: media_player.tv
data:
volume_level: 0.39
- id: ups_status_alert
alias: 'UPS Status: Alert'
trigger:
- platform: state
entity_id: sensor.ups_status
not_from: unavailable
not_to: unavailable
- platform: state
entity_id: sensor.ups_status
not_from: unavailable
not_to: unavailable
for:
minutes: 5
condition:
- not:
- condition: template
value_template: '{{ ''Online'' in trigger.from_state.state and ''Online'' in
trigger.to_state.state }}
'
action:
- service: notify.dextor
data:
message: '⚡️ Изменён режим работы ИБП: {{ trigger.to_state.state }}
'
- id: home_mode_set_vacation
alias: 'Home Mode: Set Vacation'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Включи режим отпуска
action:
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Vacation
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: Дом переключен в режим отпуск, буду скучать по вам
- id: home_mode_to_vacation
alias: 'Home Mode: To Vacation'
trigger:
platform: state
entity_id: input_select.home_mode
to: Vacation
action:
- service: notify.dextor
data:
message: 🌴 Дом перевёден в режим отпуска
- service: cover.open_cover
entity_id:
- cover.bedroom
- cover.kitchen
- cover.living_room
- id: home_mode_from_vacation
alias: 'Home Mode: From vacation'
trigger:
platform: state
entity_id: input_select.home_mode
from: Vacation
action:
- service: notify.dextor
data:
message: 😟 Дом возвращён из режима отпуска
- id: scene_wait_guests_turn_on
alias: 'Scene Wait Guests: Turn on'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Ждём гостей
action:
- service: input_boolean.turn_on
entity_id: input_boolean.scene_wait_guests
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "{{ [\n 'Хорошо, открою им двери когда придут',\n 'Поняла, с нетерпением\
\ ждем',\n 'Отлично, хоть какие-то новые лица'\n ]|random\n}}\n"
- id: scene_wait_guests_turn_on_light
alias: 'Scene Wait Guests: Turn on lights'
trigger:
- platform: state
entity_id: binary_sensor.front_door
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.scene_wait_guests
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: light.entrance
state: 'off'
action:
- service: light.turn_on
entity_id: light.entrance
- id: scene_wait_guests_turn_off
alias: 'Scene Wait Guests: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.front_door
from: 'off'
to: 'on'
- platform: state
entity_id: input_boolean.scene_wait_guests
to: 'on'
for:
hours: 1
condition:
- condition: state
entity_id: input_boolean.scene_wait_guests
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_wait_guests
- id: scene_waking_up_turned_on
alias: 'Scene Waking up: Turned on'
trigger:
- platform: state
entity_id: input_boolean.scene_waking_up
to: 'on'
action:
- service: light.turn_on
entity_id: light.bathroom_main
data:
brightness_pct: 22
- service: light.turn_off
entity_id: group.bathroom_path_lights
- id: scene_waking_up_turn_off
alias: 'Scene Waking up: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: 'on'
- platform: state
entity_id: input_select.home_mode
from: Night
- platform: state
entity_id: input_boolean.scene_waking_up
to: 'on'
for:
hours: 2
condition:
- condition: state
entity_id: input_boolean.scene_waking_up
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.scene_waking_up
- id: scene_waking_up_turn_off_porch_door
alias: 'Scene Waking up: Turn off (porch door)'
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: 'on'
condition:
- condition: state
entity_id: input_boolean.scene_waking_up
state: 'on'
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.porch_door
to: 'off'
timeout:
minutes: 3
- service: input_boolean.turn_off
entity_id: input_boolean.scene_waking_up
- id: wardrobe_light_turn_on
alias: 'Wardrobe Light: Turn on'
trigger:
- platform: state
entity_id: binary_sensor.wardrobe_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.wardrobe_motion
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.light_control
state: 'on'
- condition: state
entity_id: light.wardrobe
state: 'off'
action:
- service: light.turn_on
entity_id: light.wardrobe
data:
brightness_pct: "{%- if is_state('binary_sensor.dim_light', 'on') -%}\n 20\n\
{%- elif is_state('input_select.home_mode', 'Night') -%}\n 5\n{%- else -%}\n\
\ 100\n{%- endif -%}\n"
- id: wardrobe_light_turn_off
alias: 'Wardorbe Light: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.wardrobe_door
to: 'off'
for:
milliseconds: 500
- id: no_motion
platform: state
entity_id: binary_sensor.wardrobe_motion
from: 'on'
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.wardrobe_light_control
- light.wardrobe
state: 'on'
action:
- if:
- condition: trigger
id: no_motion
then:
- service: light.turn_off
entity_id: light.wardrobe
data:
transition: 10
else:
- service: light.turn_off
entity_id: light.wardrobe
- id: wardrobe_light_control_turn_on
alias: 'Wardrobe Light Control: Turn on'
trigger:
- platform: state
entity_id: light.wardrobe
to: 'off'
condition:
- condition: state
entity_id: input_boolean.wardrobe_light_control
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.wardrobe_light_control
- id: wardrobe_light_control_turn_off
alias: 'Wardrobe Light Control: Turn off'
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Не выключай свет в гардеробе
action:
- service: input_boolean.turn_off
entity_id: input_boolean.wardrobe_light_control
- id: washing_machine_cycle
alias: 'Washing Machine: Cycle'
max_exceeded: silent
trigger:
platform: numeric_state
entity_id: sensor.washing_machine_power
above: 5
for:
seconds: 15
condition:
- condition: state
entity_id: input_select.washing_machine_status
state: Idle
action:
- service: input_select.select_option
entity_id: input_select.washing_machine_status
data:
option: Running
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.washing_machine_power
below: 1
for:
minutes: 2
timeout:
hours: 4
continue_on_timeout: true
- condition: state
entity_id: input_select.washing_machine_status
state: Running
- service: input_select.select_option
entity_id: input_select.washing_machine_status
data:
option: Done
- id: washing_machine_door_open
alias: 'Washing Machine: Door open'
trigger:
platform: state
entity_id: binary_sensor.washing_machine_door
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_select.washing_machine_status
state:
- Running
- Done
action:
- service: input_select.select_option
entity_id: input_select.washing_machine_status
data:
option: Idle
- id: washing_machine_idle
alias: 'Washing Machine: Idle'
trigger:
platform: state
entity_id: input_select.washing_machine_status
to: Idle
action:
- service: input_number.set_value
entity_id: input_number.washing_machine_done_alert_count
data:
value: 0
- id: washing_machine_done_alert
alias: 'Washing Machine: Done alert'
trigger:
- platform: time_pattern
minutes: /32
- platform: state
entity_id: input_select.washing_machine_status
from: Running
to: Done
condition:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'on'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: input_select.washing_machine_status
state: Done
- condition: numeric_state
entity_id: input_number.washing_machine_done_alert_count
below: 4
- condition: template
value_template: '{{ (now() - states.input_number.washing_machine_done_alert_count.last_changed).total_seconds()
> 900 }}
'
action:
- wait_template: '{{ not is_state(''media_player.atv'', [''playing'', ''pause''])
}}
'
timeout:
minutes: 28
continue_on_timeout: true
- service: script.yandex_station_tts
data:
target: all
type: attention
text: "{{ states.sensor.alert_greeting.state }} {{ [\n 'Стиральная машина\
\ ждёт тебя, в ней что-то есть.',\n 'Стиральная машина закончила, пора\
\ достать из неё бельё.',\n 'Стиральная машина ждет тебя, у неё для тебя\
\ есть подарок.',\n ]|random\n}} {% if states('input_number.washing_machine_done_alert_count')|int\
\ == 2 %}\n Если я ошиблась - закрой дверцу машины и открой снова.\n{% endif\
\ %} {% if states('input_number.washing_machine_done_alert_count')|int ==\
\ 3 %}\n Это последнее предупреждение! Мокрое белье останется там навсегда!\n\
{% endif %}\n"
- service: input_number.increment
entity_id: input_number.washing_machine_done_alert_count
- id: washing_machine_status
alias: 'Washing Machine: Status'
trigger:
platform: event
event_type: yandex_intent
event_data:
text: Что со стиральной машиной
action:
- service: script.yandex_station_tts
data:
target: '{{ trigger.event.data.get(''entity_id'', ''last'') }}
'
text: "Стиралка {% if is_state('input_select.washing_machine_status', 'Running')\
\ %}\n делает вжух-вжух. Скоро вещи будут чистыми и пахнуть порошочком\n\
{% elif is_state('input_select.washing_machine_status', 'Done') %}\n закончила,\
\ доставай быстрее из неё белье и закидывай новое\n{% elif is_state('input_select.washing_machine_status',\
\ 'Idle') %}\n простаивает без дела. А как там корзина с грязным бельём?\n\
{% endif %}\n"
- id: water_leak_detected
alias: 'Water leak: Detected'
trigger:
- platform: state
entity_id:
- binary_sensor.kitchen_water_leak
- binary_sensor.closet_water_leak
- binary_sensor.bathroom_washing_machine_water_leak
- binary_sensor.bathroom_sink_water_leak
- binary_sensor.bathroom_toilet_water_leak
- binary_sensor.bathroom_hot_water_meter_leak
- binary_sensor.bathroom_cold_water_meter_leak
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.kitchen_water_leak
- binary_sensor.closet_water_leak
- binary_sensor.bathroom_washing_machine_water_leak
- binary_sensor.bathroom_sink_water_leak
- binary_sensor.bathroom_toilet_water_leak
- binary_sensor.bathroom_hot_water_meter_leak
- binary_sensor.bathroom_cold_water_meter_leak
from: 'off'
to: 'on'
for:
minutes: 5
action:
- choose:
- conditions:
- condition: template
value_template: '{{ area_name(trigger.entity_id) == ''Kitchen'' }}
'
sequence:
- service: switch.turn_off
entity_id:
- switch.kitchen_hot_water_valve
- switch.kitchen_cold_water_valve
- switch.dishwasher_socket
continue_on_error: true
- conditions:
- condition: template
value_template: '{{ area_name(trigger.entity_id) in (''Bathroom'', ''Closet'')
}}
'
sequence:
- service: switch.turn_off
entity_id:
- switch.bathroom_hot_water_valve
- switch.bathroom_cold_water_valve
- switch.washing_machine_socket
- switch.water_heater_socket
continue_on_error: true
default:
- service: switch.turn_off
entity_id:
- switch.kitchen_hot_water_valve
- switch.kitchen_cold_water_valve
- switch.bathroom_hot_water_valve
- switch.bathroom_cold_water_valve
- switch.dishwasher_socket
- switch.washing_machine_socket
- switch.water_heater_socket
continue_on_error: true
- service: notify.mobile_app_misaka
data:
message: '🚨 Обнаружена протечка {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
data:
push:
sound:
name: sms-received2.caf
critical: 1
volume: 1
continue_on_error: true
- service: notify.dextor
data:
message: '🚨 Обнаружена протечка {{ state_attr(trigger.from_state.entity_id,
''alert_text'')|default('''', True) }}
'
continue_on_error: true
- service: script.yandex_station_tts
data:
target: all
type: alert
text: 'Обнаружена протечка {{ state_attr(trigger.from_state.entity_id, ''alert_text'')|default('''',
True) }}. Повторяю. Обнаружена протечка!
'
- delay:
seconds: 25
- service: script.yandex_station_tts
data:
target: all
type: attention
text: 'Если протечки нет, скажи Алиса, включи воду или нажми кнопки на вентилях
вручную.
'
- id: water_leak_resolved
alias: 'Water leak: Resolved'
trigger:
- platform: state
entity_id:
- binary_sensor.kitchen_water_leak
- binary_sensor.closet_water_leak
- binary_sensor.bathroom_washing_machine_water_leak
- binary_sensor.bathroom_sink_water_leak
- binary_sensor.bathroom_toilet_water_leak
- binary_sensor.bathroom_hot_water_meter_leak
- binary_sensor.bathroom_cold_water_meter_leak
from: 'on'
to: 'off'
action:
- service: notify.dextor
data:
message: '🎉 Устранена протечка {{ state_attr(trigger.from_state.entity_id, ''alert_text'')|default('''',
True) }}
'
- id: water_heater_turn_on
alias: 'Water Heater: Turn on'
trigger:
- platform: state
entity_id:
- input_select.dryer_status
- input_select.washing_machine_status
to:
- Idle
- Done
condition:
- condition: state
entity_id:
- input_boolean.hot_water_supply
- switch.water_heater_socket
state: 'off'
- condition: state
entity_id:
- input_select.dryer_status
- input_select.washing_machine_status
state:
- Idle
- Done
action:
- service: switch.turn_on
entity_id: switch.water_heater_socket
- id: water_heater_turn_off
alias: 'Water Heater: Turn off'
trigger:
- platform: state
entity_id: switch.water_heater_socket
to: 'on'
- platform: time_pattern
minutes: /1
condition:
- or:
- condition: state
entity_id:
- switch.water_heater_socket
- input_boolean.hot_water_supply
state: 'on'
- condition: state
entity_id:
- input_select.dryer_status
- input_select.washing_machine_status
state: Running
match: any
- condition: state
entity_id: switch.water_heater_socket
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.water_heater_socket
- id: scene_welcome_home_on
alias: 'Scene Welcome Home: Turn on'
trigger:
- platform: state
entity_id: binary_sensor.entrance_motion
to: 'on'
condition:
- condition: template
value_template: '{% set no_one_home_seconds = (as_timestamp(now()) - state_attr(''input_datetime.anyone_home_last_seen'',
''timestamp''))|int %} {{ no_one_home_seconds > (5 * 60) }}
'
- condition: state
entity_id: input_select.home_mode
state:
- Day
- Vacation
- condition: state
entity_id: timer.front_door_unlocked
state: active
- condition: state
entity_id: timer.scene_welcome_home
state: idle
action:
- service: timer.start
entity_id: timer.scene_welcome_home
- service: timer.cancel
entity_id: timer.front_door_unlocked
- service: light.turn_on
entity_id: light.entrance
- if:
- condition: state
entity_id: input_select.home_mode
state: Vacation
then:
- if:
- condition: state
entity_id: binary_sensor.anyone_home
state: 'off'
then:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.anyone_home
to: 'on'
timeout:
minutes: 7
continue_on_timeout: false
- service: input_select.select_option
entity_id: input_select.home_mode
data:
option: Day
- service: script.yandex_station_tts
data:
target: media_player.kitchen_station
type: announce
text: " {% set v = [\n 'Отдых\
\ - хорошо, но дома лучше. С возвращением!',\n 'Добро пожаловать домой,\
\ я вас заждалась!',\n] %} {{ v|random }}\n"
else:
- service: script.yandex_station_tts
data:
target: media_player.kitchen_station
type: announce
text: " {% set v = [\n\
\ '%s с возвращением!' % (states('sensor.alert_greeting')),\n '%s наконец-то\
\ %s дома' % (states('sensor.alert_greeting'), states('sensor.person_pronoun_nom')),\n\
\ '%s как хорошо, когда %s снова дома' % (states('sensor.alert_greeting'),\
\ states('sensor.person_pronoun_nom')),\n '%s добро пожаловать домой' %\
\ (states('sensor.alert_greeting')),\n] %} {{ v|random }}\n"
- id: workshop_ac_turn_off
alias: 'Workshop AC: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.anyone_home
from: 'on'
to: 'off'
for:
minutes: 40
- platform: state
entity_id: input_boolean.scene_sleepy_mood
from: 'off'
to: 'on'
- platform: state
entity_id: input_select.home_mode
from: Day
- platform: state
entity_id: climate.workshop_ac
to:
- heat_cool
- cool
- heat
- dry
for:
hours: 12
condition:
- condition: state
entity_id: climate.workshop_ac
state:
- heat_cool
- cool
- heat
- dry
action:
- service: climate.turn_off
entity_id: climate.workshop_ac
- id: workshop_ac_turn_off_protect
alias: 'Workshop AC: Turn off (protect)'
trigger:
- platform: time_pattern
seconds: /30
- platform: state
entity_id:
- climate.workshop_ac
- input_select.washing_machine_status
condition:
- condition: or
conditions:
- and:
- condition: state
entity_id: input_select.washing_machine_status
state: Running
- condition: state
entity_id: climate.bedroom_ac
state:
- heat_cool
- cool
- heat
- dry
- condition: numeric_state
entity_id: sensor.outside_temperature
below: -15
- condition: state
entity_id: climate.workshop_ac
state:
- heat_cool
- cool
- heat
- dry
action:
- service: climate.turn_off
entity_id: climate.workshop_ac
- id: xmas_lights_turn_on
alias: 'Xmas Lights: Turn on'
trigger:
- platform: state
entity_id: input_select.home_mode
to: Day
- platform: state
entity_id: timer.scene_welcome_home
to: active
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
action:
- service: light.turn_on
entity_id:
- light.xmas_hallway_tree
- light.xmas_front_door
- light.xmas_kitchen
- id: xmas_lights_turn_off
alias: 'Xmas Lights: Turn off'
trigger:
- platform: state
entity_id: binary_sensor.dim_light
to: 'on'
for:
seconds: 3
- id: bedroom_bed_button_single_press
trigger: device
domain: mqtt
device_id: 620c20157f0cbf8a0249f3f083a531ff
type: action
subtype: single
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
action:
- service: light.turn_off
entity_id:
- light.elka
- light.xmas_living_room_curtains
- light.xmas_hallway_tree
- light.xmas_hallway_wall
- light.xmas_workshop_door
- light.xmas_front_door
- light.xmas_kitchen
- id: xmas_elka_turn_on
alias: 'Xmas Elka Light: Turn on'
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: input_select.home_mode
to: Day
- platform: state
entity_id:
- light.living_room_backlight
- light.living_room_main
- platform: state
entity_id: binary_sensor.evening_time
from: 'off'
to: 'on'
- platform: state
entity_id: timer.scene_welcome_home
to: active
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id: binary_sensor.dim_light
state: 'off'
- condition: template
value_template: '{{ states(''light.elka'') not in [''unavailable'', ''unknown'']
}}
'
action:
- if:
- or:
- condition: state
entity_id: binary_sensor.evening_time
state: 'off'
- condition: state
entity_id: light.living_room_main
state: 'on'
then:
- service: light.turn_on
entity_id: light.elka
data:
brightness_pct: 100
else:
- service: light.turn_on
entity_id: light.elka
data:
brightness_pct: 23
- id: xmas_hallway_light_turn_on
alias: 'Xmas Hallway Light: Turn on'
trigger:
- platform: state
entity_id:
- light.entrance
- light.hallway
from: 'off'
to: 'on'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id:
- light.xmas_hallway_wall
- light.xmas_workshop_door
match: any
state: 'off'
action:
- service: light.turn_on
entity_id:
- light.xmas_hallway_wall
- light.xmas_workshop_door
- id: xmas_hallway_wall_light_turn_on
alias: 'Xmas Hallway Wall Light: Turn on'
trigger:
- platform: state
entity_id: light.hallway_path
from: 'off'
to: 'on'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id:
- binary_sensor.dim_light
- light.xmas_hallway_wall
state: 'off'
action:
- service: light.turn_on
entity_id: light.xmas_hallway_wall
data:
brightness_pct: 100
- id: xmas_hallway_wall_light_turn_off'
alias: 'Xmas Hallway Wall Light: Turn off'
trigger:
- platform: state
entity_id: light.hallway_path
from: 'on'
to: 'off'
for:
seconds: 10
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id: light.xmas_hallway_wall
state: 'on'
- condition: state
entity_id:
- light.hallway
- light.entrance
state: 'off'
action:
- service: light.turn_off
entity_id: light.xmas_hallway_wall
- id: xmas_workshop_door_light_turn_on
alias: 'Xmas Workshop Door Light: Turn on'
trigger:
- platform: state
entity_id: light.hallway_path
from: 'off'
to: 'on'
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id:
- binary_sensor.dim_light
- light.xmas_workshop_door
state: 'off'
action:
- service: light.turn_on
entity_id: light.xmas_workshop_door
- id: xmas_workshop_door_light_turn_off
alias: 'Xmas Workshop Door Light: Turn off'
trigger:
- platform: state
entity_id: light.hallway_path
from: 'on'
to: 'off'
for:
seconds: 10
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: light.xmas_workshop_door
state: 'on'
- condition: state
entity_id:
- light.hallway
- light.entrance
state: 'off'
action:
- service: light.turn_off
entity_id: light.xmas_workshop_door
- id: xmas_living_room_curtains_light_turn_on
alias: 'Xmas Living Room Curtains Light: Turn on'
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id:
- light.living_room_backlight
- light.living_room_main
- platform: state
entity_id: cover.living_room
from: open
to: closed
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: input_select.home_mode
state: Day
- condition: state
entity_id: binary_sensor.dim_light
state: 'off'
- condition: state
entity_id: cover.living_room
state: closed
action:
- delay:
seconds: 2
- condition: state
entity_id: group.living_room_lights
state: 'on'
- if:
- or:
- condition: state
entity_id: light.living_room_main
state: 'on'
- and:
- condition: state
entity_id: light.living_room_backlight
state: 'on'
- condition: numeric_state
entity_id: light.living_room_backlight
attribute: brightness
above: 200
then:
- service: light.turn_on
entity_id: light.xmas_living_room_curtains
data:
brightness_pct: 100
else:
- service: light.turn_on
entity_id: light.xmas_living_room_curtains
data:
brightness_pct: 30
- id: xmas_living_room_curtains_light_turn_off
alias: 'Xmas Living Room Curtains Light: Turn off'
trigger:
- platform: state
entity_id: group.living_room_lights
to: 'off'
- platform: state
entity_id: cover.living_room
to: open
condition:
- condition: state
entity_id:
- input_boolean.light_control
- input_boolean.xmas_lighting
state: 'on'
- condition: state
entity_id: light.xmas_living_room_curtains
state: 'on'
action:
- service: light.turn_off
entity_id: light.xmas_living_room_curtains
- id: yandex_station_busy
alias: 'Yandex Station: Busy'
mode: single
max_exceeded: silent
trigger:
platform: state
entity_id:
- media_player.living_room_station
- media_player.workshop_station
- media_player.bedroom_station
- media_player.kitchen_station
attribute: alice_state
from: LISTENING
to: BUSY
action:
- service: input_text.set_value
entity_id: input_text.yandex_station_last
data:
value: '{{ trigger.entity_id }}'
- id: yandex_station_volume_update
alias: 'Yandex Station: Volume update'
trigger:
- platform: state
entity_id: input_select.home_mode
to:
- Day
- Night
action:
- if:
- condition: template
value_template: '{{ trigger.to_state.state == ''Day'' }}
'
then:
- service: input_number.set_value
entity_id: input_number.yandex_station_alert_volume
data:
value: 0.7
- service: input_number.set_value
entity_id: input_number.yandex_station_attention_volume
data:
value: 0.5
- if:
- condition: template
value_template: '{{ trigger.to_state.state == ''Night'' }}
'
then:
- service: input_number.set_value
entity_id: input_number.yandex_station_alert_volume
data:
value: 0.5
- service: input_number.set_value
entity_id: input_number.yandex_station_attention_volume
data:
value: 0.4
- id: zigbee_device_leave
alias: 'Zigbee: Device leave'
trigger:
platform: mqtt
topic: zigbee2mqtt/bridge/event
payload: device_leave
value_template: '{{ value_json.type }}'
action:
- service: notify.dextor
data:
message: ✂️ Какое-то устройство вывалилось из сети