AutomationDataset/SenMorgan/SenMorgan_automations.yaml

2718 lines
83 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- alias: 3D Printer - Print Done
id: 3d_printer_print_done
triggers:
- trigger: state
entity_id: binary_sensor.octoprint_printing
from: 'on'
to: 'off'
actions:
- action: notify.mobile_app_sm_s901b
data:
title: 3D Printer
message: 🎉 Печать завершена!
- alias: 3D Printer - Print Progress
id: 3d_printer_print_progress
triggers:
- trigger: state
entity_id: sensor.octoprint_job_percentage
conditions:
- condition: template
value_template: "{{ (trigger.to_state.state | int(0)) > 0 and\n ((trigger.to_state.state\
\ | int(0)) != (trigger.from_state.state | int(0))) and\n (trigger.to_state.state\
\ | int(0)) % 10 == 0 }}\n"
actions:
- action: notify.mobile_app_sm_s901b
data_template:
title: 3D Printer
message: 📈 Деталь готова на {{ states('sensor.octoprint_job_percentage') | int(0)
}}%
- alias: 3D Printer - Print Paused
id: 3d_printer_print_paused
triggers:
- trigger: state
entity_id: sensor.octoprint_current_state
from: Printing
to:
- Paused
- Pausing
actions:
- action: notify.mobile_app_sm_s901b
data:
title: ⚠️ 3D Printer
message: Печать приостановлена!
- alias: 3D Printer - Print Resumed
id: 3d_printer_print_resumed
triggers:
- trigger: state
entity_id: sensor.octoprint_current_state
from:
- Paused
- Pausing
to: Printing
actions:
- action: notify.mobile_app_sm_s901b
data:
title: ⚠️ 3D Printer
message: Печать возобновлена
- alias: 3D Printer - Overheated
id: 3d_printer_overheated
triggers:
- trigger: state
entity_id:
- sensor.octoprint_actual_bed_temp
- sensor.octoprint_actual_tool0_temp
conditions:
- or:
- condition: template
value_template: '{{ states(''sensor.octoprint_actual_bed_temp'') | int(0) >
100 }}
'
- condition: template
value_template: '{{ states(''sensor.octoprint_actual_tool0_temp'') | int(0)
> 250 }}
'
actions:
- action: notify.mobile_app_sm_s901b
data:
title: 🌡️ 3D Printer перегрелся!
message: '🛏️ Температура стола: {{ states(''sensor.octoprint_actual_bed_temp'')
}}°C
🔥 Температура хотенда: {{ states(''sensor.octoprint_actual_tool0_temp'') }}°C
'
- alias: 3D Printer - Power On
id: 3d_printer_power_on
mode: restart
triggers:
- trigger: state
entity_id: input_boolean.3d_printer_and_octo_power
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: switch.3d_printer_socket
state: 'off'
actions:
- action: switch.turn_on
entity_id: switch.3d_printer_socket
- alias: 3D Printer - Power Sync
id: 3d_printer_power_sync
mode: single
triggers:
- trigger: state
entity_id: switch.3d_printer_socket
conditions:
- condition: template
value_template: '{{ states(''switch.3d_printer_socket'') != states(''input_boolean.3d_printer_and_octo_power'')
}}
'
- condition: template
value_template: '{{ is_state_attr(''automation.3d_printer_power_off'', ''current'',
0) }}
'
actions:
- if:
- condition: state
entity_id: switch.3d_printer_socket
state: 'on'
then:
- action: input_boolean.turn_on
entity_id: input_boolean.3d_printer_and_octo_power
else:
- action: input_boolean.turn_off
entity_id: input_boolean.3d_printer_and_octo_power
- alias: 3D Printer - Power Off
id: 3d_printer_power_off
mode: restart
triggers:
- trigger: state
entity_id: input_boolean.3d_printer_and_octo_power
from: 'on'
to: 'off'
conditions:
- condition: state
entity_id: switch.3d_printer_socket
state: 'on'
actions:
- if:
- condition: template
value_template: '{{ states(''sensor.octoprint_current_state'') != ''Operational''
}}'
then:
- action: input_boolean.turn_on
entity_id: input_boolean.3d_printer_and_octo_power
- action: notify.mobile_app_sm_s901b
data:
title: ⚠️ 3D Printer
message: 'Невозможно выключить Octoprint сервер в состонии «{{ states(''sensor.octoprint_current_state'')
}}».
Питания НЕ отключено!
'
else:
- action: script.turn_on
entity_id: script.octoprint_shutdown
- wait_template: '{{ states(''sensor.octoprint_current_state'') == ''unavailable''
}}'
timeout: 00:03:00
- if:
- condition: template
value_template: '{{ states(''sensor.octoprint_current_state'') != ''unavailable''
}}'
then:
- action: input_boolean.turn_on
entity_id: input_boolean.3d_printer_and_octo_power
- action: notify.mobile_app_sm_s901b
data:
title: ⚠️ 3D Printer
message: 'Не удалось выключить Octoprint сервер.
Питания НЕ отключено!
'
else:
- action: switch.turn_off
entity_id: switch.3d_printer_socket
- action: input_boolean.turn_off
entity_id: input_boolean.3d_printer_and_octo_power
- alias: Notification Air Quality Bad
id: notification_air_quality_bad
triggers:
- trigger: numeric_state
entity_id: sensor.air_quality_station_iaq
above: 200
for: 00:02:00
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
actions:
- if:
- condition: template
value_template: '{{ not is_state(''media_player.yandex_station_midi'', ''playing'')
}}'
then:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_type: text
media_content_id: "Замечено плохое качество воздуха в доме,\n{% if states('binary_sensor.windows')\
\ == 'off' %}\n советую открыть окно.\n{% else %}\n советую закрыть окно\n\
\ {% if states('binary_sensor.bedroom_window_contact') == 'on' %}\n \
\ в спальне\n {% endif %}\n {% if states('binary_sensor.kitchen_window_contact')\
\ == 'on' %}\n {% if states('binary_sensor.bedroom_window_contact') ==\
\ 'on' %}\n {% if states('binary_sensor.living_room_window_contact')\
\ == 'on' %}\n ,\n {% else %}\n и\n {% endif %}\n\
\ {% endif %}\n на кухне\n {% endif %}\n {% if states('binary_sensor.living_room_window_contact')\
\ == 'on' %}\n {% if states('binary_sensor.bedroom_window_contact') ==\
\ 'on' or states('binary_sensor.kitchen_window_contact') == 'on' %}\n \
\ и\n {% endif %}\n в гостинной.\n {% endif %}\n{% endif %}\n"
- action: notify.mobile_app_sm_s901b
data:
title: 🌬 Качество воздуха
message: 'Качество воздуха в доме ухудшилось и составляет {{ states(''sensor.air_quality_station_iaq'')
}}.
'
- action: automation.turn_on
entity_id:
- automation.notification_air_quality_restored
- automation.notification_air_quality_open_window_greeting
- action: input_datetime.set_datetime
data:
entity_id: input_datetime.air_quality_open_window_greeting_timeout
datetime: '{{ now() + timedelta(minutes=2) }}'
- action: automation.turn_off
entity_id: automation.notification_air_quality_bad
- alias: Notification Air Quality Open Window Greeting
id: notification_air_quality_open_window_greeting
triggers:
- trigger: state
entity_id: binary_sensor.windows
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
actions:
- if:
- condition: template
value_template: '{{ as_timestamp(now()) < as_timestamp(states(''input_datetime.air_quality_open_window_greeting_timeout''),
0) }}'
- condition: template
value_template: '{{ not is_state(''media_player.yandex_station_midi'', ''playing'')
}}'
then:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_type: text
media_content_id: Молодец! Рада, что вы заботитесь о своём здоровье.
- action: automation.turn_off
entity_id: automation.notification_air_quality_open_window_greeting
- alias: Notification Air Quality Restored
id: notification_air_quality_restored
triggers:
- trigger: numeric_state
entity_id: sensor.air_quality_station_iaq
below: 50
for: 00:02:00
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
actions:
- if:
- condition: template
value_template: '{{ not is_state(''media_player.yandex_station_midi'', ''playing'')
}}'
then:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_type: text
media_content_id: Качество воздуха в доме вернулось в норму.
- action: notify.mobile_app_sm_s901b
data:
title: 🌬 Качество воздуха
message: 'Качество воздуха в доме улучшилось и составляет {{ states(''sensor.air_quality_station_iaq'')
}}.
'
- action: automation.turn_on
entity_id: automation.notification_air_quality_bad
- action: automation.turn_off
entity_id:
- automation.notification_air_quality_restored
- automation.notification_air_quality_open_window_greeting
- alias: Alert to TTS Handler
id: alert_to_tts_handler
mode: single
max_exceeded: silent
variables:
alerts_map:
alert.water_leakage_bathroom:
- Обнаружена утечка воды в ванной
- Утечка воды в ванной устранена
alert.water_leakage_kitchen:
- Обнаружена утечка воды на кухне
- Утечка воды на кухне устранена
alert.carbon_monoxide_detected:
- Обнаружена высокая концентрация угарного газа на кухне
- Концентрация угарного газа на кухне вернулась в норму
alert.natural_gas_detected:
- Обнаружена утечка газа на кухне
- Утечка газа на кухне устранена
triggers:
- trigger: state
entity_id:
- alert.water_leakage_bathroom
- alert.water_leakage_kitchen
- alert.carbon_monoxide_detected
- alert.natural_gas_detected
actions:
- if:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''idle''] }}'
then:
- action: notify.mobile_app_sm_s901b
data:
message: TTS
data:
priority: high
channel: alarm_stream_max
media_stream: alarm_stream_max
tts_text: "{% if trigger.to_state.state == 'on' %}\n Внимание! {{ alerts_map[trigger.entity_id][0]\
\ }}!\n{% else %}\n {{ alerts_map[trigger.entity_id][1] }}.\n{% endif\
\ %}\n"
- alias: DCC-EX Enable Power on Sunset
id: dcc_ex_enable_power_on_sunset
triggers:
- trigger: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- trigger: state
entity_id: person.sen
to: home
conditions:
- condition: state
entity_id: person.sen
state: home
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
actions:
- action: switch.turn_on
target:
entity_id:
- switch.ex_commandstation_tracks_power
- switch.loco_sbb_cargo_re_482_coupling
- alias: DCC-EX Layout Lights by Motion Sensor
id: dcc_ex_layout_lights_by_motion_sensor
description: Control train layout lights based on motion sensor
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.kitchen_motion_alarm
conditions:
- condition: state
entity_id: switch.ex_commandstation_tracks_power
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
actions:
- action: switch.turn_{{ "on" if trigger.to_state.state == "on" else "off" }}
entity_id:
- switch.dcc_ex_vossloh_cabin_lights
- switch.loco_sbb_cargo_re_482_inspection_lights
- alias: Guest Mode Reset
id: guest_mode_reset
mode: restart
triggers:
- platform: time
at: input_datetime.guest_mode_disable_time
- platform: homeassistant
event: start
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
- condition: template
value_template: '{{ as_timestamp(now()) >= as_timestamp(states(''input_datetime.guest_mode_disable_time''),
0) }}
'
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.guest_mode
- variables:
action_enable_back_on: '{{ ''action_enable_back_on'' ~ context.id }}'
- action: notify.mobile_app_sm_s901b
data:
title: 👤 Гостевой режим
message: Гостевой режим выключен автоматически в {{ states('sensor.time') }}.
Включить обратно?
data:
actions:
- action: '{{ action_enable_back_on }}'
title: ↻ Включить снова
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_enable_back_on }}'
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_enable_back_on
}}'
then:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.guest_mode
- action: input_datetime.set_datetime
data:
entity_id: input_datetime.guest_mode_disable_time
datetime: '{{ (now().date() + timedelta(days=1)).strftime(''%Y-%m-%d'') }}
09:00:00'
- action: notify.mobile_app_sm_s901b
data:
title: 👤 Гостевой режим
message: Гостевой режим включен снова до 9:00 утра завтрашнего дня
- alias: Notify Yandex Guest Mode Enabled
id: notify_yandex_guest_mode_enabled
trigger:
- platform: state
entity_id: input_boolean.guest_mode
from: 'off'
to: 'on'
action:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Гостевой режим активирован до 9:00 утра завтрашнего дня
media_content_type: text
- alias: Stop Heating by Window Opened
id: stop_heating_by_window_opened
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.windows
from: 'off'
to: 'on'
for: 00:00:10
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.thermostat_active
state: 'on'
action:
- action: timer.cancel
entity_id: timer.pause_heating
- if:
- condition: state
entity_id: timer.heating_quarantine
state: active
then:
- action: timer.cancel
entity_id: timer.heating_quarantine
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: Открыто окно → карантин перед включением отопления отменён
- if:
- condition: state
entity_id: timer.short_heating
state: active
then:
- action: timer.cancel
entity_id: timer.short_heating
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: Открыто окно → кратковременное отопление отменено
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Подогрев квартиры окончен из-за открытого окна
media_content_type: text
- action: script.thermostat_set_eco_mode
data:
message: Открыто окно → переход в режим экономии
- alias: Start Quarantine by Window Closed
id: start_quarantine_by_window_closed
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.windows
from: 'on'
to: 'off'
for: 00:00:10
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
action:
- action: timer.start
entity_id: timer.heating_quarantine
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: Окна закрыты → карантин перед включением отопления начат
- alias: Restore Heating after Quarantine
id: restore_heating_after_quarantine
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.heating_quarantine
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.windows
state: 'off'
action:
- if:
- condition: state
entity_id: timer.pause_heating
state: idle
- or:
- condition: state
entity_id: binary_sensor.people_home
state: 'on'
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
then:
- action: script.thermostat_stop_heating
data:
message: Карантин перед включением отопления окончен → отопление включено
else:
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: Карантин перед включением отопления окончен, но обогрев запрещён →
отопление не включено
- alias: Thermostat Freeze Alert at Night
id: thermostat_freeze_alert_at_night
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.freeze_alert_at_night
from: 'off'
to: 'on'
for: 00:05:00
- trigger: time_pattern
hours: /1
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.freeze_alert_at_night
state: 'on'
- condition: template
value_template: "{{ is_state('binary_sensor.people_home', 'on') or\n is_state('input_boolean.guest_mode',\
\ 'on')}}\n"
actions:
- action: timer.cancel
entity_id:
- timer.heating_quarantine
- timer.short_heating
- timer.pause_heating
- action: script.notify_and_create_persistent_notification
data:
title: ⚠️ Предупреждение
message: Температура упала ниже порога
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: Температура упала ниже порога
- action: notify.mobile_app_sm_s901b
data:
title: 💬 Системное уведомление
message: Термостат был снова включен в {{ states('sensor.time') }}, чтобы вы
не замёрзли
- action: script.thermostat_stop_heating
data:
message: Температура упала ниже порога ночью → термостат переведён на 22°C
- alias: Thermostat Preheat Alert
id: thermostat_preheat_alert
mode: single
max_exceeded: silent
triggers:
- trigger: numeric_state
entity_id: climate.family_room
attribute: current_temperature
above: 25.0
for: 00:05:00
- trigger: time_pattern
hours: /1
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: numeric_state
entity_id: climate.family_room
attribute: current_temperature
above: 25.0
- condition: template
value_template: "{{ states('climate.family_room') == 'heat' and\n state_attr('climate.family_room',\
\ 'temperature') >= 25.0 }}\n"
actions:
- action: script.notify_and_create_persistent_notification
data:
title: ⚠️ Предупреждение
message: 'Термостат был переведён в автоматический режим по причине высокой
температуры в квартире в {{ states(''sensor.time'') }}
'
- action: script.thermostat_stop_heating
data:
message: Температура поднялась выше порога → термостат переведён на 22°C
- alias: Thermostat Heating Duration Alert
id: thermostat_heating_duration_alert
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.thermostat_heating
from: 'off'
to: 'on'
for: 01:00:00
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
actions:
- action: timer.cancel
entity_id:
- timer.heating_quarantine
- timer.short_heating
- timer.pause_heating
- action: script.notify_and_create_persistent_notification
data:
title: ⚠️ Предупреждение
message: Термостат работает более часа → отопление отключено на 1 час в {{ states('sensor.time')
}}
- action: timer.start
entity_id: timer.pause_heating
- action: script.thermostat_stop_heating
data:
message: Термостат работает более часа → отопление отключено на 1 час
- alias: Short Heating Start
id: short_heating_start
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: input_button.thermostat_10_minutes_heating
actions:
- if:
- or:
- condition: state
entity_id: binary_sensor.thermostat_heating
state: 'on'
- condition: state
entity_id: timer.short_heating
state: active
then:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Квартира уже подогревается
media_content_type: text
else:
- action: timer.cancel
entity_id:
- timer.heating_quarantine
- timer.short_heating
- timer.pause_heating
- action: timer.start
entity_id: timer.short_heating
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Включен кратковременный подогрев квартиры
media_content_type: text
- action: script.thermostat_start_heating
data:
message: Включен кратковременный подогрев квартиры
- alias: Short Heating End
id: short_heating_end
mode: single
max_exceeded: silent
triggers:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.short_heating
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
actions:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Кратковременный подогрев квартиры окончен
media_content_type: text
- if:
- condition: state
entity_id: binary_sensor.etrvs_requesting_heat
state: 'off'
- condition: state
entity_id: binary_sensor.heating_request_bathroom
state: 'off'
then:
- action: script.thermostat_stop_heating
data:
message: Кратковременный подогрев квартиры окончен
- alias: Disable Heating When Noone Home
id: disable_heating_when_noone_home
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.people_home
from: 'on'
to: 'off'
for: 00:05:00
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.thermostat_active
state: 'on'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
actions:
- action: timer.cancel
entity_id:
- timer.heating_quarantine
- timer.short_heating
- timer.pause_heating
- action: script.thermostat_set_eco_mode
data:
message: Никого нет дома → переход в режим экономии
- alias: Restore Heating When Someone Home
id: restore_heating_when_someone_home
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.people_home
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.thermostat_active
state: 'off'
actions:
- if:
- condition: state
entity_id: binary_sensor.windows
state: 'on'
then:
- action: script.thermostat_set_eco_mode
data:
message: Окно открыто при возращении домой → сохранение режима экономии
else:
- action: script.thermostat_stop_heating
data:
message: Возвращение домой → отопление включено
- alias: Start Heating by ETRV Request
id: start_heating_by_etrv_request
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.etrvs_requesting_heat
from: 'off'
to: 'on'
for: 00:01:00
- trigger: time_pattern
minutes: /2
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.etrvs_requesting_heat
state: 'on'
- condition: state
entity_id: binary_sensor.windows
state: 'off'
for: 00:05:00
- condition: state
entity_id: timer.heating_quarantine
state: idle
- condition: state
entity_id: timer.pause_heating
state: idle
- condition: state
entity_id: timer.short_heating
state: idle
- condition: template
value_template: "{{ is_state('binary_sensor.people_home', 'on') or\n is_state('input_boolean.guest_mode',\
\ 'on')}}\n"
- condition: state
entity_id: binary_sensor.thermostat_heating
state: 'off'
actions:
- action: script.thermostat_start_heating
- action: input_boolean.turn_on
entity_id: input_boolean.heating_allowed
- alias: Start Heating in Bathroom
id: start_heating_in_bathroom
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: binary_sensor.heating_request_bathroom
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: timer.pause_heating
state: idle
- condition: state
entity_id: timer.short_heating
state: idle
- condition: template
value_template: "{{ is_state('binary_sensor.people_home', 'on') or\n is_state('input_boolean.guest_mode',\
\ 'on')}}\n"
- condition: state
entity_id: binary_sensor.thermostat_heating
state: 'off'
action:
- action: script.thermostat_start_heating
- alias: Stop Heating by ETRV Request
id: stop_heating_by_etrv_request
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.etrvs_requesting_heat
from: 'on'
to: 'off'
for: 00:01:00
- trigger: state
entity_id: binary_sensor.heating_request_bathroom
from: 'on'
to: 'off'
for: 00:01:00
- trigger: time_pattern
minutes: /2
conditions:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.etrvs_requesting_heat
state: 'off'
- condition: state
entity_id: binary_sensor.heating_request_bathroom
state: 'off'
- condition: state
entity_id: timer.short_heating
state: idle
- condition: state
entity_id: binary_sensor.thermostat_heating
state: 'on'
actions:
- action: script.thermostat_stop_heating
data:
message: ETRVs не запрашивают отопление → температура возвращена на 22°C
- alias: Start Pause Heating Manually
id: start_pause_heating_manually
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: input_boolean.heating_allowed
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: binary_sensor.thermostat_heating
state: 'on'
action:
- if:
- condition: state
entity_id: timer.short_heating
state: active
then:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Подогрев квартиры окончен раньше вручную
media_content_type: text
- action: timer.cancel
entity_id:
- timer.heating_quarantine
- timer.short_heating
- timer.pause_heating
- action: timer.start
entity_id: timer.pause_heating
- action: script.thermostat_stop_heating
data:
message: Отопление заблокировано вручную → температура возвращена на 22°C
- alias: Cancel Pause Heating Manually
id: cancel_pause_heating_manually
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: input_boolean.heating_allowed
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: state
entity_id: timer.pause_heating
state: active
action:
- action: timer.cancel
entity_id: timer.pause_heating
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: Блокировка отопления отменена вручную
media_content_type: text
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: Блокировка отопления отменена вручную
- alias: Log Heating Changes
id: log_heating_changes
mode: parallel
max: 10
trigger:
- platform: state
entity_id:
- binary_sensor.thermostat_heating
- binary_sensor.thermostat_active
- binary_sensor.etrvs_requesting_heat
- binary_sensor.heating_request_bathroom
- binary_sensor.freeze_alert_at_night
- binary_sensor.windows
- binary_sensor.people_home
- input_boolean.heating_season
- input_boolean.guest_mode
- input_boolean.heating_allowed
- input_number.thermostat_new_target_temperature
- timer.heating_quarantine
- timer.short_heating
- timer.pause_heating
actions:
- condition: template
value_template: '{{ trigger.from_state is not none and trigger.to_state is not
none }}'
- action: input_text.set_value
data:
entity_id: input_text.heating_log
value: '{% set entity_name = states[trigger.entity_id].name | default(trigger.entity_id)
%} {% set new_state = trigger.to_state.state %} {% set old_state = trigger.from_state.state
%} Изменено состояние "{{ entity_name }}" с {{ old_state }} на {{ new_state
}}'
- alias: Sync Danfoss ETRV Window Contact Kitchen
id: sync_danfoss_etrv_window_contact_kitchen
mode: queued
max: 3
trigger:
- platform: state
entity_id: binary_sensor.kitchen_window_contact
for: 00:00:10
- platform: time_pattern
minutes: /10
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: template
value_template: '{{ states(''binary_sensor.kitchen_window_contact'') in [''on'',
''off''] }}
'
action:
- action: switch.turn_{{ states('binary_sensor.kitchen_window_contact') }}
target:
entity_id: switch.danfoss_etrv0103_kitchen_external_window_sensor
- alias: Sync Danfoss ETRV Window Contact Bedroom
id: sync_danfoss_etrv_window_contact_bedroom
mode: queued
max: 3
trigger:
- platform: state
entity_id: binary_sensor.bedroom_window_contact
for: 00:00:10
- platform: time_pattern
minutes: /10
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: template
value_template: '{{ states(''binary_sensor.bedroom_window_contact'') in [''on'',
''off''] }}
'
action:
- action: switch.turn_{{ states('binary_sensor.bedroom_window_contact') }}
target:
entity_id: switch.danfoss_etrv0100_bedroom_external_window_sensor
- alias: Sync Danfoss ETRV Window Contact Living Room
id: sync_danfoss_etrv_window_contact_living_room
mode: queued
max: 3
trigger:
- platform: state
entity_id: binary_sensor.living_room_window_contact
for: 00:00:10
- platform: time_pattern
minutes: /10
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: template
value_template: '{{ states(''binary_sensor.living_room_window_contact'') in [''on'',
''off''] }}
'
action:
- action: switch.turn_{{ states('binary_sensor.living_room_window_contact') }}
target:
entity_id: switch.danfoss_etrv0103_living_room_external_window_sensor
- alias: Sync ETRVs Heating Available Flag
id: sync_etrvs_heating_available_flag
mode: queued
max: 3
trigger:
- platform: state
entity_id: binary_sensor.thermostat_heating
for: 00:00:10
- platform: time_pattern
minutes: /10
condition:
- condition: state
entity_id: input_boolean.heating_season
state: 'on'
- condition: template
value_template: '{{ states(''binary_sensor.thermostat_heating'') in [''on'', ''off'']
}}
'
action:
- action: switch.turn_{{ states('binary_sensor.thermostat_heating') }}
target:
entity_id:
- switch.danfoss_etrv0100_bedroom_heat_available
- switch.danfoss_etrv0103_kitchen_heat_available
- switch.danfoss_etrv0103_living_room_heat_available
- id: hall_lights_and_alice_greeting
alias: Hall Lights and Alice Greeting
mode: single
max_exceeded: silent
triggers:
- trigger: state
id: SEN_CAME_HOME
entity_id: person.sen
to: home
- trigger: state
id: KRIS_CAME_HOME
entity_id: person.kris
to: home
actions:
- wait_template: '{{ states(''binary_sensor.hall_door_contact'') == ''on'' }}'
timeout: 00:15:00
continue_on_timeout: false
- if:
- condition: trigger
id: SEN_CAME_HOME
then:
- action: light.turn_on
entity_id: light.hall_lights
- wait_template: '{{ states(''binary_sensor.hall_door_contact'') == ''off'' }}'
timeout: 00:10:00
continue_on_timeout: false
- choose:
- conditions:
- condition: trigger
id: SEN_CAME_HOME
- condition: template
value_template: '{{ ( as_timestamp(states.person.kris.last_changed, 0) | int(0)
) < ( as_timestamp(states.person.sen.last_changed, 0) | int(0) ) }}'
sequence:
- delay: 00:00:01
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: 'Добро пожаловать домой мистер Морган!
'
media_content_type: dialog
extra:
volume_level: 0.8
- choose:
- conditions:
- condition: sun
after: sunset
before_offset: 00:15:00
sequence:
- action: light.turn_on
entity_id: light.string_lights
- delay: 00:00:01
- action: light.turn_on
entity_id: light.kitchen_ceiling_light
- conditions:
- condition: trigger
id: KRIS_CAME_HOME
- condition: template
value_template: '{{ ( as_timestamp(states.person.sen.last_changed, 0) | int(0)
) < ( as_timestamp(states.person.kris.last_changed, 0) | int(0) ) }}'
sequence:
- action: media_player.play_media
alias: Only welcome
entity_id: media_player.yandex_station_midi
data:
media_content_id: 'Добро пожаловать домой миссис Морган
'
media_content_type: dialog
extra:
volume_level: 0.6
- conditions:
- condition: state
entity_id: person.sen
state: home
- condition: state
entity_id: person.kris
state: home
sequence:
- alias: Switch on lights and welcome
choose:
- conditions:
- condition: sun
after: sunset
before_offset: 00:15:00
sequence:
- action: light.turn_on
entity_id: light.string_lights
- action: media_player.play_media
alias: Welcome everybody
entity_id: media_player.yandex_station_midi
data:
media_content_id: 'Добро пожаловать домой мистер и миссис Морган
'
media_content_type: dialog
extra:
volume_level: 0.6
default:
- action: script.notify_and_create_persistent_notification
data:
title: ⚠️ Предупреждение
message: Автоматизация приветствия не смогла определить кто пришел домой
- id: home_all_lights_off
alias: Home All Lights OFF
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.hall_door_contact
from: 'on'
to: 'off'
conditions:
- condition: state
entity_id: binary_sensor.people_home
state: 'on'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
actions:
- wait_template: '{{ states(''binary_sensor.people_home'') == ''off'' }}'
timeout: 00:30:00
continue_on_timeout: false
- if:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
then:
- action: script.turn_on
entity_id: script.turn_off_all_lights
- action: scene.turn_on
entity_id: scene.no_people_home
- variables:
action_enable_guest_mode: '{{ ''action_enable_guest_mode'' ~ context.id }}'
- action: notify.mobile_app_sm_s901b
data:
title: 👋 До свидания
message: "{% if is_state('input_boolean.heating_season', 'on') %}\n Термостат\
\ и свет были отключены\n{% else %}\n Весь свет был отключен\n{% endif\
\ %}\n"
data:
actions:
- action: '{{ action_enable_guest_mode }}'
title: 👤 Включить гостевой режим
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_enable_guest_mode }}'
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_enable_guest_mode
}}'
then:
- action: script.enable_guest_mode
- id: hall_lights_by_motion_on
alias: Hall Lights by Motion ON
triggers:
- trigger: state
entity_id: binary_sensor.hall_door_contact
to: 'on'
- trigger: state
entity_id: binary_sensor.aqara_hall_motion_sensor_occupancy
to: 'on'
conditions:
- condition: state
entity_id: light.hall_lights
state: 'off'
actions:
- action: light.turn_on
entity_id: light.hall_lights
- action: input_boolean.turn_on
entity_id: input_boolean.flag_hall_lights_triggered_by_motion
- id: hall_lights_by_motion_off
alias: Hall Lights by Motion OFF
triggers:
- trigger: state
entity_id: binary_sensor.aqara_hall_motion_sensor_occupancy
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.flag_hall_lights_triggered_by_motion
state: 'on'
actions:
- action: light.turn_off
entity_id: light.hall_lights
- action: input_boolean.turn_off
entity_id: input_boolean.flag_hall_lights_triggered_by_motion
- id: kitchen_asus_pc_background_lights_on
alias: Kitchen Asus PC Background Lights ON
triggers:
- trigger: state
entity_id: switch.asus_pc
from: 'off'
to: 'on'
- trigger: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- trigger: state
entity_id: weather.home_assistant_blue
conditions:
- condition: state
entity_id: person.sen
state: home
- condition: state
entity_id: switch.asus_pc
state: 'on'
- or:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- condition: template
value_template: '{{ states(''weather.home_assistant_blue'') not in [''sunny'',
''partlycloudy''] }}'
actions:
- action: light.turn_on
entity_id: light.gyver_lamp
data:
effect: Oгoнь
brightness: 150
rgb_color:
- 255
- 39
- 25
- if:
- condition: template
value_template: '{{ states(''person.kris'') == ''home''}}'
then:
- action: switch.turn_off
entity_id: switch.pc_backlight_sync_send
else:
- action: light.turn_on
entity_id:
- light.shelf_lighting
- light.pc_backlight
- action: switch.turn_on
entity_id: switch.pc_backlight_sync_send
- id: kitchen_asus_pc_background_lights_off
alias: Kitchen Asus PC Background Lights OFF
triggers:
- trigger: state
entity_id: switch.asus_pc
from: 'on'
to: 'off'
actions:
- action: light.turn_off
entity_id:
- light.gyver_lamp
- light.shelf_lighting
- id: kitchen_clock_disable_by_presence
alias: Kitchen Clock Disable by Presence
triggers:
- trigger: state
entity_id: binary_sensor.people_home
to: 'off'
for: 00:01:00
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
actions:
- action: light.turn_off
entity_id: light.7_seg_clock
- id: kitchen_clock_reenable
alias: Kitchen Clock Reenable
triggers:
- trigger: state
entity_id: light.7_seg_clock
to: 'off'
for: 00:00:05
- trigger: state
entity_id: binary_sensor.kitchen_motion_alarm
to: 'on'
- trigger: state
entity_id: input_boolean.home_night_mode
to: 'off'
conditions:
- condition: state
entity_id: light.7_seg_clock
state: 'off'
- condition: state
entity_id: binary_sensor.people_home
state: 'on'
- condition: time
after: 05:00:00
before: '22:00:00'
actions:
- action: light.turn_on
entity_id: light.7_seg_clock
- id: interactive_cz_map_reenable
alias: Interactive CZ Map Reenable
triggers:
- trigger: state
entity_id: person.sen
to: home
- trigger: state
entity_id: switch.asus_pc
to: 'on'
- trigger: state
entity_id: input_boolean.home_night_mode
to: 'off'
conditions:
- condition: state
entity_id: switch.interactive_cz_map_enable
state: 'off'
- condition: state
entity_id: person.sen
state: home
- condition: time
after: 05:00:00
before: '22:00:00'
actions:
- action: switch.turn_on
entity_id: switch.interactive_cz_map_enable
- id: wireless_charger_reenable
alias: Wireless Charger Reenable
triggers:
- trigger: state
entity_id: binary_sensor.people_home
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
- condition: state
entity_id: light.wireless_charger
state: 'off'
actions:
- action: light.turn_on
entity_id: light.wireless_charger
- id: parking_lights_on
alias: Parking Lights ON
mode: queued
triggers:
- trigger: state
entity_id: input_button.parking_light
actions:
- action: script.turn_on
target:
entity_id: script.switch_on_parking_light
- id: parking_light_emergency_on
alias: Parking Light Emergency On
triggers:
- trigger: state
entity_id: switch.parking_light
to: 'off'
for: 3600
actions:
- repeat:
until:
- condition: state
entity_id: switch.parking_light
state: 'on'
sequence:
- action: switch.turn_on
entity_id: switch.parking_light
- action: notify.mobile_app_sm_s901b
data:
title: 💬 Системное уведомление
message: Реле освещения парковки было отключено более часа. Автоматическое
включение в {{ states('sensor.time') }}
- delay: 00:01:00
- id: kitchen_led_strip_sync_with_spotlights
alias: Kitchen LED Strip Sync with Spotlights
triggers:
- trigger: state
entity_id: light.kitchen_spotlights
conditions:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
actions:
- action: light.turn_{{ trigger.to_state.state }}
entity_id: light.kitchen_led_strip
- id: activate_night_mode
alias: Activate Night Mode
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: input_button.activate_night_mode
actions:
- action: script.turn_on
entity_id: script.activate_night_mode
- id: busy_wall_switch_1
alias: Busy Wall Switch 1
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.air_quality_station_digital_input_1
from: 'off'
to: 'on'
- trigger: state
entity_id: binary_sensor.air_quality_station_digital_input_1
from: 'on'
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.child_lock
state: 'off'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
actions:
- action: light.toggle
entity_id: light.living_room_ceiling_light
- id: busy_wall_switch_2
alias: Busy Wall Switch 2
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.air_quality_station_digital_input_2
from: 'off'
to: 'on'
- trigger: state
entity_id: binary_sensor.air_quality_station_digital_input_2
from: 'on'
to: 'off'
actions:
- action: light.toggle
entity_id: light.floor_lamp
- alias: Silent Mode Handler
id: silent_mode_handler
triggers:
- trigger: state
entity_id: input_boolean.silent_mode
actions:
service_template: "{% if is_state('input_boolean.silent_mode', 'on') %}\n script.set_silent_mode\n\
{% else %}\n script.reset_silent_mode\n{% endif %}\n"
- alias: Night Mode Handler
id: night_mode_handler
triggers:
- trigger: state
entity_id: input_boolean.home_night_mode
actions:
service_template: "{% if is_state('input_boolean.home_night_mode', 'on') %}\n\
\ script.home_night_mode\n{% else %}\n script.home_day_mode\n{% endif %}\n"
- alias: Home Enable Night Mode at Evening
id: home_enable_night_mode_at_evening
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.bedroom_door_contact
from: 'on'
to: 'off'
for: 00:00:30
- trigger: time
at: '21:00:00'
conditions:
- condition: time
after: '20:00:00'
before: 03:00:00
- condition: state
entity_id: binary_sensor.people_home
state: 'on'
actions:
- action: input_boolean.turn_on
entity_id:
- input_boolean.home_night_mode
- input_boolean.silent_mode
- alias: Yandex Volume Increased Handler
id: yandex_volume_increased_handler
mode: single
triggers:
- trigger: state
entity_id: media_player.yandex_station_midi
conditions:
- condition: time
after: 06:00:00
before: '12:00:00'
- condition: state
entity_id: input_boolean.silent_mode
state: 'on'
- condition: template
value_template: '{% set from = trigger.from_state.attributes.volume_level | float(0)
%} {% set to = trigger.to_state.attributes.volume_level | float(0) %} {{ to
> from }}
'
actions:
- action: input_boolean.turn_off
entity_id:
- input_boolean.home_night_mode
- input_boolean.silent_mode
- alias: Good Morning Handler
id: good_morning_handler
mode: single
triggers:
- trigger: time
at: 09:00:00
- trigger: state
entity_id: cover.bedroom
to: open
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'on'
- condition: time
after: 06:00:00
before: '12:00:00'
actions:
- action: input_boolean.turn_off
entity_id:
- input_boolean.home_night_mode
- input_boolean.silent_mode
- alias: Silent Mode by Bedroom Door Enable
id: silent_mode_by_bedroom_door_enable
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.bedroom_door_contact
to: 'off'
for: 00:00:30
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.silent_mode
- alias: Silent Mode by Bedroom Door Disable
id: silent_mode_by_bedroom_door_disable
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.bedroom_door_contact
to: 'on'
for: 00:00:30
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
- condition: time
after: 06:00:00
before: '20:00:00'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.silent_mode
- alias: Prevent Accidental Bedroom Lights ON
id: prevent_accidental_bedroom_lights_on
triggers:
- trigger: state
entity_id:
- light.bedroom_ceiling_light
- light.bedroom_nightlight
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.bedroom_lights_and_cover_safety_switch
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.context.user_id = None }}'
actions:
- action: light.turn_off
data:
entity_id: '{{ trigger.entity_id }}'
- alias: Prevent Accidental Bedroom Cover Open
id: prevent_accidental_bedroom_cover_open
triggers:
- trigger: state
entity_id: cover.bedroom
to: open
conditions:
- condition: state
entity_id: input_boolean.bedroom_lights_and_cover_safety_switch
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.context.user_id = None }}'
- condition: template
value_template: secret TEMPLATE_NOT_A_YANDEX_USER_ID
actions:
- action: cover.close_cover
data:
entity_id: '{{ trigger.entity_id }}'
- alias: Prevent Accidental Yandex Volume Increase at Silent Mode
id: prevent_accidental_yandex_volume_increase_at_silent_mode
triggers:
- trigger: state
entity_id: media_player.yandex_station
- trigger: state
entity_id: media_player.yandex_station_midi
conditions:
- condition: state
entity_id: input_boolean.silent_mode
state: 'on'
- condition: template
value_template: '{% set from = trigger.from_state.attributes.volume_level | float(0)
%} {% set to = trigger.to_state.attributes.volume_level | float(0) %} {{ to
> from and to > 0.4 }}
'
actions:
- action: script.set_volume_level_repeatedly
data:
media_player: media_player.yandex_station_midi
volume_level: 0.2
- action: script.set_volume_level_repeatedly
data:
media_player: media_player.yandex_station
volume_level: 0.4
- alias: Prevent Accidental Yandex Mini Volume Increase
id: prevent_accidental_yandex_mini_volume_increase
mode: restart
triggers:
- trigger: state
entity_id: media_player.yandex_station
conditions:
- condition: template
value_template: '{{ trigger.to_state.context.user_id == None }}'
- condition: template
value_template: '{% set from = trigger.from_state.attributes.volume_level | float(0)
%} {% set to = trigger.to_state.attributes.volume_level | float(0) %} {{ to
> from and to > 0.6 }}
'
actions:
- action: script.set_volume_level_repeatedly
data:
media_player: media_player.yandex_station
volume_level: 0.6
- id: notification_snow
alias: Notification Snow
triggers:
- trigger: numeric_state
entity_id: sensor.openweathermap_snow
above: 0
actions:
- action: notify.mobile_app_sm_s901b
data_template:
title: ❄️ Уведомление о снеге
message: Должно выпадать {{ states('sensor.openweathermap_snow') }} мм/ч снега!
- id: notification_door_opened
alias: Notification Door Opened
triggers:
- trigger: state
entity_id: binary_sensor.hall_door_contact
to: 'on'
conditions:
- condition: template
value_template: '{{ not states(''person.sen'') == ''home''}}
'
actions:
- action: notify.mobile_app_sm_s901b
data:
title: 💬 Системное уведомление
message: Входная дверь была открыта в {{ states('sensor.time') }}
- id: notification_kris_arrived
alias: Notification Kris Arrived
triggers:
- entity_id: person.kris
to: home
trigger: state
conditions:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
actions:
- data:
title: '{{ ''👩‍🦰'' }} Семейное уведомление'
message: Кристина пришла домой в {{ states('sensor.time') }}
action: notify.mobile_app_sm_s901b
- if:
- condition: template
value_template: '{{ is_state(''person.sen'', ''home'') }}'
then:
- entity_id: script.notify_via_kitchen_spotlights
action: script.turn_on
- if:
- condition: state
entity_id: switch.asus_pc
state: 'on'
then:
- target:
entity_id: select.pc_backlight_preset
data:
option: Alarm
action: select.select_option
- delay: 00:00:10
- target:
entity_id: select.pc_backlight_preset
data:
option: Gender
action: select.select_option
- id: notification_ads_b_receiver_disconnected
alias: Notification ADS-B Receiver Disconnected
triggers:
- trigger: state
entity_id: binary_sensor.fr24_feeder_receiver_connected
from: 'on'
to: 'off'
for: 00:05:00
actions:
- variables:
timestamp: '{{ trigger.to_state.last_changed.astimezone(now().tzinfo).strftime(''%H:%M:%S'')
}}'
- action: script.notify_and_create_persistent_notification
data:
title: ⚠️ Предупреждение
message: Связь с ADS-B приёмником была потеряна в {{ timestamp }}
- action: automation.turn_on
entity_id: automation.notification_ads_b_receiver_connection_restored
- id: notification_ads_b_receiver_connection_restored
alias: Notification ADS-B Receiver Connection Restored
triggers:
- trigger: state
entity_id: binary_sensor.fr24_feeder_receiver_connected
from: 'off'
to: 'on'
for: 00:01:00
actions:
- variables:
timestamp: '{{ trigger.to_state.last_changed.astimezone(now().tzinfo).strftime(''%H:%M:%S'')
}}'
- action: script.notify_and_create_persistent_notification
data:
title: 💬 Системное уведомление
message: Связь с ADS-B приёмником была восстановлена в {{ timestamp }}
- action: automation.turn_off
entity_id: automation.notification_ads_b_receiver_connection_restored
- id: notification_diesel_price_changed
alias: Notification Diesel Price Changed
triggers:
- trigger: state
entity_id: sensor.diesel_price_ono
conditions:
- condition: template
value_template: '{{ trigger.from_state.state != trigger.to_state.state }}
'
- condition: template
value_template: '{{ is_number(trigger.from_state.state) and is_number(trigger.to_state.state)
}}
'
actions:
- action: script.notify_and_create_persistent_notification
data:
title: 💬 Системное уведомление
message: 'Цена дизеля {{ ''упала'' if trigger.from_state.state | float(0) >
trigger.to_state.state | float(0) else ''возрасла'' }} с {{ trigger.from_state.state
}} до {{ trigger.to_state.state }} Kč/L
'
data:
actions:
- action: URI
title: 📈 Open Chart
uri: /lovelace/diesel-price
- id: notification_gasoline_price_changed
alias: Notification Gasoline Price Changed
triggers:
- trigger: state
entity_id: sensor.gasoline_price_ono
conditions:
- condition: template
value_template: '{{ trigger.from_state.state != trigger.to_state.state }}
'
- condition: template
value_template: '{{ is_number(trigger.from_state.state) and is_number(trigger.to_state.state)
}}
'
actions:
- action: notify.mobile_app_sm_g991b
data:
title: 💬 Системное уведомление
message: 'Цена бензина {{ ''упала'' if trigger.from_state.state | float(0) >
trigger.to_state.state | float(0) else ''возрасла'' }} с {{ trigger.from_state.state
}} до {{ trigger.to_state.state }} Kč/L
'
data:
actions:
- action: URI
title: 📈 Open Chart
uri: /lovelace/gasoline-price
- id: notification_solar_panel_power_above_threshold
alias: Notification Solar Panel Power Above Threshold
triggers:
- trigger: numeric_state
entity_id: sensor.solar_panel_power
above: 40
for: 00:05:00
actions:
- action: notify.mobile_app_sm_s901b
data:
title: 🌞 Солнечная панель
message: 'Мощность выше порога: {{ states(''sensor.solar_panel_power'') }} W'
- id: notification_washing_finish
alias: Notification Washing Finish
triggers:
- trigger: state
entity_id: sensor.washing_machine_washer_job_state
to: finish
conditions:
- condition: template
value_template: '{{ (as_timestamp(now(), 0) - as_timestamp(states.sensor.washing_machine_washer_job_state.last_changed,
0)) < 14400 }}
'
actions:
- action: script.yandex_joke_after_washing_clothes
- id: notification_shopping_list_sen
alias: Notification Shopping List for Sen
description: Shopping list reminder when Sen enters the supermarket
mode: single
trigger:
- platform: state
entity_id: person.sen
to: JIP
for: 00:02:00
condition:
- condition: numeric_state
entity_id: todo.shopping_list
above: 0
action:
- action: notify.mobile_app_sm_s901b
data:
message: 🛒 Открыть список покупок?
data:
clickAction: /todo?entity_id=todo.shopping_list
url: /todo?entity_id=todo.shopping_list
- id: notification_shopping_list_kris
alias: Notification Shopping List for Kris
description: Shopping list reminder when Kris enters the supermarket
mode: single
trigger:
- platform: state
entity_id: person.kris
to: JIP
for: 00:02:00
condition:
- condition: numeric_state
entity_id: todo.shopping_list
above: 0
action:
- action: notify.mobile_app_sm_g991b
data:
message: 🛒 Открыть список покупок?
data:
clickAction: /todo?entity_id=todo.shopping_list
url: /todo?entity_id=todo.shopping_list
- id: notification_watch_charged
alias: Notification Watch Charged
trigger:
- platform: numeric_state
entity_id: sensor.galaxy_watch6_classic_r7dh_battery_level
above: 79
conditions:
- condition: state
entity_id: person.sen
state: home
action:
- action: notify.mobile_app_sm_s901b
data:
title: '{{ ''🔋'' }} Часы заряжены'
message: Твои Galaxy Watch заряжены уже на 80%!
- if:
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
then:
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_type: text
media_content_id: Часы заряжены на 80%
- alias: Update Plants to Water on Sensor Change
id: update_plants_to_water_on_sensor_change
mode: single
max_exceeded: silent
triggers:
- trigger: time_pattern
minutes: /10
actions:
- action: python_script.update_plants_to_water
- alias: Notify on Plants to Water
id: notify_on_plants_to_water
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id: input_text.plants_to_water
conditions:
- condition: template
value_template: '{{ states(''input_text.plants_to_water'') | length > 0 }}'
- condition: state
entity_id: schedule.plant_watering_notification
state: 'on'
actions:
- action: script.notify_and_create_persistent_notification
data:
title: 🪴 Домашние цветы
message: 'Нужно полить следующие растения: {{ states(''input_text.plants_to_water'')
}}'
- alias: Scooter Charger Enable
id: scooter_charger_enable
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: input_boolean.scooter_charger
to: 'on'
actions:
- action: switch.turn_on
entity_id: switch.scooter_charger_socket
- action: automation.turn_on
entity_id: automation.scooter_charger_disable_when_idle
- action: input_number.set_value
data:
entity_id: input_number.scooter_charger_energy_start
value: '{{ states(''sensor.scooter_charger_summation_delivered'') | float(0)
}}'
- action: input_datetime.set_datetime
data:
entity_id: input_datetime.scooter_charger_energy_start_time
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- alias: Scooter Charger Disable
id: scooter_charger_disable
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: input_boolean.scooter_charger
to: 'off'
actions:
- action: switch.turn_off
entity_id: switch.scooter_charger_socket
- if:
- condition: template
value_template: '{{ states(''sensor.scooter_charger_energy_consumed'') | float(0)
> 0 }}'
then:
- action: script.turn_on
entity_id: script.scooter_charger_energy_consumed_notify
- action: automation.turn_off
entity_id: automation.scooter_charger_disable_when_idle
- alias: Scooter Charger Disable When Idle
id: scooter_charger_disable_when_idle
mode: restart
max_exceeded: silent
triggers:
- trigger: numeric_state
entity_id: sensor.scooter_charger_active_power
below: 15
for:
minutes: 10
actions:
- action: switch.turn_off
entity_id: switch.scooter_charger_socket
- action: input_boolean.turn_off
entity_id: input_boolean.scooter_charger
- if:
- condition: template
value_template: '{{ states(''sensor.scooter_charger_energy_consumed'') | float(0)
> 0 }}'
then:
- action: script.turn_on
entity_id: script.scooter_charger_energy_consumed_notify
- action: automation.turn_off
entity_id: automation.scooter_charger_disable_when_idle
- alias: Tag Near PC was scanned
id: tag_near_pc_was_scanned
mode: single
triggers:
- trigger: tag
tag_id: c45d3b71-2ade-45e3-8663-f0028f52b01d
actions:
- action: input_boolean.toggle
target:
entity_id: input_boolean.show_cameras_in_lovelace
- action: notify.mobile_app_sm_s901b
data:
title: 👁️ Режим камер
message: "{% if is_state('input_boolean.show_cameras_in_lovelace', 'on') %}\n\
\ Камеры включены\n{% else %}\n Камеры выключены\n{% endif %}"
- alias: Reenable Cameras if Hided
id: reenable_cameras_if_hided
mode: single
triggers:
- trigger: state
entity_id: input_boolean.show_cameras_in_lovelace
to: 'off'
for: 01:00:00
actions:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.show_cameras_in_lovelace
- action: notify.mobile_app_sm_s901b
data:
title: 👁️ Режим камер
message: Камеры включены автоматически в {{ states('sensor.time') }}
- alias: Tag Near Entrance was scanned
id: tag_near_entrance_was_scanned
mode: restart
triggers:
- trigger: tag
tag_id: 5954e702-f87d-4955-969c-5231af33ece8
actions:
- action: script.enable_guest_mode
- alias: Living Room TV Lights by Sunset or TV ON
id: living_room_tv_lights_by_sunset_or_tv_on
description: Turn on TV lights automatically by sunset or when TV is turned on
mode: restart
triggers:
- trigger: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- trigger: state
entity_id: media_player.samsung_tv
to: 'on'
conditions:
- condition: state
entity_id: media_player.samsung_tv
state: 'on'
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
actions:
- wait_template: "{{ states('switch.asus_pc') == 'off' and\n states('light.kitchen_spotlights')\
\ == 'off' and\n states('light.kitchen_ceiling_light') == 'off' and\n states('light.bedroom_nightlight')\
\ == 'off' and\n states('binary_sensor.kitchen_motion_alarm') == 'off' }}\n"
timeout: 01:00:00
continue_on_timeout: false
- if:
- condition: state
entity_id: media_player.samsung_tv
state: 'on'
then:
- action: scene.turn_on
entity_id: scene.movies
- alias: Living Room Speakers Power On with TV
id: living_room_speakers_power_on_with_tv
description: Turn on speakers automatically when TV is turned on
mode: restart
trigger:
- platform: state
entity_id: media_player.samsung_tv
to: 'on'
condition:
- condition: state
entity_id: switch.monolith_speakers
state: 'off'
action:
- action: switch.turn_on
entity_id: switch.monolith_speakers
- alias: Living Room Speakers Standby OFF
id: living_room_speakers_standby_off
description: Turn off speakers when in standby mode for a while and TV is off
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.monolith_speakers_above_power_threshold
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: switch.monolith_speakers
state: 'on'
- condition: state
entity_id: media_player.samsung_tv
state: 'off'
action:
- action: switch.turn_off
entity_id: switch.monolith_speakers
- alias: Living Room Speakers Auto Power Down
id: living_room_speakers_auto_power_down
description: Turn off speakers if power consumption remains low after powering on
mode: restart
trigger:
- platform: state
entity_id: switch.monolith_speakers
to: 'on'
action:
- alias: Check if power consumption exceeds threshold
wait_for_trigger:
- platform: state
entity_id: binary_sensor.monolith_speakers_above_power_threshold
to: 'on'
timeout:
minutes: 5
- if:
- '{{ not wait.completed }}'
- condition: state
entity_id: media_player.samsung_tv
state: 'off'
then:
- alias: Power off if threshold not exceeded
action: switch.turn_off
entity_id: switch.monolith_speakers
- alias: UPS Lost Grid Power Notification
id: ups_lost_grid_power_notification
mode: single
triggers:
- trigger: state
entity_id: sensor.ups_status_data
to: OB DISCHRG
actions:
- action: script.notify_and_create_persistent_notification
data:
title: 🚨 Внимание!
message: 'UPS потерял питание в {{ states(''sensor.time'') }} Рассчётное время
работы: {{ states(''sensor.ups_battery_runtime'') | int(0) | timestamp_custom(''%M:%S'')
}} минут
'
- action: automation.turn_on
entity_id: automation.ups_grid_power_restored_notification
- alias: UPS Grid Power Restored Notification
id: ups_grid_power_restored_notification
mode: single
triggers:
- trigger: template
value_template: '{{ ''OL'' in states(''sensor.ups_status_data'') }}'
actions:
- action: script.notify_and_create_persistent_notification
data:
title: 🚨 Внимание!
message: Питание восстановлено в {{ states('sensor.time') }}
- action: automation.turn_off
entity_id: automation.ups_grid_power_restored_notification
- alias: UPS Low Battery Warning Notification
id: ups_low_battery_warning_notification
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.ups_battery_charge
below: 21
actions:
- action: notify.mobile_app_sm_s901b
data:
title: 🚨 Внимание!
message: 'Низкий заряд аккумулятора UPS: {{ states(''sensor.ups_battery_charge'')
}}%
'
- alias: UPS Shutdown Home Assistant Server
id: ups_shutdown_home_assistant_server
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.ups_battery_charge
below: 10
- trigger: numeric_state
entity_id: sensor.ups_battery_runtime
below: 300
- trigger: template
value_template: '{{ ''OB DISCHRG LB'' in states(''sensor.ups_status_data'') }}'
actions:
- action: notify.mobile_app_sm_s901b
data:
title: 🚨 Внимание!
message: 'Критически низкий заряд батареи UPS.
Немедленное отключение сервера Home Assistant в {{ states(''sensor.time'')
}}
'
- delay: 00:00:05
- action: hassio.host_shutdown
- alias: UPS Lost Grid Power Light Notification
id: ups_lost_grid_power_light_notification
mode: single
triggers:
- trigger: template
value_template: '{{ ''OB'' in states(''sensor.ups_status_data'') }}'
actions:
- action: light.turn_on
data:
entity_id: light.tradfri_bulb
brightness: 255
effect: breathe
- action: automation.turn_on
entity_id: automation.ups_grid_power_restored_light_notification
- alias: UPS Grid Power Restored Light Notification
id: ups_grid_power_restored_light_notification
mode: single
triggers:
- trigger: template
value_template: '{{ ''OL'' in states(''sensor.ups_status_data'') }}'
actions:
- action: light.turn_on
data:
entity_id: light.tradfri_bulb
brightness: 255
- wait_template: '{{ not (''OL'' in states(''sensor.ups_status_data'')) }}'
timeout: 00:00:10
- if:
- condition: template
value_template: '{{ ''OL'' in states(''sensor.ups_status_data'') }}'
then:
- action: light.turn_off
entity_id: light.tradfri_bulb
- action: automation.turn_off
entity_id: automation.ups_grid_power_restored_light_notification
- alias: WC Accupancy Set
id: wc_accupancy_set
triggers:
- trigger: state
entity_id: binary_sensor.wc_door_contact
from: 'on'
to: 'off'
for:
seconds: '{{ states(''input_number.wc_consider_occupied_after_seconds'') | default(0)
| float(0) }}'
conditions:
- condition: state
entity_id: input_boolean.wc_occupied
state: 'off'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.wc_occupied
- alias: WC Accupancy Reset
id: wc_accupancy_reset
triggers:
- trigger: state
entity_id: binary_sensor.wc_door_contact
from: 'off'
to: 'on'
for:
seconds: '{{ states(''input_number.wc_consider_unoccupied_after_seconds'') |
default(0) | float(0) }}'
conditions:
- condition: state
entity_id: input_boolean.wc_occupied
state: 'on'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.wc_occupied
- alias: WC Ventilation Start Timer Manually
id: wc_ventilation_start_timer_manually
triggers:
- trigger: state
entity_id: fan.wc_and_bathroom
from: 'off'
to: 'on'
conditions:
- condition: template
value_template: '{{ ((now() + timedelta(minutes=states(''input_number.wc_ventilate_for_minutes_after_manual_trigger'')
| default(0) | float(0))).timestamp() > as_timestamp(state_attr(''timer.wc_ventilation'',
''finishes_at''), 0)) or (states(''timer.wc_ventilation'') in [''idle'', ''paused''])
}}'
actions:
- action: timer.start
data:
entity_id: timer.wc_ventilation
duration:
minutes: '{{ states(''input_number.wc_ventilate_for_minutes_after_manual_trigger'')
| default(0) | float(0) }}'
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: MANUAL_ON
- action: automation.turn_off
entity_id: automation.wc_ventilation_stop_humidity_below_threshold
- alias: WC Ventilation Stop Timer Manually
id: wc_ventilation_stop_timer_manually
triggers:
- trigger: state
entity_id: fan.wc_and_bathroom
from: 'on'
to: 'off'
conditions:
- condition: state
entity_id: timer.wc_ventilation
state: active
actions:
- action: timer.cancel
entity_id: timer.wc_ventilation
- action: timer.cancel
entity_id: timer.wc_wait_for_open_to_ventilate
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: MANUAL_OFF
- action: automation.turn_off
entity_id: automation.wc_ventilation_stop_humidity_below_threshold
- alias: WC Ventilation Timeout
id: wc_ventilation_timeout
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.wc_ventilation
actions:
- action: fan.turn_off
entity_id: fan.wc_and_bathroom
- action: timer.cancel
entity_id: timer.wc_wait_for_open_to_ventilate
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: TIMEOUT
- action: automation.turn_off
entity_id: automation.wc_ventilation_stop_humidity_below_threshold
- alias: WC Ventilation Start Timeout For Door Open State
id: wc_ventilation_start_timeout_for_door_open_state
triggers:
- trigger: state
entity_id: input_boolean.wc_occupied
from: 'off'
to: 'on'
for:
seconds: '{{ states(''input_number.wc_consider_ventilate_when_finished_if_occupied_for_seconds'')
| default(0) | float(0) }}'
actions:
- action: timer.start
data:
entity_id: timer.wc_wait_for_open_to_ventilate
duration:
minutes: '{{ states(''input_number.wc_wait_for_opening_after_considered_to_ventilate_minutes'')
| default(0) | float(0) }}'
- alias: WC Ventilation Start When Unoccupied
id: wc_ventilation_start_when_unoccupied
triggers:
- trigger: state
entity_id: input_boolean.wc_occupied
from: 'on'
to: 'off'
conditions:
- condition: state
entity_id: timer.wc_wait_for_open_to_ventilate
state: active
- condition: template
value_template: '{{ ((now() + timedelta(minutes=states(''input_number.wc_ventilate_for_minutes_when_finished'')
| default(0) | float(0))).timestamp() > as_timestamp(state_attr(''timer.wc_ventilation'',
''finishes_at''), 0)) or (states(''timer.wc_ventilation'') in [''idle'', ''paused''])
}}'
actions:
- action: fan.turn_on
entity_id: fan.wc_and_bathroom
- action: timer.cancel
entity_id: timer.wc_wait_for_open_to_ventilate
- action: timer.start
data:
entity_id: timer.wc_ventilation
duration:
minutes: '{{ states(''input_number.wc_ventilate_for_minutes_when_finished'')
| default(0) | float(0) }}'
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: TOILET_ON
- alias: WC Ventilation Start Humidity Exceeds Threshold
id: wc_ventilation_start_humidity_exceeds_threshold
triggers:
- trigger: numeric_state
entity_id: sensor.ble_humidity_atc_bathroom
above: input_number.wc_ventilation_start_humidity_threshold
for: 00:02:00
actions:
- action: timer.cancel
entity_id: timer.wc_wait_for_open_to_ventilate
- action: automation.turn_on
entity_id: automation.wc_ventilation_stop_humidity_below_threshold
- action: timer.start
data:
entity_id: timer.wc_ventilation
duration:
minutes: '{{ states(''input_number.wc_max_ventilation_duration_minutes'')
| default(0) | float(0) }}'
- action: fan.turn_on
entity_id: fan.wc_and_bathroom
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: HUMIDITY_ON
- alias: WC Ventilation Stop Humidity Below Threshold
id: wc_ventilation_stop_humidity_below_threshold
triggers:
- trigger: numeric_state
entity_id: sensor.ble_humidity_atc_bathroom
below: input_number.wc_ventilation_stop_humidity_threshold
for: 00:02:00
actions:
- action: timer.cancel
entity_id: timer.wc_ventilation
- action: fan.turn_off
entity_id: fan.wc_and_bathroom
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: HUMIDITY_OFF
- action: automation.turn_off
entity_id: automation.wc_ventilation_stop_humidity_below_threshold
- alias: WC Ventilation Start Timer Emergency
id: wc_ventilation_start_timer_emergency
triggers:
- trigger: state
entity_id: fan.wc_and_bathroom
to: 'on'
for: 00:01:00
conditions:
- or:
- condition: state
entity_id: timer.wc_ventilation
state: idle
- condition: state
entity_id: timer.wc_ventilation
state: paused
actions:
- action: timer.start
data:
entity_id: timer.wc_ventilation
duration:
minutes: '{{ states(''input_number.wc_max_ventilation_duration_minutes'')
| default(0) | float(0) }}'
- action: input_select.select_option
data:
entity_id: input_select.wc_ventilation_state
option: EMERGENCY
- id: sync_shopping_list
alias: Sync Shopping List
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.people_home
to: 'off'
for: 00:05:00
actions:
- action: input_number.set_value
target:
entity_id: input_number.volume_yandex_station
data:
value: '{{ state_attr(''media_player.yandex_station_midi'', ''volume_level'')}}'
- repeat:
while:
- condition: template
value_template: '{{ not is_state_attr(''media_player.yandex_station_midi'',
''volume_level'', 0.01) }}'
- condition: template
value_template: '{{ repeat.index <= 3 }}'
sequence:
- action: media_player.volume_set
data:
entity_id: media_player.yandex_station_midi
volume_level: 0.01
- delay: 0.5
- action: script.turn_on
entity_id: script.update_shopping_list
- delay: 1
- action: media_player.play_media
entity_id: media_player.yandex_station_midi
data:
media_content_id: stop
media_content_type: command
- delay: 1
- repeat:
while:
- condition: template
value_template: '{{ not is_state_attr(''media_player.yandex_station_midi'',
''volume_level'', states(''input_number.volume_yandex_station'')) }}'
- condition: template
value_template: '{{ repeat.index <= 3 }}'
sequence:
- action: media_player.volume_set
data:
entity_id: media_player.yandex_station_midi
volume_level: '{{ states(''input_number.volume_yandex_station'')}}'
- delay: 1
- alias: Aqara Switch 1 Handler
id: aqara_switch_1_handler
mode: restart
max_exceeded: silent
triggers:
- trigger: event
event_type: zha_event
event_data:
device_id: 6559eaaf60c9624465f762290ff9e825
actions:
- variables:
command: '{{ trigger.event.data.command }}'
- choose:
- conditions:
- '{{ command == ''single'' }}'
sequence:
- if:
- condition: state
entity_id: input_boolean.child_lock
state: 'off'
then:
- action: script.activate_night_mode
- conditions:
- '{{ command == ''double'' }}'
sequence:
- if:
- condition: state
entity_id: input_boolean.home_night_mode
state: 'off'
- condition: state
entity_id: light.bedroom_nightlight
state: 'off'
then:
- action: light.turn_on
entity_id: light.bedroom_nightlight
data:
brightness: 255
else:
- action: light.turn_off
entity_id: light.bedroom_nightlight
- conditions:
- '{{ command == ''hold'' }}'
sequence:
- action: input_boolean.turn_off
entity_id: input_boolean.bedroom_lights_and_cover_safety_switch
- action: cover.open_cover
entity_id: cover.bedroom
- if:
- condition: state
entity_id: input_boolean.child_lock
state: 'off'
then:
- action: input_boolean.turn_off
entity_id:
- input_boolean.home_night_mode
- input_boolean.silent_mode
default: []
- alias: Aqara Cube 1 Handler
id: aqara_cube_1_handler
mode: restart
max_exceeded: silent
triggers:
- trigger: event
event_type: zha_event
event_data:
device_id: 48fad66663fc601ed1a63ac01e804fab
actions:
- if:
- condition: state
entity_id: input_boolean.cube_1_control
state: 'on'
then:
- variables:
command: '{{ trigger.event.data.command }}'
flip_degrees: '{{ trigger.event.data.args.flip_degrees if trigger.event.data.args.flip_degrees
is defined else 0 }}'
relative_degrees: '{{ trigger.event.data.args.relative_degrees if trigger.event.data.args.relative_degrees
is defined else 0 }}'
- choose:
- conditions:
- '{{ flip_degrees == 90 }}'
sequence:
- action: light.toggle
entity_id: light.string_lights
- conditions:
- '{{ flip_degrees == 180 }}'
sequence:
- action: light.toggle
entity_id: light.floor_lamp
- conditions:
- '{{ command == ''shake'' }}'
sequence:
- action: script.turn_on
entity_id: script.turn_off_all_lights
- conditions:
- '{{ command == ''tap'' }}'
sequence:
- action: scene.turn_on
entity_id: scene.movies
- conditions:
- '{{ command == ''slide'' }}'
sequence:
- action: light.turn_on
entity_id:
- light.gyver_lamp
- light.pc_backlight
- conditions:
- '{{ command == ''rotate_left'' or command == ''rotate_right'' }}'
sequence:
- action: light.turn_on
entity_id: light.floor_lamp
data_template:
brightness: "{% set suggested = state_attr('light.floor_lamp', 'brightness')\
\ | int(0) + \n relative_degrees | int(0) + 1 %}\n{% if suggested >\
\ 0 %} {{ suggested }} {% else %} 1 {% endif %}\n"
- alias: Tradfri Switch 1 Handler
id: tradfri_switch_1_handler
mode: restart
max_exceeded: silent
triggers:
- trigger: event
event_type: zha_event
event_data:
device_id: a64c98fa9b0c36e96ebe42160fcf78b5
actions:
- variables:
command: '{{ trigger.event.data.command }}'
- choose:
- conditions:
- '{{ command == ''on'' }}'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolean.scooter_charger
- conditions:
- '{{ command == ''off'' }}'
sequence:
- action: input_boolean.turn_off
entity_id: input_boolean.scooter_charger
- alias: Rodret Dimmer 1 Handler
id: rodret_dimmer_1_handler
use_blueprint:
path: damru/ikea-rodret_E2201_ZHA-Z2M_control-anything.yaml
input:
remote_device: 51724530dc1fcac3561d2fcb39f40048
on_press_action:
- action: light.turn_on
entity_id:
- light.mi_desk_lamp
- light.tv_lights
- action: switch.turn_on
entity_id: switch.monolith_speakers
off_press_action:
- action: light.turn_off
entity_id:
- light.mi_desk_lamp
- light.tv_lights
- action: switch.turn_off
entity_id: switch.monolith_speakers
on_hold_action:
- action: light.turn_on
entity_id: light.mi_desk_lamp
data:
brightness_step_pct: 4
off_hold_action:
- action: light.turn_on
entity_id: light.mi_desk_lamp
data:
brightness_step_pct: -4
helper_hold_delay: 200
helper_max_loops: 20