- alias: turn_on_alarm id: turn_on_alarm initial_state: true triggers: - trigger: state entity_id: input_boolean.alarm_gateway_button to: 'on' actions: - action: scene.create data: scene_id: before_alarm_on snapshot_entities: - light.gateway_light_04cf8cabd77b - parallel: - action: script.turn_on target: entity_id: script.alarm_gateway_light - action: script.turn_on target: entity_id: script.alarm_gateway_sound - action: script.turn_on target: entity_id: script.alarm_tts_yandex_stations - action: timer.start target: entity_id: timer.alarm_gateway_sound data: duration: 1800 - alias: turn_off_alarm id: turn_off_alarm initial_state: true triggers: - trigger: state entity_id: input_boolean.alarm_gateway_button to: 'off' actions: - parallel: - action: script.turn_off target: entity_id: script.alarm_gateway_light - action: script.turn_off target: entity_id: script.alarm_gateway_sound - action: script.turn_off target: entity_id: script.alarm_tts_yandex_stations - action: light.turn_off target: entity_id: light.gateway_light_04cf8cabd77b - action: xiaomi_aqara.stop_ringtone data: gw_mac: secret gateway1_mac - action: timer.cancel target: entity_id: timer.alarm_gateway_sound - choose: - conditions: - '{{ states.group.dynamic_group_gateway_alarm_last_state_disarmed is not none }}' sequence: - variables: entities: '{{ expand(''group.dynamic_group_gateway_alarm_last_state_disarmed'') | map(attribute = ''entity_id'') | list | join('', '') }}' - action: alarm_control_panel.alarm_arm_away target: entity_id: '{{ entities }}' - action: alarm_control_panel.alarm_disarm target: entity_id: '{{ entities }}' - action: group.remove data: object_id: dynamic_group_gateway_alarm_last_state_disarmed - choose: - conditions: - '{{ states.group.dynamic_group_gateway_alarm_last_state_armed_away is not none }}' sequence: - variables: entities: '{{ expand(''group.dynamic_group_gateway_alarm_last_state_armed_away'') | map(attribute = ''entity_id'') | list | join('', '') }}' - action: alarm_control_panel.alarm_disarm target: entity_id: '{{ entities }}' - action: alarm_control_panel.alarm_arm_away target: entity_id: '{{ entities }}' - action: group.remove data: object_id: dynamic_group_gateway_alarm_last_state_armed_away - action: scene.turn_on target: entity_id: scene.before_alarm_on - alias: alarm_gateway_stop_ringtone_timer id: alarm_gateway_stop_ringtone_timer initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.alarm_gateway_sound conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'on' actions: - parallel: - action: script.turn_off target: entity_id: script.alarm_gateway_sound - action: script.turn_off target: entity_id: script.alarm_tts_yandex_stations - action: xiaomi_aqara.stop_ringtone data: gw_mac: secret gateway1_mac - alias: smoke detector alarm to gateway id: smoke detector alarm to gateway initial_state: true triggers: - trigger: state entity_id: - binary_sensor.0x158d0003943639_smoke - binary_sensor.0x158d00039a8358_smoke - binary_sensor.0x158d00039d9398_smoke - binary_sensor.0x158d00045ca483_smoke - binary_sensor.0x00158d00045cd551_smoke to: 'on' conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' actions: - action: input_boolean.turn_on target: entity_id: input_boolean.alarm_gateway_button - alias: smoke detector stop alarm to gateway id: smoke detector stop alarm to gateway initial_state: true triggers: - trigger: state entity_id: - binary_sensor.0x158d0003943639_smoke - binary_sensor.0x158d00039a8358_smoke - binary_sensor.0x158d00039d9398_smoke - binary_sensor.0x158d00045ca483_smoke - binary_sensor.0x00158d00045cd551_smoke from: 'on' to: 'off' conditions: - condition: state entity_id: binary_sensor.0x158d0003943639_smoke state: 'off' - condition: state entity_id: binary_sensor.0x158d00039a8358_smoke state: 'off' - condition: state entity_id: binary_sensor.0x158d00039d9398_smoke state: 'off' - condition: state entity_id: binary_sensor.0x158d00045ca483_smoke state: 'off' - condition: state entity_id: binary_sensor.0x00158d00045cd551_smoke state: 'off' - condition: state entity_id: input_boolean.alarm_gateway_button state: 'on' actions: - action: input_boolean.turn_off target: entity_id: input_boolean.alarm_gateway_button - alias: door and motion alarm to gateway id: door and motion alarm to gateway max_exceeded: silent initial_state: true triggers: - trigger: state entity_id: - binary_sensor.0x158d00054b8d72_motion - binary_sensor.0x158d000566bde7_motion - binary_sensor.0x158d0003953ee9_motion - binary_sensor.0x158d000359304c_contact - binary_sensor.window_childrens_room_group - binary_sensor.window_bed_room_group - binary_sensor.window_kitchen_group - binary_sensor.window_living_room_group to: 'on' - trigger: state entity_id: - sensor.0x158d00054b8d72_illuminance - sensor.0x158d000566bde7_illuminance conditions: - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: armed_away - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' actions: - action: input_boolean.turn_on target: entity_id: input_boolean.alarm_gateway_button - alias: turn_off_alarm_disarmed_control_panel id: turn_off_alarm_disarmed_control_panel initial_state: true triggers: - trigger: state entity_id: alarm_control_panel.signalka_shliuza_alarm to: disarmed - trigger: state entity_id: sensor.0x158d0003a360b6_action to: hold conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'on' actions: - action: input_boolean.turn_off target: entity_id: input_boolean.alarm_gateway_button - alias: wireless switch many tap alarm to gateway id: wireless switch many tap alarm to gateway initial_state: true triggers: - trigger: state entity_id: sensor.0x158d0003a360b6_action to: many conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' actions: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - parallel: - action: input_boolean.turn_on target: entity_id: input_boolean.alarm_gateway_button - action: telegram_bot.send_message data: title: '{{ ''\U0001f6a8'' }} *Сигнализация*' message: Нажатие тревожной кнопки в *детской* target: secret telegram_all_chat_id - action: notify.notify data: title: '{{ ''🚨'' }} Сигнализация' message: Нажатие тревожной кнопки в детской data: ttl: 0 priority: high channel: alarm_stream actions: - action: stop_alarm title: Выключить сирену - action: notify.huawei_lte data: message: 🚨 Нажатие тревожной кнопки в детской target: secret sms_phone_all data: url: http://192.168.8.1/ - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: mobile app telegram notification action turn off alarm id: mobile app telegram notification action turn off alarm initial_state: true triggers: - trigger: event event_type: mobile_app_notification_action event_data: action: stop_alarm - trigger: event id: telegram_callback_stop_alarm event_type: telegram_callback event_data: data: /stop_alarm actions: - choose: - conditions: '{{ is_state(''input_boolean.alarm_gateway_button'', ''on'') }}' sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.alarm_gateway_button - choose: - conditions: '{{ trigger.id == ''telegram_callback_stop_alarm'' }}' sequence: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Выключили сигнализацию - alias: main gateway arm dissarm to others gw id: main gateway arm dissarm to others gw initial_state: true triggers: - trigger: state id: armed entity_id: alarm_control_panel.signalka_shliuza_alarm to: armed_away - trigger: state entity_id: alarm_control_panel.signalka_shliuza_alarm to: disarmed actions: - action: '{{ iif(trigger.id == ''armed'', ''alarm_control_panel.alarm_arm_away'', ''alarm_control_panel.alarm_disarm'') }}' target: entity_id: - alarm_control_panel.54ef44315770_alarm - alarm_control_panel.54ef44cb80fd_alarm - alarm_control_panel.54ef443127b2_alarm - alias: smoke detector alarm to turn off all id: smoke detector alarm to turn off all initial_state: true triggers: - trigger: state entity_id: - binary_sensor.0x158d0003943639_smoke - binary_sensor.0x158d00039a8358_smoke - binary_sensor.0x158d00039d9398_smoke - binary_sensor.0x158d00045ca483_smoke - binary_sensor.0x00158d00045cd551_smoke to: 'on' actions: - action: homeassistant.turn_off target: entity_id: '{{ expand(''group.entity_ids_for_turn_off_by_smoke_detector'') | map(attribute = ''entity_id'') | join('', '') }}' - alias: main gateway arm dissarm from nfc tag hallway id: main gateway arm dissarm from nfc tag hallway initial_state: true triggers: - trigger: tag tag_id: - 73aef2e2-722b-418d-b20a-24e84eda330e device_id: - f4de6186902849d0845c4e2552d3531d conditions: - '{{ state_attr(this.entity_id, ''current'') | int(0) == 0 }}' actions: - choose: - conditions: - '{{ is_state(''alarm_control_panel.signalka_shliuza_alarm'', ''disarmed'') }}' sequence: - wait_for_trigger: - trigger: tag tag_id: - 73aef2e2-722b-418d-b20a-24e84eda330e timeout: 15 - if: - '{{ wait.trigger = None }}' then: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id message: '{{ ''🔇 Отменено включение сигнализации'' }}' else: - action: alarm_control_panel.alarm_arm_away target: entity_id: alarm_control_panel.signalka_shliuza_alarm default: - action: alarm_control_panel.alarm_disarm target: entity_id: alarm_control_panel.signalka_shliuza_alarm - alias: gateway alarm to turn on to all gateways id: gateway alarm to turn on to all gateways max_exceeded: silent initial_state: true triggers: - trigger: state entity_id: - alarm_control_panel.54ef44315770_alarm - alarm_control_panel.54ef44cb80fd_alarm - alarm_control_panel.54ef443127b2_alarm to: triggered - trigger: state entity_id: input_boolean.alarm_gateway_button to: 'on' conditions: - '{{ now() - state_attr(this.entity_id, ''last_triggered'') > timedelta(seconds = 5) }}' actions: - variables: entities: '{{ states.alarm_control_panel | selectattr(''state'', ''in'', [''armed_away'', ''disarmed'']) | rejectattr(''entity_id'', ''eq'', ''alarm_control_panel.signalka_shliuza_alarm'') | map(attribute = ''entity_id'') | list | to_json }}' - parallel: - choose: - conditions: - '{{ entities | from_json | count > 0 }}' sequence: - action: alarm_control_panel.alarm_trigger target: entity_id: '{{ entities | from_json | join('', '') }}' - choose: - conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' sequence: - action: input_boolean.turn_on target: entity_id: input_boolean.alarm_gateway_button - alias: input number target humidity cb1 changed id: input number target humidity cb1 changed initial_state: true mode: queued max: 25 triggers: - trigger: state entity_id: input_number.zhimi_humidifier_cb1_target_humidity actions: - action: humidifier.set_humidity target: entity_id: humidifier.zhimi_humidifier_cb1 data: humidity: '{{ states("input_number.zhimi_humidifier_cb1_target_humidity") | int(0) }}' - alias: sensor target humidity cb1 changed state id: sensor target humidity cb1 changed state initial_state: true mode: single max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', none, null] }}' triggers: - trigger: state entity_id: sensor.zhimi_humidifier_cb1_target_humidity conditions: - condition: template value_template: "{{ trigger.to_state.state is defined and\n trigger.to_state.state\ \ not in not_has_state and \n trigger.to_state.state != trigger.from_state.state\n\ }}\n" actions: - action: input_number.set_value target: entity_id: input_number.zhimi_humidifier_cb1_target_humidity data: value: "{% if trigger.to_state.state | int(0) != 0 -%}\n {{ trigger.to_state.state\ \ | int(0) }}\n{%- else -%}\n 40\n{%- endif %}" - alias: input number target humidity ca4 changed id: input number target humidity ca4 changed initial_state: true mode: queued max: 25 triggers: - trigger: state entity_id: input_number.zhimi_humidifier_ca4_target_humidity actions: - action: humidifier.set_humidity target: entity_id: humidifier.zhimi_humidifier_ca4 data: humidity: '{{ states("input_number.zhimi_humidifier_ca4_target_humidity") | int(0) }}' - alias: sensor target humidity ca4 changed state id: sensor target humidity ca4 changed state initial_state: true mode: single max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', none, null] }}' triggers: - trigger: state entity_id: sensor.zhimi_humidifier_ca4_target_humidity conditions: - condition: template value_template: "{{ trigger.to_state.state is defined and\n trigger.to_state.state\ \ not in not_has_state and \n trigger.to_state.state != trigger.from_state.state\n\ }}\n" actions: - action: input_number.set_value target: entity_id: input_number.zhimi_humidifier_ca4_target_humidity data: value: "{% if trigger.to_state.state | int(0) != 0 -%}\n {{ trigger.to_state.state\ \ | int(0) }}\n{%- else -%}\n 40\n{%- endif %}" - alias: air humidifier day and night speed id: air humidifier day and night speed mode: queued max: 25 triggers: - trigger: time at: '22:00:00' - trigger: time at: 08:00:00 actions: - parallel: - choose: - conditions: - condition: state entity_id: humidifier.zhimi_humidifier_cb1 state: 'on' sequence: - action: humidifier.set_mode target: entity_id: humidifier.zhimi_humidifier_cb1 data: speed: "{% if '08:00:00' <= as_timestamp(trigger.now, 0) | timestamp_custom('%H:%M:%S',\ \ true, 0) < '22:00:00' %}\n Auto\n{% else %} \n Silent \n{% endif\ \ %}" - choose: - conditions: - condition: state entity_id: humidifier.zhimi_humidifier_ca4 state: 'on' sequence: - action: humidifier.set_mode target: entity_id: humidifier.zhimi_humidifier_ca4 data: speed: "{% if '08:00:00' <= as_timestamp(trigger.now, 0) | timestamp_custom('%H:%M:%S',\ \ true, 0) < '22:00:00' %}\n Auto\n{% else %} \n Low \n{% endif\ \ %}" - alias: turn on off climate devices childrens room window open close id: turn on off climate devices childrens room window open close mode: single max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable''] }}' triggers: - trigger: state entity_id: binary_sensor.window_childrens_room_group from: 'off' to: 'on' for: 00:05:00 - trigger: state entity_id: binary_sensor.window_childrens_room_group from: 'on' to: 'off' for: 00:01:15 conditions: "{{ \n trigger.to_state.state == 'on' or \n is_state('input_boolean.auto_triggered_fan_window_childrens_room',\ \ 'on') or \n is_state('input_boolean.auto_triggered_valve_window_childrens_room',\ \ 'on')\n}}\n" actions: - parallel: - sequence: - if: - '{{ states(''humidifier.zhimi_humidifier_ca4'') in not_has_state }}' then: - wait_for_trigger: - trigger: state entity_id: humidifier.zhimi_humidifier_ca4 from: - unknown - unavailable timeout: 75 - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('humidifier.zhimi_humidifier_ca4',\ \ 'on') \n or trigger.to_state.state == 'off' and is_state('humidifier.zhimi_humidifier_ca4',\ \ 'off')\n and is_state('input_boolean.auto_triggered_fan_window_childrens_room',\ \ 'on')\n}}\n" sequence: - action: "{% if trigger.to_state.state == 'on' -%}\n humidifier.turn_off\n\ {%- else -%}\n humidifier.turn_on\n{%- endif %}\n" target: entity_id: humidifier.zhimi_humidifier_ca4 - action: input_boolean.toggle target: entity_id: input_boolean.auto_triggered_fan_window_childrens_room - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off'\n and is_state('input_boolean.auto_triggered_fan_window_childrens_room',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_fan_window_childrens_room - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('climate.0x5c0272fffec89454',\ \ 'auto') \n or trigger.to_state.state == 'off' and is_state('climate.0x5c0272fffec89454',\ \ 'off') \n and is_state('input_boolean.auto_triggered_valve_window_childrens_room',\ \ 'on')\n}}\n" sequence: - action: climate.set_hvac_mode target: entity_id: climate.0x5c0272fffec89454 data: hvac_mode: "{% if trigger.to_state.state == 'on' -%}\n off\n{%- else\ \ -%}\n auto\n{%- endif %}\n" - action: "{% if trigger.to_state.state == 'off' -%}\n input_boolean.turn_off\n\ {%- else -%}\n input_boolean.turn_on\n{%- endif %}\n" target: entity_id: input_boolean.auto_triggered_valve_window_childrens_room - action: climate.set_preset_mode target: entity_id: climate.0x5c0272fffec89454 data: preset_mode: manual - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off' and is_state('climate.0x5c0272fffec89454',\ \ 'auto') \n and is_state('input_boolean.auto_triggered_valve_window_childrens_room',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_valve_window_childrens_room - alias: turn on off climate devices bed room window open close id: turn on off climate devices bed room window open close mode: single max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable''] }}' triggers: - trigger: state entity_id: binary_sensor.window_bed_room_group from: 'off' to: 'on' for: 00:05:00 - trigger: state entity_id: binary_sensor.window_bed_room_group from: 'on' to: 'off' for: 00:01:15 conditions: "{{ \n trigger.to_state.state == 'on' or \n is_state('input_boolean.auto_triggered_fan_window_bed_room',\ \ 'on') or \n is_state('input_boolean.auto_triggered_valve_window_bed_room',\ \ 'on')\n}}\n" actions: - parallel: - sequence: - if: - '{{ states(''humidifier.zhimi_humidifier_cb1'') in not_has_state }}' then: - wait_for_trigger: - trigger: state entity_id: humidifier.zhimi_humidifier_cb1 from: - unknown - unavailable timeout: 75 - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('humidifier.zhimi_humidifier_cb1',\ \ 'on') \n or trigger.to_state.state == 'off' and is_state('humidifier.zhimi_humidifier_cb1',\ \ 'off')\n and is_state('input_boolean.auto_triggered_fan_window_bed_room',\ \ 'on')\n}}\n" sequence: - action: "{% if trigger.to_state.state == 'on' -%}\n humidifier.turn_off\n\ {%- else -%}\n humidifier.turn_on\n{%- endif %}\n" target: entity_id: humidifier.zhimi_humidifier_cb1 - action: "{% if trigger.to_state.state == 'off' -%}\n input_boolean.turn_off\n\ {%- else -%}\n input_boolean.turn_on\n{%- endif %}\n" target: entity_id: input_boolean.auto_triggered_fan_window_bed_room - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off'\n and is_state('input_boolean.auto_triggered_fan_window_bed_room',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_fan_window_bed_room - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('climate.0x60a423fffe968719',\ \ 'auto') \n or trigger.to_state.state == 'off' and is_state('climate.0x60a423fffe968719',\ \ 'off') \n and is_state('input_boolean.auto_triggered_valve_window_bed_room',\ \ 'on')\n}}\n" sequence: - action: climate.set_hvac_mode target: entity_id: climate.0x60a423fffe968719 data: hvac_mode: "{% if trigger.to_state.state == 'on' -%}\n off\n{%- else\ \ -%}\n auto\n{%- endif %}\n" - action: "{% if trigger.to_state.state == 'off' -%}\n input_boolean.turn_off\n\ {%- else -%}\n input_boolean.turn_on\n{%- endif %}\n" target: entity_id: input_boolean.auto_triggered_valve_window_bed_room - action: climate.set_preset_mode target: entity_id: climate.0x60a423fffe968719 data: preset_mode: manual - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off' and is_state('climate.0x60a423fffe968719',\ \ 'auto') \n and is_state('input_boolean.auto_triggered_valve_window_bed_room',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_valve_window_bed_room - alias: turn on off climate devices kitchen window open close id: turn on off climate devices kitchen window open close mode: single max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.window_kitchen_group from: 'off' to: 'on' for: 00:05:00 - trigger: state entity_id: binary_sensor.window_kitchen_group from: 'on' to: 'off' for: 00:01:15 conditions: "{{ \n trigger.to_state.state == 'on' or \n is_state('input_boolean.auto_triggered_valve_window_kitchen',\ \ 'on') or\n is_state('input_boolean.auto_triggered_heating_floor_window_kitchen',\ \ 'on')\n}}\n" actions: - parallel: - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('climate.0x5c0272fffe8de819',\ \ 'auto') \n or trigger.to_state.state == 'off' and is_state('climate.0x5c0272fffe8de819',\ \ 'off') \n and is_state('input_boolean.auto_triggered_valve_window_kitchen',\ \ 'on')\n}}\n" sequence: - action: climate.set_hvac_mode target: entity_id: climate.0x5c0272fffe8de819 data: hvac_mode: "{% if trigger.to_state.state == 'on' -%}\n off\n{%- else\ \ -%}\n auto\n{%- endif %}\n" - action: "{% if trigger.to_state.state == 'off' -%}\n input_boolean.turn_off\n\ {%- else -%}\n input_boolean.turn_on\n{%- endif %}\n" target: entity_id: input_boolean.auto_triggered_valve_window_kitchen - action: climate.set_preset_mode target: entity_id: climate.0x5c0272fffe8de819 data: preset_mode: manual - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off' and is_state('climate.0x5c0272fffe8de819',\ \ 'auto') \n and is_state('input_boolean.auto_triggered_valve_window_kitchen',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_valve_window_kitchen - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('climate.devireg_k',\ \ 'heat') \n or trigger.to_state.state == 'off' and is_state('climate.devireg_k',\ \ 'off') \n and is_state('input_boolean.auto_triggered_heating_floor_window_kitchen',\ \ 'on')\n}}\n" sequence: - action: climate.set_hvac_mode target: entity_id: climate.devireg_k data: hvac_mode: '{{ iif(trigger.to_state.state == ''on'', ''off'', ''heat'') }}' - action: '{{ iif(trigger.to_state.state == ''off'', ''input_boolean.turn_off'' , ''input_boolean.turn_on'') }}' target: entity_id: input_boolean.auto_triggered_heating_floor_window_kitchen - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off' and is_state('climate.devireg_k',\ \ 'on') \n and is_state('input_boolean.auto_triggered_heating_floor_window_kitchen',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_heating_floor_window_kitchen - alias: turn on off climate devices living room window open close id: turn on off climate devices living room window open close mode: single max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.window_living_room_group from: 'off' to: 'on' for: 00:05:00 - trigger: state entity_id: binary_sensor.window_living_room_group from: 'on' to: 'off' for: 00:01:15 conditions: "{{ \n trigger.to_state.state == 'on' or\n is_state('input_boolean.auto_triggered_ac_window_living_room',\ \ 'on') or \n is_state('input_boolean.auto_triggered_valve_window_living_room',\ \ 'on')\n}}\n" actions: - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and states('climate.avatto_living_room_ac')\ \ == 'cool'\n or trigger.to_state.state == 'off' and is_state('climate.avatto_living_room_ac',\ \ 'off')\n and is_state('input_boolean.auto_triggered_ac_window_living_room',\ \ 'on')\n}}\n" sequence: - action: climate.set_hvac_mode target: entity_id: climate.avatto_living_room_ac data: hvac_mode: "{% if trigger.to_state.state == 'on' -%}\n off\n{%- else -%}\n\ \ cool\n{%- endif %}\n" - action: "{% if trigger.to_state.state == 'off' -%}\n input_boolean.turn_off\n\ {%- else -%}\n input_boolean.turn_on\n{%- endif %}\n" target: entity_id: input_boolean.auto_triggered_ac_window_living_room - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off' and is_state('climate.avatto_living_room_ac',\ \ 'cool')\n and is_state('input_boolean.auto_triggered_ac_window_living_room',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_ac_window_living_room - choose: - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'on' and is_state('climate.0x5c0272fffec9db22',\ \ 'auto') \n or trigger.to_state.state == 'off' and is_state('climate.0x5c0272fffec9db22',\ \ 'off') \n and is_state('input_boolean.auto_triggered_valve_window_living_room',\ \ 'on')\n}}\n" sequence: - action: climate.set_hvac_mode target: entity_id: climate.0x5c0272fffec9db22 data: hvac_mode: "{% if trigger.to_state.state == 'on' -%}\n off\n{%- else -%}\n\ \ auto\n{%- endif %}\n" - action: "{% if trigger.to_state.state == 'off' -%}\n input_boolean.turn_off\n\ {%- else -%}\n input_boolean.turn_on\n{%- endif %}\n" target: entity_id: input_boolean.auto_triggered_valve_window_living_room - action: climate.set_preset_mode target: entity_id: climate.0x5c0272fffec9db22 data: preset_mode: manual - conditions: - condition: template value_template: "{{ \n trigger.to_state.state == 'off' and is_state('climate.0x5c0272fffec9db22',\ \ 'auto') \n and is_state('input_boolean.auto_triggered_valve_window_living_room',\ \ 'on')\n}}\n" sequence: - action: input_boolean.turn_off target: entity_id: input_boolean.auto_triggered_valve_window_living_room - alias: restart socket 2 for bedroom air humidifier unavailable id: restart socket 2 for bedroom air humidifier unavailable initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: humidifier.zhimi_humidifier_cb1 to: null - trigger: homeassistant event: start conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - '{{ not has_value(''humidifier.zhimi_humidifier_cb1'') }}' - condition: state entity_id: switch.0x60a423fffef8d41a state: 'on' actions: - wait_template: '{{ has_value(''humidifier.zhimi_humidifier_cb1'') }}' timeout: 00:05:00 - choose: - conditions: '{{ wait.completed == false and is_state(''binary_sensor.local_network_availability'', ''on'') }}' sequence: - action: switch.turn_off target: entity_id: switch.0x60a423fffef8d41a - delay: seconds: 5 - action: switch.turn_on target: entity_id: switch.0x60a423fffef8d41a - alias: notification public ip compare debug id: notification public ip compare debug trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', None, null, ''''] }}' triggers: - trigger: state entity_id: sensor.myip_keenetic conditions: "{{ trigger.from_state.state not in not_has_state and\n trigger.to_state.state\ \ not in not_has_state and\n trigger.from_state.state = trigger.to_state.state\ \ and\n trigger.to_state.state = states('sensor.myip')\n}}\n" actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''\U0001f4f6'' }} *Трекинг устройств*' message: Внешний IP-адрес keendns `{{ trigger.to_state.state }}` не равен физическому `{{ states('sensor.myip') }}` - alias: turn_on_doorbell id: turn_on_doorbell initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: sensor.0x158d00045a78af_action conditions: - condition: state entity_id: timer.doorbell_timer_restart_automation state: idle - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: disarmed - condition: template value_template: '{{ trigger.to_state.state not in [''release'', ''unavailable'', ''unknown'', '''', ''None''] }} ' actions: - action: timer.start target: entity_id: timer.doorbell_timer_restart_automation - parallel: - sequence: - variables: string_now_time: '{{ now().strftime(''%Y%m%d-%H%M%S'') }}' - action: camera.snapshot target: entity_id: camera.hallway_1_fluent data: filename: /share/DS_Obmen/Doorbeel_Snapshots/snapshot_hallway_1_{{ string_now_time }}.jpg - action: telegram_bot.send_photo data: file: /share/DS_Obmen/Doorbeel_Snapshots/snapshot_hallway_1_{{ string_now_time }}.jpg caption: '{{ ''🔔'' }} *Кто-то звонит в дверь*' target: secret telegram_all_chat_id - action: telegram_bot.send_video data: url: http://localhost:1984/api/stream.mp4?src=hallway_1_sub&mp4=flac&duration=5&filename=record.mp4 caption: '{{ ''🔔'' }} *Кто-то звонит в дверь*' target: secret telegram_enzokot_chat_id - sequence: - condition: - condition: time after: '8:00:00' before: '21:30:00' - action: xiaomi_aqara.stop_ringtone data: gw_mac: secret gateway1_mac - action: xiaomi_aqara.play_ringtone data: gw_mac: secret gateway1_mac ringtone_id: 10001 ringtone_vol: 45 - sequence: - condition: - condition: state entity_id: automation.light_gateway_toggle attribute: current state: 0 - action: scene.create data: scene_id: before_doorbell_light snapshot_entities: - light.gateway_light_04cf8cabd77b - repeat: while: - condition: template value_template: '{{ repeat.index <= 3 }}' sequence: - action: light.turn_on target: entity_id: light.gateway_light_04cf8cabd77b data: rgb_color: - 255 - 128 - 0 brightness: 128 - delay: milliseconds: 150 - action: light.turn_off target: entity_id: light.gateway_light_04cf8cabd77b - delay: milliseconds: 50 - action: light.turn_on target: entity_id: light.gateway_light_04cf8cabd77b data: rgb_color: - 255 - 128 - 0 brightness: 128 - delay: milliseconds: 150 - action: light.turn_off target: entity_id: light.gateway_light_04cf8cabd77b - action: scene.turn_on target: entity_id: scene.before_doorbell_light - sequence: - condition: - condition: time after: '8:00:00' before: '21:30:00' - parallel: - action: script.alice_custom_tts_volume data: entity: media_player.yandex_station_ff98f029b620413b35e5e278 text: Кто то звонит в дверь vol_level: '0.65' - action: script.alice_custom_tts_volume data: entity: media_player.yandex_station_m00ka4300h99tr text: Кто то звонит в дверь vol_level: '0.45' - alias: dynamic group sensor battery id: dynamic group sensor battery initial_state: true mode: restart triggers: - trigger: event event_type: entity_registry_updated - trigger: homeassistant event: start actions: - action: group.set data: name: dynamic group sensor battery object_id: dynamic_group_sensor_battery icon: mdi:battery-unknown entities: "{%- set datanames = namespace(entity_name=[]) -%} {%- \n for state\ \ in states.sensor \n if is_state_attr(state.entity_id, 'device_class',\ \ 'battery') and\n (state.entity_id.endswith(\"_battery\") or state.entity_id.endswith(\"\ _battery_level\"))\n%}\n {% set datanames.entity_name = datanames.entity_name\ \ + [state.entity_id] -%}\n{%- endfor %} {%- \n for state in states.binary_sensor\ \ \n if is_state_attr(state.entity_id, 'device_class', 'battery') and\n\ \ state.entity_id.endswith(\"_low_battery\")\n%}\n {% set datanames.entity_name\ \ = datanames.entity_name + [state.entity_id] -%}\n{%- endfor %} {{ datanames.entity_name\ \ | list | join(', ')}}" - alias: dynamic group sensor linkquality id: dynamic group sensor linkquality initial_state: true mode: restart triggers: - trigger: event event_type: entity_registry_updated - trigger: homeassistant event: start conditions: - '{{ states.sensor | map(attribute=''entity_id'') | list | regex_findall(find=''(_linkquality|_zigbee)'', ignorecase=True) | length > 0 }}' actions: - action: group.set data: name: dynamic group sensor linkquality object_id: dynamic_group_sensor_linkquality icon: mdi:signal entities: "{%- \n for state in states.sensor \n if state.entity_id.endswith(\"\ _linkquality\") or state.entity_id.endswith(\"_zigbee\")\n%}\n {{ state.entity_id\ \ }}{%- if not loop.last -%}, {%- endif -%}\n{%- endfor %}" - alias: dynamic group sensor last seen id: dynamic group sensor last seen initial_state: true mode: restart triggers: - trigger: event event_type: entity_registry_updated - trigger: homeassistant event: start conditions: - '{{ states.sensor | map(attribute=''entity_id'') | list | regex_findall(find=''(_last_seen|_zigbee)'', ignorecase=True) | length > 0 }}' actions: - action: group.set data: name: dynamic group sensor last seen object_id: dynamic_group_sensor_last_seen icon: mdi:clock entities: "{%- \n for state in states.sensor \n if state.entity_id.endswith(\"\ _last_seen\") or state.entity_id.endswith(\"_zigbee\")\n%}\n {{ state.entity_id\ \ }}{%- if not loop.last -%}, {%- endif -%}\n{%- endfor %}" - alias: dynamic group gateway alarm last state id: dynamic group gateway alarm last state initial_state: true mode: queued triggers: - trigger: state entity_id: - alarm_control_panel.54ef44315770_alarm - alarm_control_panel.54ef44cb80fd_alarm - alarm_control_panel.54ef443127b2_alarm to: triggered - trigger: state entity_id: input_boolean.alarm_gateway_button to: 'on' conditions: - condition: or conditions: - '{{ states.alarm_control_panel | selectattr(''state'', ''in'', [''armed_away'', ''disarmed'']) | rejectattr(''entity_id'', ''eq'', ''alarm_control_panel.signalka_shliuza_alarm'') | list | count > 0 }}' - '{{ trigger.from_state.state in [''armed_away'', ''disarmed''] }}' actions: - parallel: - choose: - conditions: - "{{ trigger.from_state.state == 'armed_away'\n or states.alarm_control_panel\ \ \n| selectattr('state', 'eq', 'armed_away') | rejectattr('entity_id',\ \ 'eq', 'alarm_control_panel.signalka_shliuza_alarm') | list | count >\ \ 0 }}" sequence: - action: group.set data: name: dynamic group gateway alarm last state armed away object_id: dynamic_group_gateway_alarm_last_state_armed_away icon: mdi:shield-lock entities: "{% set data = namespace(entities=[]) %} {% set data.entities\ \ = data.entities + \n states.alarm_control_panel \n | selectattr('state',\ \ 'eq', 'armed_away') \n | rejectattr('entity_id', 'eq', 'alarm_control_panel.signalka_shliuza_alarm')\ \ \n | map(attribute = 'entity_id') | list\n%} {% if trigger.from_state.state\ \ == 'armed_away' %}\n {% set data.entities = data.entities + [trigger.entity_id]\ \ %}\n{% endif %} {% if states.group.dynamic_group_gateway_alarm_last_state_armed_away\ \ is not none %}\n {% set data.entities = data.entities + expand('group.dynamic_group_gateway_alarm_last_state_armed_away')\ \ | map(attribute = 'entity_id') | list %}\n{% endif %} {{ data.entities\ \ | unique | join(', ') }}" - choose: - conditions: - "{{ trigger.from_state.state == 'disarmed'\n or states.alarm_control_panel\ \ \n| selectattr('state', 'eq', 'disarmed') | rejectattr('entity_id', 'eq',\ \ 'alarm_control_panel.signalka_shliuza_alarm') | list | count > 0 }}" sequence: - action: group.set data: name: dynamic group gateway alarm last state disarmed object_id: dynamic_group_gateway_alarm_last_state_disarmed icon: mdi:shield-lock entities: "{% set data = namespace(entities=[]) %} {% set data.entities\ \ = data.entities + \n states.alarm_control_panel \n | selectattr('state',\ \ 'eq', 'disarmed') \n | rejectattr('entity_id', 'eq', 'alarm_control_panel.signalka_shliuza_alarm')\ \ \n | map(attribute = 'entity_id') | list\n%} {% if trigger.from_state.state\ \ == 'disarmed' %}\n {% set data.entities = data.entities + [trigger.entity_id]\ \ %}\n{% endif %} {% if states.group.dynamic_group_gateway_alarm_last_state_disarmed\ \ is not none %}\n {% set data.entities = data.entities + expand('group.dynamic_group_gateway_alarm_last_state_disarmed')\ \ | map(attribute = 'entity_id') | list %}\n{% endif %} {{ data.entities\ \ | unique | join(', ') }}" - alias: install update html5 push notifications id: install update html5 push notifications initial_state: true mode: parallel triggers: - trigger: event event_type: html5_notification.clicked event_data: action: install_update conditions: - '{{ trigger.event.data[''tag''] | length > 0 }}' actions: - variables: entity: '{{- trigger.event.data[''tag''] | replace(''update_available_notify_'', ''update.'') -}}' - if: - '{{ is_state(entity, ''on'') and is_state_attr(entity, ''in_progress'', false) }}' then: - action: update.install target: entity_id: '{{- entity -}}' data: backup: '{{ ''{:0=64b}''.format(state_attr(entity, ''supported_features''))[-4] == ''1'' }}' - alias: open shades kitchen on outside light sensor id: open shades kitchen on outside light sensor mode: restart trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', ''''] }}' triggers: - trigger: numeric_state entity_id: sensor.0x54ef4410000ebba0_illuminance above: 250 for: minutes: 10 - trigger: numeric_state id: sun entity_id: sun.sun attribute: elevation above: 4 conditions: - condition: template value_template: "{{ \n trigger.id == 'sun' or\n trigger.from_state.state not\ \ in not_has_state and \n trigger.from_state.state != trigger.to_state.state\n\ }}" - '{{ is_state_attr(''sun.sun'', ''rising'', true) }}' - '{{ expand(''cover.cover_group_kitchen'') | selectattr(''state'', ''eq'', ''open'') | map(attribute=''entity_id'') | list | length == 0 }}' actions: - action: script.auto_cover_open_close_kitchen data: servicename: cover.open_cover groupname: cover.cover_group_kitchen statename: open - alias: close shades kitchen on outside light sensor id: close shades kitchen on outside light sensor mode: restart trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', ''''] }}' triggers: - trigger: numeric_state entity_id: sensor.0x54ef4410000ebba0_illuminance below: 150 for: minutes: 10 conditions: - condition: template value_template: "{{ \n trigger.from_state.state not in not_has_state and \n \ \ trigger.from_state.state != trigger.to_state.state\n}}" - '{{ state_attr(''sun.sun'', ''elevation'') | float(0.0) <= iif(states(''weather.kotletochka_home'') in [''rainy'', ''pouring'', ''cloudy'', ''lightning'', ''lightning-rainy'', ''partlycloudy''], 15, 7, 7) }}' - '{{ is_state_attr(''sun.sun'', ''rising'', false) }}' - '{{ expand(''cover.cover_group_kitchen'') | selectattr(''state'', ''eq'', ''closed'') | map(attribute=''entity_id'') | list | length == 0 }}' actions: - action: script.auto_cover_open_close_kitchen data: servicename: cover.close_cover groupname: cover.cover_group_kitchen statename: closed - alias: close shades kitchen on sun and min outside lux id: close shades kitchen on sun and min outside lux mode: restart triggers: - trigger: numeric_state entity_id: sun.sun attribute: elevation below: 2 conditions: - '{{ states(''sensor.0x54ef4410000ebba0_illuminance'') | int(0) <= 250 }}' - '{{ is_state_attr(''sun.sun'', ''rising'', false) }}' - '{{ expand(''cover.cover_group_kitchen'') | selectattr(''state'', ''eq'', ''closed'') | map(attribute=''entity_id'') | list | length == 0 }}' actions: - action: script.auto_cover_open_close_kitchen data: servicename: cover.close_cover groupname: cover.cover_group_kitchen statename: closed - alias: open shades living room on outside light sensor id: open shades living room on outside light sensor mode: restart trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', ''''] }}' triggers: - trigger: numeric_state entity_id: sensor.0x54ef4410000ebba0_illuminance above: 250 for: minutes: 10 - trigger: numeric_state id: sun entity_id: sun.sun attribute: elevation above: 4 conditions: - condition: template value_template: "{{ \n trigger.id == 'sun' or\n trigger.from_state.state not\ \ in not_has_state and \n trigger.from_state.state != trigger.to_state.state\n\ }}" - '{{ is_state_attr(''sun.sun'', ''rising'', true) }}' - '{{ expand(''cover.cover_group_living_room'') | selectattr(''state'', ''eq'', ''open'') | map(attribute=''entity_id'') | list | length == 0 }}' actions: - action: script.auto_cover_open_close_living_room data: servicename: cover.open_cover groupname: cover.cover_group_living_room statename: open - alias: close shades living room on outside light sensor id: close shades living room on outside light sensor mode: restart trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', ''''] }}' triggers: - trigger: numeric_state entity_id: sensor.0x54ef4410000ebba0_illuminance below: 150 for: minutes: 10 conditions: - condition: template value_template: "{{ \n trigger.from_state.state not in not_has_state and \n \ \ trigger.from_state.state != trigger.to_state.state\n}}" - '{{ state_attr(''sun.sun'', ''elevation'') | float(0.0) <= iif(states(''weather.kotletochka_home'') in [''rainy'', ''pouring'', ''cloudy'', ''lightning'', ''lightning-rainy'', ''partlycloudy''], 15, 7, 7) }}' - '{{ is_state_attr(''sun.sun'', ''rising'', false) }}' - '{{ expand(''cover.cover_group_living_room'') | selectattr(''state'', ''eq'', ''closed'') | map(attribute=''entity_id'') | list | length == 0 }}' actions: - action: script.auto_cover_open_close_living_room data: servicename: cover.close_cover groupname: cover.cover_group_living_room statename: closed - alias: close shades living room on sun and min outside lux id: close shades living room on sun and min outside lux mode: restart triggers: - trigger: numeric_state entity_id: sun.sun attribute: elevation below: 2 conditions: - '{{ states(''sensor.0x54ef4410000ebba0_illuminance'') | int(0) <= 250 }}' - '{{ is_state_attr(''sun.sun'', ''rising'', false) }}' - '{{ expand(''cover.cover_group_living_room'') | selectattr(''state'', ''eq'', ''closed'') | map(attribute=''entity_id'') | list | length == 0 }}' actions: - action: script.auto_cover_open_close_living_room data: servicename: cover.close_cover groupname: cover.cover_group_living_room statename: closed - alias: reply pong to ping id: reply pong to ping initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_command event_data: command: /ping actions: - parallel: - action: notify.notify data: title: ℹ️ Check notification's message: pong - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.id }}' - action: telegram_bot.send_message data: target: '{{ trigger.event.data.chat_id }}' message: ℹ️ pong - action: notify.huawei_lte data: message: ℹ️ pong target: secret sms_phone_enzokot data: url: http://192.168.8.1/ - action: notify.html5 data: title: ℹ️ Check notification's message: pong - action: notify.email_enzokot_ha data: title: ℹ️ Check notification's message: pong - alias: keyboard tuc tuc gateway id: keyboard tuc tuc gateway initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_command event_data: command: /tuctuc actions: - parallel: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.id }}' - action: telegram_bot.send_message data: target: '{{ trigger.event.data.chat_id }}' message: '{{ ''\U0001f4e2'' }} С уровнем громкости:' inline_keyboard: - Тихо:/minlevelsound - Средне:/avrlevelsound, Громко:/maxlevelsound - alias: keyboard alarm home id: keyboard alarm home initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_command event_data: command: /home_alarm actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.id }}' - action: telegram_bot.send_message data: target: '{{ trigger.event.data.chat_id }}' message: "{% if is_state('alarm_control_panel.signalka_shliuza_alarm', 'armed_away')\ \ -%}\n {{ '\\U0001f509' }} Сигнализация *включена*\n{%- else -%}\n \ \ {{ '\\U0001f507' }} Сигнализация *выключена*\n{%- endif %}" inline_keyboard: "{% if is_state('alarm_control_panel.signalka_shliuza_alarm',\ \ 'armed_away') -%}\n Выключить:/alarm_home_disarm\n{%- else -%}\n Включить:/alarm_home_arm\n\ {%- endif %}" - alias: do alarm change state id: do alarm change state initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /alarm_home_disarm - trigger: event event_type: telegram_callback event_data: data: /alarm_home_arm actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: "{% if trigger.event.data.command == '/alarm_home_disarm' -%}\n alarm_control_panel.alarm_disarm\n\ {%- else -%}\n alarm_control_panel.alarm_arm_away\n{%- endif %}" target: entity_id: alarm_control_panel.signalka_shliuza_alarm - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: "{% if trigger.event.data.command == '/alarm_home_disarm' -%}\n Выключили\ \ сигнализацию\n{%- else -%}\n Включили сигнализацию\n{%- endif %}" - alias: do tuc tuc gateway id: do tuc tuc gateway initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /minlevelsound - trigger: event event_type: telegram_callback event_data: data: /avrlevelsound - trigger: event event_type: telegram_callback event_data: data: /maxlevelsound actions: - parallel: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: xiaomi_aqara.play_ringtone data: gw_mac: secret gateway1_mac ringtone_id: 11 ringtone_vol: "{%- if trigger.event.data.data == \"/maxlevelsound\" -%}\n\ \ 50\n{%- elif trigger.event.data.data == \"/avrlevelsound\" -%}\n 25\n\ {%- else -%}\n 3\n{%- endif -%}" - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Постучали шлюзом - alias: del keyboard sync yeelight ceiling to switch id: del keyboard sync yeelight ceiling to switch initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /changelight - trigger: event event_type: telegram_callback event_data: data: /nochangelight - trigger: event event_type: telegram_callback event_data: data: /ignoringchangelight actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - alias: no key sync yeelight ceiling to switch id: no key sync yeelight ceiling to switch initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /nochangelight actions: - action: automation.turn_on target: entity_id: automation.sync_yeelight_ceiling_cr_to_switch - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Проверим состояние позже - alias: ignor key sync yeelight ceiling to switch id: ignor key sync yeelight ceiling to switch mode: single max_exceeded: silent initial_state: true triggers: - trigger: event event_type: telegram_callback event_data: data: /ignoringchangelight actions: - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Отключили проверку - alias: change keyboard sync yeelight ceiling to switch id: change keyboard sync yeelight ceiling to switch mode: single max_exceeded: silent initial_state: true triggers: - trigger: event event_type: telegram_callback event_data: data: /changelight conditions: - condition: or conditions: - condition: and conditions: - condition: state entity_id: binary_sensor.0x158d0003f37a0f_contact state: 'on' - condition: state entity_id: light.yeelight_ceiling_cr state: 'off' - condition: and conditions: - condition: state entity_id: binary_sensor.0x158d0003f37a0f_contact state: 'off' - condition: state entity_id: light.yeelight_ceiling_cr state: 'on' actions: - parallel: - action: light.toggle target: entity_id: light.yeelight_ceiling_cr - action: automation.turn_on target: entity_id: automation.sync_yeelight_ceiling_cr_to_switch - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Изменили состояние - alias: vacuum chita answer key find vacuum id: vacuum chita answer key find vacuum mode: single max_exceeded: silent initial_state: true triggers: - trigger: event event_type: telegram_callback event_data: data: /findvacuum actions: - action: vacuum.locate target: entity_id: vacuum.xiaomi_vacuum_cleaner - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Включили поиск Степы - alias: keyboard vacuum start cleaning id: keyboard vacuum start cleaning mode: single max_exceeded: silent initial_state: true triggers: - trigger: event event_type: telegram_command event_data: command: /vacuum actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.id }}' - action: telegram_bot.send_message data: target: '{{ trigger.event.data.chat_id }}' message: '{{ ''\U0000231b'' }} Отправить убирать:' inline_keyboard: - Сейчас:/vacuumnow, Через 10 мин.:/vacuum10, Через 20 мин.:/vacuum20 - Отменить уборку:/vacuumcancel, Выслать карту:/sendmap - alias: vacuum start cleaning id: vacuum start cleaning initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /vacuumnow actions: - action: vacuum.start target: entity_id: vacuum.xiaomi_vacuum_cleaner - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Пылесос отправили на уборку - alias: vacuum later start cleaning id: vacuum later start cleaning initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /vacuum10 - trigger: event event_type: telegram_callback event_data: data: /vacuum20 actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: timer.start target: entity_id: timer.vacumm_ten_minutes data: duration: '{{ iif(trigger.event.data.data == ''/vacuum10'', 600, 1200, 1200) }}' - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: '{{ ''Будет отправлен на уборку через '' + iif(trigger.event.data.data == ''/vacuum10'', ''10 мин.'', ''20 мин.'', ''20 мин.'') }}' - action: input_text.set_value target: entity_id: input_text.var_chat_id_vacuum_later_start data: value: '{{ trigger.event.data.chat_id }}' - alias: vacuum cancel cleaning id: vacuum cancel cleaning initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /vacuumcancel actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: timer.cancel target: entity_id: timer.vacumm_ten_minutes - action: vacuum.pause target: entity_id: vacuum.xiaomi_vacuum_cleaner - delay: seconds: 3 - action: vacuum.return_to_base target: entity_id: vacuum.xiaomi_vacuum_cleaner - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Отменили таймеры, отправили на базу - action: input_text.set_value target: entity_id: input_text.var_chat_id_vacuum_later_start data: value: secret telegram_chita_chat_id - alias: vacuum send map id: vacuum send map initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_callback event_data: data: /sendmap actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.message.message_id }}' - action: telegram_bot.send_photo data: target: '{{ trigger.event.data.chat_id }}' url: '{{- ''http://homeassistant.local.hass.io:8123'' + state_attr(''camera.roborock_vacuum_map'', ''entity_picture'') -}}' caption: '{{ ''\U0001F5FA'' }} *Степа* {{- ''\n'' -}} Текущая карта уборки' - alias: send climate summary id: send climate summary initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: telegram_command event_data: command: /climate_summary actions: - action: telegram_bot.delete_message data: chat_id: '{{ trigger.event.data.chat_id }}' message_id: '{{ trigger.event.data.id }}' - action: telegram_bot.send_message data: target: '{{ trigger.event.data.chat_id }}' title: '{{ ''🌡'' }} *Климатические сенсоры*' message: "{% set temp_array = expand('group.temperature_summary_group_to_bot')\ \ | selectattr('state', 'defined') | selectattr('state', 'ne', None) %} {%-\ \ for state in temp_array -%}\n {%- if loop.first -%}_Данные температуры_:\ \ {{-'\\n'-}}{%- endif -%} {{- state.name -}}: *{{ states(state.entity_id,\ \ rounded=True) -}}*°C {%- if not loop.last -%}{{-'\\n'-}} {%- endif -%} \n\ {%- endfor %}" - alias: install update telegram bot id: install update telegram bot initial_state: true mode: parallel triggers: - trigger: event event_type: telegram_callback event_data: command: /installupdate conditions: - '{{ trigger.event.data[''args''] | count > 0 }}' actions: - variables: entity: '{{- trigger.event.data[''args''][0] -}}' friendlyname: '{{- state_attr(trigger.event.data[''args''][0], ''friendly_name'') | replace('' Update'', '''') -}}' - choose: - conditions: '{{ is_state(entity, ''on'') and is_state_attr(entity, ''in_progress'', false) }}' sequence: - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Обновление на версию {{ state_attr(entity, 'latest_version') }} {{ friendlyname }} запущено. - action: update.install target: entity_id: '{{- entity -}}' data: backup: '{{ ''{:0=64b}''.format(state_attr(entity, ''supported_features''))[-4] == ''1'' }}' default: - action: telegram_bot.answer_callback_query data: callback_query_id: '{{ trigger.event.data.id }}' message: Обновление {{ friendlyname }} уже установлено. - alias: change mute on off alice activation sounds id: change mute on off alice activation sounds initial_state: true max_exceeded: silent triggers: - trigger: homeassistant event: start - trigger: time at: - '8:00:00' - '22:00:00' actions: - variables: time_to_on: '{% set time_now = now() %} {{ today_at(''8:00'') <= time_now < today_at(''21:59:59'') }} ' - action: media_player.play_media target: entity_id: media_player.yandex_station_ff98f029b620413b35e5e278 data: media_content_id: '{{- ''без лишних слов: '' + iif(time_to_on, ''нет'', ''да'') -}}' media_content_type: settings - delay: 2 - action: media_player.play_media target: entity_id: media_player.yandex_station_ff98f029b620413b35e5e278 data: media_content_id: '{{- ''звук активации: '' + iif(time_to_on, ''да'', ''нет'') -}}' media_content_type: settings - alias: change name activation for voice assistant id: change name activation for voice assistant initial_state: true max_exceeded: silent triggers: - trigger: event event_type: yandex_speaker event_data: instance: text_action value: Ничего не делай?-= - trigger: event event_type: yandex_speaker event_data: instance: text_action value: 'Ничего не делай?-:' actions: - action: media_player.play_media target: entity_id: media_player.yandex_station_ff98f029b620413b35e5e278 data: media_content_id: 'имя: {{ ''алиса'' if ''?-:'' in trigger.event.data.value else ''яндекс'' }}' media_content_type: settings - alias: clean one room by comand from voice assistant id: clean one room by comand from voice assistant initial_state: true max_exceeded: silent triggers: - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка спальни - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка детской - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка гостиной - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка ванной - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка гардероба - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка туалета - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка коридора - trigger: event event_type: yandex_speaker event_data: instance: phrase_action value: уборка кухни actions: - action: vacuum.send_command target: entity_id: vacuum.xiaomi_vacuum_cleaner data: command: app_segment_clean params: "{{ trigger.event.data.value | replace('уборка ', '') \n | replace('детской',\ \ '16') \n | replace('спальни', '1') \n | replace('гостиной', '17')\ \ \n | replace('кухни', '2') \n | replace('ванной', '18') \n | replace('гардероба',\ \ '19') \n | replace('туалета', '20') \n | replace('коридора', '21')\ \ \n | int(0)\n}}\n" - alias: outdoor climate by comand from voice assistant id: outdoor climate by comand from voice assistant initial_state: true max_exceeded: silent triggers: - trigger: event event_type: yandex_speaker event_data: instance: text_action value: Ничего не делай- actions: - action: media_player.play_media target: entity_id: '{{ trigger.event.data.entity_id }}' data: media_content_type: text media_content_id: 'Температура {{ states(''sensor.0x00158d000542ceaf_temperature'') | round(0, ''ceil'', 0) | format(morph=''градус'', as_text=false) }} цельсия. Давление {{ states(''sensor.158d000542ceaf_pressure'') | round(0, ''ceil'', 0) | format(morph=''миллиметр'', as_text=false) }} ртутного столба Влажность {{ states(''sensor.0x00158d000542ceaf_humidity'') | round(0, ''ceil'', 0) | format(morph=''процент'', as_text=false) }} ' - alias: vacuum send map from alice command id: vacuum send map from alice command initial_state: true max_exceeded: silent triggers: - trigger: event event_type: yandex_speaker event_data: instance: text_action value: Ничего не делай?- actions: - action: telegram_bot.send_photo data: target: secret telegram_all_chat_id url: '{{- ''http://homeassistant.local.hass.io:8123'' + state_attr(''camera.roborock_vacuum_map'', ''entity_picture'') -}}' caption: '{{ ''\U0001F5FA'' }} *Степа* {{- ''\n'' -}} Текущая карта уборки' - alias: dishwasher remaining programme running time id: dishwasher remaining programme running time initial_state: true max_exceeded: silent triggers: - trigger: event event_type: yandex_speaker event_data: instance: text_action value: Ничего не делай? actions: - action: media_player.play_media target: entity_id: '{{ trigger.event.data.entity_id }}' data: media_content_type: text media_content_id: "{% if is_state('sensor.014020518886002182_bsh_common_status_operationstate',\ \ 'BSH.Common.EnumType.OperationState.Run') %}\n {% set time_delta = as_timestamp(states('sensor.014020518886002182_bsh_common_option_remainingprogramtime'),\ \ 0) - as_timestamp(now(), 0) | int(0) %}\n {% set minutes = (( time_delta\ \ % 3600) / 60) | int(0) %}\n {% set hours = ((time_delta % 86400) / 3600)\ \ | int(0) %}\n До окончания: {{- ' ' -}}\n {% if time_delta < 1 -%}\n\ \ меньше минуты\n {% else -%}\n {% if hours > 0 %}\n \ \ {{- hours | format(morph='час') -}}\n {% endif %}\n {%- if\ \ minutes > 0 -%}\n {% if hours > 0 %}\n {{- ' ' -}}\n \ \ {% endif %}\n {{- minutes | format(morph='минута') }}\n \ \ {% endif %}\n {% endif %}\n{%- else %}\n Сейчас программа не запущена\n\ {% endif %}\n" - alias: yeelight ceiling cr off id: yeelight ceiling cr off initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.0x158d0003f37a0f_contact from: 'on' to: 'off' actions: - action: light.turn_off target: entity_id: - light.yeelight_ceiling_cr - light.yeelight_ceiling_cr_ambilight - light.yeelight_ceiling_cr_nightlight - alias: yeelight ceiling cr on id: yeelight ceiling cr on initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.0x158d0003f37a0f_contact from: 'off' to: 'on' actions: - action: light.turn_on target: entity_id: light.yeelight_ceiling_cr data: color_temp_kelvin: 3571 brightness: 255 - alias: yeelight ceiling cr on ambilight night mode id: yeelight ceiling cr on ambilight night mode initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: sensor.0x158d0003a360b6_action to: single conditions: - condition: state entity_id: light.yeelight_ceiling_cr state: 'off' actions: - action: light.turn_on target: entity_id: light.yeelight_ceiling_cr_ambilight data: brightness: 1 rgb_color: - 0 - 0 - 255 - alias: yeelight ceiling cr off ambilight night mode id: yeelight ceiling cr off ambilight night mode initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: sensor.0x158d0003a360b6_action to: single conditions: - condition: state entity_id: light.yeelight_ceiling_cr_ambilight state: 'on' - condition: state entity_id: light.yeelight_ceiling_cr state: 'off' actions: - action: light.turn_off target: entity_id: light.yeelight_ceiling_cr_ambilight - alias: sync yeelight ceiling cr to switch id: sync yeelight ceiling cr to switch initial_state: true triggers: - trigger: time_pattern minutes: /3 conditions: - '{{ (state_attr(''automation.yeelight_ceiling_on'', ''current'') | int(0)) == 0 }}' - '{{ (state_attr(''automation.yeelight_ceiling_off'', ''current'') | int(0)) == 0 }}' - condition: or conditions: - condition: and conditions: - condition: state entity_id: binary_sensor.0x158d0003f37a0f_contact state: 'on' - condition: state entity_id: light.yeelight_ceiling_cr state: 'off' - condition: state entity_id: light.yeelight_ceiling_cr_ambilight state: 'off' - condition: state entity_id: light.yeelight_ceiling_cr_nightlight state: 'off' - condition: and conditions: - condition: state entity_id: binary_sensor.0x158d0003f37a0f_contact state: 'off' - condition: state entity_id: light.yeelight_ceiling_cr state: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id message: ⚠️ Обнаружено отклонение светильника и выключателя, исправить? inline_keyboard: - Да:/changelight, Нет:/nochangelight, Игнорировать:/ignoringchangelight - action: automation.turn_off target: entity_id: '{{ this.entity_id }}' - alias: light gateway toggle id: light gateway toggle initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.0x158d000359304c_contact from: 'off' to: 'on' conditions: - condition: state entity_id: automation.turn_on_doorbell attribute: current state: 0 - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' actions: - action: scene.create data: scene_id: before_light_door_open snapshot_entities: - light.gateway_light_04cf8cabd77b - action: light.turn_on target: entity_id: light.gateway_light_04cf8cabd77b data: rgb_color: - 255 - 0 - 0 brightness: 255 - delay: milliseconds: 150 - action: light.turn_off target: entity_id: light.gateway_light_04cf8cabd77b - delay: milliseconds: 50 - action: light.turn_on target: entity_id: light.gateway_light_04cf8cabd77b data: rgb_color: - 255 - 0 - 0 brightness: 255 - delay: milliseconds: 150 - action: light.turn_off target: entity_id: light.gateway_light_04cf8cabd77b - action: scene.turn_on target: entity_id: scene.before_light_door_open - alias: light gateway go to work on id: light gateway go to work on triggers: - trigger: time at: 07:00:00 conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' - condition: time weekday: - mon - tue - wed - thu - fri actions: - action: scene.create data: scene_id: before_on_go_to_work snapshot_entities: - light.gateway_light_04cf8cabd77b - action: light.turn_on target: entity_id: light.gateway_light_04cf8cabd77b data: rgb_color: - 230 - 255 - 0 brightness: 5 - alias: light gateway go to work off id: light gateway go to work off triggers: - trigger: time at: 07:20:00 conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' - condition: time weekday: - mon - tue - wed - thu - fri actions: - action: light.turn_off target: entity_id: light.gateway_light_04cf8cabd77b - action: scene.turn_on target: entity_id: scene.before_on_go_to_work - alias: restart integration relay yeelight ceiling unavailable id: restart integration relay yeelight ceiling unavailable initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: light.yeelight_ceiling_cr to: null - trigger: homeassistant event: start conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - '{{ as_timestamp(now()) - as_timestamp(state_attr(this.entity_id, ''last_triggered'')) > 60 }}' - '{{ not has_value(''light.yeelight_ceiling_cr'') }}' - '{{ has_value(''switch.0x54ef441000096cbc'') }}' actions: - wait_template: '{{ has_value(''light.yeelight_ceiling_cr'') or is_state(''input_boolean.instances_stoping'', ''on'') }}' timeout: 00:02:00 - choose: - conditions: '{{ not wait.completed and is_state(''binary_sensor.local_network_availability'', ''on'') }}' sequence: - action: switch.turn_off target: entity_id: switch.0x54ef441000096cbc - delay: seconds: 5 - action: switch.turn_on target: entity_id: switch.0x54ef441000096cbc - delay: seconds: 30 - action: homeassistant.reload_config_entry data: entry_id: '{{ config_entry_id(''light.yeelight_ceiling_cr'') }}' - alias: turn on lg webos tv bedroom id: turn on lg webos tv bedroom initial_state: true triggers: - trigger: webostv.turn_on entity_id: media_player.lg_smart_tv conditions: - '{{ states(''media_player.lg_smart_tv'') in [''off'', ''unknown'', ''unavailable''] }}' actions: - action: remote.send_command target: entity_id: remote.broadlink_ir_rm4_mini data: command: b64:JgBYAAABI5URFBEUEjgRFBEUERQRFREUETgSOBEUETkROBE5ETgSOBEUERQRFBI4ERQRFBEUEhQROBI4ETgRFRA5ETkROBI4EQAFJwABJkwRAAxeAAElSxIADQU= - alias: turn on samsung tv kitchen id: turn on samsung tv kitchen initial_state: true triggers: - trigger: samsungtv.turn_on entity_id: media_player.tv_kotletochka_tv_sam conditions: - '{{ states(''media_player.tv_kotletochka_tv_sam'') in [''off'', ''unknown'', ''unavailable''] }}' actions: - action: esphome.perenio_petra01_kitchen_send_samsung_command data: data: '0xE0E040BF' - alias: mqtt_sensors_discovery id: mqtt_sensors_discovery initial_state: true triggers: - trigger: homeassistant event: start - trigger: event event_type: automation_reloaded actions: - parallel: - action: mqtt.publish data: topic: homeassistant/sensor/mqtt_broker_uptime/config retain: true payload: "{ \n \"name\":\"MQTT Broker Uptime\", \n \"state_topic\":\"$SYS/broker/uptime\"\ , \n \"icon\":\"mdi:timer-outline\", \n \"unit_of_measurement\":\"s\"\ , \n \"entity_category\":\"diagnostic\", \n \"unique_id\":\"mqtt_broker_uptime\"\ ,\n \"value_template\":\"{{ '{{' }} value | regex_replace('[^\\\\d]','')\ \ | trim {{ '}}' }}\", \n \"json_attributes_topic\":\"$SYS/broker/version\"\ , \n \"json_attributes_template\":\"{\\\"version\\\":\\\"{{ '{{' }} (value\ \ | regex_replace('[\\\\s\\\\S]+?\\\\s(\\\\d)','\\\\\\\\1')) | trim {{ '}}'\ \ }}\\\"}\", \n \"device\":{\"identifiers\":[\"mosquito_broker\"],\"manufacturer\"\ :\"Eclipse\",\"model\":\"Mosquitto\",\"name\":\"Eclipse Mosquitto\",\"sw_version\"\ :\"{{ state_attr('sensor.mqtt_broker_uptime','version') }}\",\"configuration_url\"\ :\"https://mosquitto.org/\"} \n}" - action: mqtt.publish data: topic: homeassistant/switch/permit_join_switch_z2m/config retain: true payload: "{ \n \"name\":\"permit_join_switch_z2m\", \n \"state_topic\":\"\ zigbee2mqtt/bridge/info\",\n \"command_topic\":\"zigbee2mqtt/bridge/request/permit_join\"\ ,\n \"payload_on\":\"{\\\"time\\\":254}\",\n \"payload_off\":\"{\\\"time\\\ \":0}\",\n \"state_off\":\"false\",\n \"state_on\":\"true\",\n \"icon\"\ :\"mdi:cellphone-wireless\",\n \"unique_id\":\"permit_join_switch_z2m\"\ ,\n \"value_template\":\"{{ '{{' }} value_json.permit_join | lower {{ '}}'\ \ }}\",\n \"device\":{\"identifiers\":[\"z2m_info\"],\"manufacturer\":\"\ Enzokot\",\"model\":\"Local polling\",\"name\":\"Zigbee2MQTT add-on\"}\n\ }" - action: mqtt.publish data: topic: homeassistant/sensor/permit_join_end_z2m/config retain: true payload: "{ \n \"name\":\"permit join end z2m\", \n \"state_topic\":\"zigbee2mqtt/bridge/info\"\ ,\n \"value_template\":\"{{ '{{' }} iif(value_json.permit_join, value_json.permit_join_end,\ \ 0) {{ '}}' }}\",\n \"unique_id\":\"permit_join_end_z2m\",\n \"device\"\ :{\"identifiers\":[\"z2m_info\"],\"manufacturer\":\"Enzokot\",\"model\"\ :\"Local polling\",\"name\":\"Zigbee2MQTT add-on\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/router_devices_z2m/config retain: true payload: "{ \n \"name\":\"router devices z2m\", \n \"state_topic\":\"zigbee2mqtt/bridge/devices\"\ ,\n \"value_template\":\"{{ '{{' }} value_json | to_json | from_json |\ \ selectattr('type', 'defined') | selectattr('type', 'in', ['Coordinator',\ \ 'Router']) | map(attribute='friendly_name') | list | count {{ '}}' }}\"\ ,\n \"json_attributes_topic\":\"zigbee2mqtt/bridge/devices\",\n \"json_attributes_template\"\ :\"{{ '{{ {' }}'routers':value_json | to_json | from_json | selectattr('type',\ \ 'defined') | selectattr('type', 'in', ['Coordinator', 'Router']) | map(attribute='friendly_name')\ \ | list{{ '}' }} | tojson {{ '}}' }}\",\n \"icon\":\"mdi:router-wireless\"\ ,\n \"unique_id\":\"router_devices_z2m\",\n \"device\":{\"identifiers\"\ :[\"z2m_info\"],\"manufacturer\":\"Enzokot\",\"model\":\"Local polling\"\ ,\"name\":\"Zigbee2MQTT add-on\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/permit_join_current_device_z2m/config retain: true payload: "{ \n \"name\":\"permit join current device z2m\", \n \"state_topic\"\ :\"zigbee2mqtt/bridge/response/permit_join\",\n \"value_template\":\"{{\ \ '{{' }} value_json.data.device if value_json.data is defined and value_json.data.device\ \ is defined else None {{ '}}' }}\",\n \"icon\":\"mdi:router\",\n \"unique_id\"\ :\"permit_join_current_device_z2m\",\n \"device\":{\"identifiers\":[\"\ z2m_info\"],\"manufacturer\":\"Enzokot\",\"model\":\"Local polling\",\"\ name\":\"Zigbee2MQTT add-on\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/check_keenetic_link_down/config retain: true payload: "{ \n \"name\":\"check keenetic link down\", \n \"state_topic\"\ :\"host_data/network_diagnostics/check_keenetic_link_down\",\n \"value_template\"\ :\"{{ '{{' }} as_datetime(value_json.status, 0) | as_local() if value_json.status\ \ is defined and as_datetime(value_json.status, 0) != 0 else None {{ '}}'\ \ }}\",\n \"icon\":\"mdi:calendar-clock\", \n \"device_class\":\"timestamp\"\ ,\n \"unique_id\":\"check_keenetic_link_down\",\n \"device\":{\"identifiers\"\ :[\"network_info\"],\"manufacturer\":\"Enzokot\",\"model\":\"Local polling\"\ ,\"name\":\"Network info\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/sostoianie_mosta/config retain: true payload: "{ \n \"name\":\"Состояние моста\", \n \"state_topic\":\"zigbee2mqtt/bridge/state\"\ ,\n \"value_template\":\"{{ '{{' }} value_json.state {{ '}}' }}\",\n \"\ icon\":\"mdi:calendar-clock\", \n \"unique_id\":\"sostoianie_mosta\",\n\ \ \"device\":{\"identifiers\":[\"z2m_info\"],\"manufacturer\":\"Enzokot\"\ ,\"model\":\"Local polling\",\"name\":\"Zigbee2MQTT add-on\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/zigbee2mqtt_coordinator_version/config retain: true payload: "{ \n \"name\":\"Zigbee2mqtt Coordinator Version\", \n \"state_topic\"\ :\"zigbee2mqtt/bridge/info\",\n \"value_template\":\"{{ '{{' }} value_json.coordinator['ieee_address']\ \ {{ '}}' }}\",\n \"json_attributes_topic\":\"zigbee2mqtt/bridge/info\"\ ,\n \"json_attributes_template\":\"{{ '{{ {' }}'revision':value_json.coordinator['meta'].revision,\ \ 'type':value_json.coordinator['type']{{ '}' }} | tojson {{ '}}' }}\",\n\ \ \"icon\":\"mdi:chip\",\n \"unique_id\":\"zigbee2mqtt_coordinator_version\"\ ,\n \"device\":{\"identifiers\":[\"z2m_info\"],\"manufacturer\":\"Enzokot\"\ ,\"model\":\"Local polling\",\"name\":\"Zigbee2MQTT add-on\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x5c0272fffec89454/local_temperature/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Childrens\ \ room valve with thermostat/availability\",\"value_template\":\"{{ '{{'\ \ }} value_json.state {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\"\ :\"0x5c0272fffec89454_local_temperature\",\n \"state_topic\":\"zigbee2mqtt/Childrens\ \ room valve with thermostat\",\n \"value_template\":\"{{ '{{' }} value_json.local_temperature\ \ {{ '}}' }}\",\n \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x5c0272fffec89454_local_temperature\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x5c0272fffec89454\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Childrens room valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x5c0272fffec89454/local_temperature_calibration/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Childrens\ \ room valve with thermostat/availability\",\"value_template\":\"{{ '{{'\ \ }} value_json.state {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\"\ :\"0x5c0272fffec89454_local_temperature_calibration\",\n \"state_topic\"\ :\"zigbee2mqtt/Childrens room valve with thermostat\",\n \"value_template\"\ :\"{{ '{{' }} value_json.local_temperature_calibration {{ '}}' }}\",\n \ \ \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x5c0272fffec89454_local_temperature_calibration\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x5c0272fffec89454\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Childrens room valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x60a423fffe968719/local_temperature/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Bedroom\ \ valve with thermostat/availability\",\"value_template\":\"{{ '{{' }} value_json.state\ \ {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\":\"0x60a423fffe968719_local_temperature\"\ ,\n \"state_topic\":\"zigbee2mqtt/Bedroom valve with thermostat\",\n \"\ value_template\":\"{{ '{{' }} value_json.local_temperature {{ '}}' }}\"\ ,\n \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x60a423fffe968719_local_temperature\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x60a423fffe968719\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Bedroom valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x60a423fffe968719/local_temperature_calibration/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Bedroom\ \ valve with thermostat/availability\",\"value_template\":\"{{ '{{' }} value_json.state\ \ {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\":\"0x60a423fffe968719_local_temperature_calibration\"\ ,\n \"state_topic\":\"zigbee2mqtt/Bedroom valve with thermostat\",\n \"\ value_template\":\"{{ '{{' }} value_json.local_temperature_calibration {{\ \ '}}' }}\",\n \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x60a423fffe968719_local_temperature_calibration\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x60a423fffe968719\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Bedroom valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x5c0272fffec9db22/local_temperature/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Living\ \ room valve with thermostat/availability\",\"value_template\":\"{{ '{{'\ \ }} value_json.state {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\"\ :\"0x5c0272fffec9db22_local_temperature\",\n \"state_topic\":\"zigbee2mqtt/Living\ \ room valve with thermostat\",\n \"value_template\":\"{{ '{{' }} value_json.local_temperature\ \ {{ '}}' }}\",\n \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x5c0272fffec9db22_local_temperature\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x5c0272fffec9db22\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Living room valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x5c0272fffec9db22/local_temperature_calibration/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Living\ \ room valve with thermostat/availability\",\"value_template\":\"{{ '{{'\ \ }} value_json.state {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\"\ :\"0x5c0272fffec9db22_local_temperature_calibration\",\n \"state_topic\"\ :\"zigbee2mqtt/Living room valve with thermostat\",\n \"value_template\"\ :\"{{ '{{' }} value_json.local_temperature_calibration {{ '}}' }}\",\n \ \ \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x5c0272fffec9db22_local_temperature_calibration\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x5c0272fffec9db22\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Living room valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x5c0272fffe8de819/local_temperature/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Kitchen\ \ valve with thermostat/availability\",\"value_template\":\"{{ '{{' }} value_json.state\ \ {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\":\"0x5c0272fffe8de819_local_temperature\"\ ,\n \"state_topic\":\"zigbee2mqtt/Kitchen valve with thermostat\",\n \"\ value_template\":\"{{ '{{' }} value_json.local_temperature {{ '}}' }}\"\ ,\n \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x5c0272fffe8de819_local_temperature\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x5c0272fffe8de819\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Kitchen valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/0x5c0272fffe8de819/local_temperature_calibration/config retain: true payload: "{ \n \"avty\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\"\ :\"{{ '{{' }} value_json.state {{ '}}' }}\"},{\"topic\":\"zigbee2mqtt/Kitchen\ \ valve with thermostat/availability\",\"value_template\":\"{{ '{{' }} value_json.state\ \ {{ '}}' }}\"}],\n \"avty_mode\":\"all\",\n \"name\":\"0x5c0272fffe8de819_local_temperature_calibration\"\ , \n \"state_topic\":\"zigbee2mqtt/Kitchen valve with thermostat\",\n \ \ \"value_template\":\"{{ '{{' }} value_json.local_temperature_calibration\ \ {{ '}}' }}\",\n \"unit_of_measurement\":\"°C\",\n \"unique_id\":\"0x5c0272fffe8de819_local_temperature_calibration\"\ ,\n \"device\":{\"identifiers\":[\"zigbee2mqtt_0x5c0272fffe8de819\"],\"\ manufacturer\":\"TuYa\",\"model\":\"Radiator valve with thermostat (TS0601_thermostat)\"\ ,\"name\":\"Kitchen valve with thermostat\"} \n}" - action: mqtt.publish data: topic: homeassistant/sensor/login_ssh_kotletochka_dell_srv/config retain: true payload: "{ \n \"name\":\"login ssh kotletochka dell srv\", \n \"state_topic\"\ :\"host_data/login_ssh/kotletochka_dell_srv\",\n \"value_template\":\"\ {{ '{{' }} value_json.date {{ '}}' }}\",\n \"json_attributes_topic\":\"\ host_data/login_ssh/kotletochka_dell_srv\",\n \"json_attributes_template\"\ :\"{{ '{{ {' }}'user':value_json.user, 'ruser':value_json.ruser, 'address':value_json.address,\ \ 'service':value_json.service, 'tty':value_json.tty{{ '}' }} | tojson {{\ \ '}}' }}\",\n \"force_update\":\"true\",\n \"device_class\":\"timestamp\"\ ,\n \"icon\":\"mdi:ssh\", \n \"unique_id\":\"login_ssh_kotletochka_dell_srv\"\ ,\n \"device\":{\"identifiers\":[\"login_ssh\"],\"manufacturer\":\"Enzokot\"\ ,\"model\":\"Local push\",\"name\":\"Login's ssh info\"}\n}" - action: mqtt.publish data: topic: homeassistant/binary_sensor/dmesg_ext4_warning/config retain: true payload: "{ \n \"name\":\"Kernel_EXT4_warning\", \n \"state_topic\":\"host_data/dmesg_ext4_warning\"\ ,\n \"icon\":\"mdi:harddisk\",\n \"device_class\":\"problem\",\n \"unique_id\"\ :\"dmesg_ext4_warning\",\n \"device\":{\"identifiers\":[\"host_kernel_info\"\ ],\"manufacturer\":\"Enzokot\",\"model\":\"Local polling\",\"name\":\"Host\ \ kernel info\"}\n}" - action: mqtt.publish data: topic: homeassistant/sensor/pve_processor_temperature/config retain: true payload: "{ \n \"name\":\"pve processor temperature\", \n \"state_topic\"\ :\"host_data/host_sensors/cpu_temp\",\n \"icon\":\"mdi:thermometer\", \n\ \ \"unit_of_measurement\":\"°C\",\n \"device_class\":\"temperature\",\n\ \ \"unique_id\":\"pve_processor_temperature\",\n \"device\":{\"identifiers\"\ :[\"pve_sensors\"],\"manufacturer\":\"Enzokot\",\"model\":\"Local polling\"\ ,\"name\":\"PVE Sensors\"}\n}" - alias: notification front door open long time id: notification front door open long time initial_state: true triggers: trigger: state entity_id: binary_sensor.0x158d000359304c_contact from: 'off' to: 'on' for: minutes: 2 actions: - parallel: - action: notify.telegram_enzokot_to_bot data: title: ⚠️ *Датчик открытия/закрытия* message: 'Входная дверь: открыта более 2 минут' - choose: - conditions: - condition: state entity_id: media_player.lg_smart_tv state: 'on' sequence: - action: notify.kotletochka_tv data: message: 'Входная дверь: открыта более 2 минут' - alias: notification lobby door open long time id: notification lobby door open long time initial_state: true triggers: - trigger: state id: door_open entity_id: binary_sensor.lobby_door_open_long_time from: 'off' to: 'on' - trigger: state id: door_close entity_id: binary_sensor.lobby_door_open_long_time from: 'on' to: 'off' actions: - action: telegram_bot.send_message data: target: secret telegram_all_chat_id disable_notification: true title: '{% if trigger.id == ''door_open'' -%} {{ ''\U0001F513'' }} {%- else -%} {{ ''\U0001f510'' }} {%- endif %} *Датчик открытия/закрытия*' message: 'Тамбурная дверь: {% if trigger.id == ''door_open'' -%} открыта более 5 минут {%- else -%} закрыта {% endif -%}' - alias: notification sound front door open long time id: notification sound front door open long time initial_state: true triggers: - trigger: state entity_id: binary_sensor.0x158d000359304c_contact from: 'off' to: 'on' for: minutes: 2 conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: disarmed - condition: or conditions: - condition: time after: '9:00:00' before: '13:30:00' - condition: time after: '16:30:00' before: '21:00:00' actions: - action: timer.start entity_id: timer.front_door_ringtone - parallel: - action: script.turn_on data: entity_id: script.alice_custom_tts_volume variables: entity: media_player.yandex_station_ff98f029b620413b35e5e278 text: Внимание Входная дверь открыта vol_level: '0.65' - action: xiaomi_aqara.play_ringtone data: gw_mac: secret gateway1_mac ringtone_id: 10004 ringtone_vol: 15 - alias: notification sound front door open long time repeat id: notification sound front door open long time repeat initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.front_door_ringtone conditions: - condition: state entity_id: binary_sensor.0x158d000359304c_contact state: 'on' actions: - action: timer.start entity_id: timer.front_door_ringtone - parallel: - action: script.alice_custom_tts_volume data: entity: media_player.yandex_station_ff98f029b620413b35e5e278 text: Внимание Входная дверь открыта vol_level: '0.65' - action: xiaomi_aqara.play_ringtone data: gw_mac: secret gateway1_mac ringtone_id: 10004 ringtone_vol: 15 - alias: notification sound front door open long time cancel id: notification sound front door open long time cancel initial_state: true triggers: - trigger: time at: '13:30:00' - trigger: time at: '21:00:00' - trigger: state id: binary_sensor_trigger entity_id: binary_sensor.0x158d000359304c_contact from: 'on' to: 'off' conditions: condition: state entity_id: timer.front_door_ringtone state: active actions: - action: timer.cancel entity_id: timer.front_door_ringtone - choose: - conditions: '{{ trigger.id == ''binary_sensor_trigger'' }}' sequence: - action: xiaomi_aqara.stop_ringtone data: gw_mac: secret gateway1_mac - alias: notification front door open close id: notification front door open close mode: queued initial_state: true triggers: - trigger: state entity_id: binary_sensor.0x158d000359304c_contact from: - 'off' - 'on' to: - 'on' - 'off' actions: - variables: text_for_message: '{{ iif(trigger.to_state.state == ''on'', ''открыта'', ''закрыта'') }}' - parallel: - action: telegram_bot.send_message data: title: '{{ iif(trigger.to_state.state == ''on'', ''🚪'', ''🔐'') }} *Датчик открытия/закрытия*' message: 'Входная дверь: {{ text_for_message }}' disable_notification: true target: secret telegram_enzokot_chat_id - choose: - conditions: - condition: state entity_id: media_player.lg_smart_tv state: 'on' sequence: - action: notify.kotletochka_tv data: message: 'Входная дверь: {{ text_for_message }}' - alias: notification front door open armed id: notification front door open armed initial_state: true triggers: - trigger: state entity_id: binary_sensor.0x158d000359304c_contact to: 'on' conditions: - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: armed_away actions: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - parallel: - action: telegram_bot.send_message data: title: '{{ ''\U0001f6a8'' }} *Сигнализация*' message: Обнаружено вскрытие {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации target: secret telegram_all_chat_id inline_keyboard: - Выключить сирену:/stop_alarm - action: notify.notify data: title: '{{ ''🚨'' }} Сигнализация' message: Обнаружено вскрытие {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации data: ttl: 0 priority: high channel: alarm_stream actions: - action: stop_alarm title: Выключить сирену - action: notify.huawei_lte data: message: 🚨 Обнаружено вскрытие {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации target: secret sms_phone_all data: url: http://192.168.8.1/ - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification motion detected armed id: notification motion detected armed initial_state: true mode: queued triggers: - trigger: state entity_id: - binary_sensor.0x158d00054b8d72_motion - binary_sensor.0x158d000566bde7_motion - binary_sensor.0x158d0003953ee9_motion to: 'on' conditions: - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: armed_away actions: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - parallel: - action: telegram_bot.send_message data: title: '{{ ''\U0001f6a8'' }} *Сигнализация*' message: Обнаружено движение _{{ trigger.to_state.attributes.friendly_name }}_ при включенной сигнализации target: secret telegram_all_chat_id inline_keyboard: - Выключить сирену:/stop_alarm - action: notify.notify data: title: '{{ ''🚨'' }} Сигнализация' message: Обнаружено движение {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации data: ttl: 0 priority: high channel: alarm_stream actions: - action: stop_alarm title: Выключить сирену - action: notify.huawei_lte data: message: 🚨 Обнаружено движение {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации target: secret sms_phone_all data: url: http://192.168.8.1/ - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification open window armed id: notification open window armed initial_state: true mode: queued triggers: - trigger: state entity_id: - binary_sensor.window_bed_room_group - binary_sensor.window_childrens_room_group - binary_sensor.window_living_room_group - binary_sensor.window_kitchen_group to: 'on' conditions: - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: armed_away actions: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - parallel: - action: telegram_bot.send_message data: title: '{{ ''\U0001f6a8'' }} *Сигнализация*' message: Обнаружено вскрытие окна _{{ trigger.to_state.attributes.friendly_name }}_ при включенной сигнализации inline_keyboard: - Выключить сирену:/stop_alarm target: secret telegram_all_chat_id - action: notify.notify data: title: '{{ ''🚨'' }} Сигнализация' message: Обнаружено вскрытие окна {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации data: ttl: 0 priority: high channel: alarm_stream actions: - action: stop_alarm title: Выключить сирену - action: notify.huawei_lte data: message: 🚨 Обнаружено вскрытие окна {{ trigger.to_state.attributes.friendly_name }} при включенной сигнализации target: secret sms_phone_all data: url: http://192.168.8.1/ - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification gateway alarm triggered normal mode id: notification gateway alarm triggered normal mode mode: queued initial_state: true triggers: - trigger: state entity_id: - alarm_control_panel.54ef44315770_alarm - alarm_control_panel.54ef44cb80fd_alarm - alarm_control_panel.54ef443127b2_alarm to: triggered conditions: - condition: state entity_id: input_boolean.alarm_gateway_button state: 'off' - condition: state entity_id: alarm_control_panel.signalka_shliuza_alarm state: disarmed actions: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - parallel: - action: telegram_bot.send_message data: title: '{{ ''\U0001f6a8'' }} *Сигнализация*' message: Обнаружено срабатывание шлюза _{{ trigger.to_state.attributes.friendly_name }}_ inline_keyboard: - Выключить сирену:/stop_alarm target: secret telegram_all_chat_id - action: notify.notify data: title: '{{ ''🚨'' }} Сигнализация' message: Обнаружено срабатывание шлюза {{ trigger.to_state.attributes.friendly_name }} data: ttl: 0 priority: high channel: alarm_stream actions: - action: stop_alarm title: Выключить сирену - action: notify.huawei_lte data: message: 🚨 Обнаружено срабатывание шлюза {{ trigger.to_state.attributes.friendly_name }} target: secret sms_phone_all data: url: http://192.168.8.1/ - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: vacuum cleaner error to all id: vacuum cleaner error to all initial_state: true triggers: - trigger: state entity_id: vacuum.xiaomi_vacuum_cleaner attribute: status to: - Error - In Error - Charging Error actions: - parallel: - action: telegram_bot.send_photo data: target: secret telegram_all_chat_id url: '{{- ''http://homeassistant.local.hass.io:8123'' + state_attr(''camera.roborock_vacuum_map'', ''entity_picture'') -}}' caption: ⚠️ *Степа* {{- '\n' -}} Похоже я застрял или какая то другая ошибка inline_keyboard: - Найти меня (громко):/findvacuum - choose: - conditions: - condition: state entity_id: media_player.lg_smart_tv state: 'on' sequence: - action: notify.kotletochka_tv data: message: 'Степа: мне нужна помощь' - alias: vacuum cleaner after cleaning chita id: vacuum cleaner after cleaning chita initial_state: true triggers: - trigger: state entity_id: vacuum.xiaomi_vacuum_cleaner from: returning to: docked conditions: condition: template value_template: '{{ (states(''sensor.xiaomi_vacuum_cleaner_total_clean_area'') | int(0) ) > (states(''input_number.total_cleaned_area_saved'') | int(0) ) + 30 }}' actions: - variables: current_clean_area: '{{ states(''sensor.xiaomi_vacuum_cleaner_current_clean_area'') | round(0, ''ceil'', 0) | string + state_attr(''sensor.xiaomi_vacuum_cleaner_current_clean_area'', ''unit_of_measurement'') }}' current_clean_duration: "{% set uptime = states('sensor.xiaomi_vacuum_cleaner_current_clean_duration')\ \ | int(0) %} {% set minutes = (( uptime % 3600) / 60) | int(0) %} {% set\ \ hours = ((uptime % 86400) / 3600) | int(0) %} {% set days = (uptime / 86400)\ \ | int(0) %}\n {% if uptime < 1 %}\n Меньше минуты\n {%- else %}\n \ \ {% if days > 0 %}\n {{ days -}} д.\n {%- endif %}\n {%- if\ \ hours > 0 %}\n {%- if days > 0 %}\n {{- ' ' -}}\n {% endif\ \ -%}\n {{ hours -}} ч.\n {%- endif %}\n {%- if minutes > 0 %}\n\ \ {%- if days > 0 or hours > 0 %}\n {{- ' ' -}}\n {% endif\ \ -%}\n {{ minutes -}} м.\n {%- endif -%}\n {% endif %}" - parallel: - action: telegram_bot.send_photo data: target: secret telegram_chita_chat_id url: '{{- ''http://homeassistant.local.hass.io:8123'' + state_attr(''camera.roborock_vacuum_map'', ''entity_picture'') -}}' caption: '{{ ''\U0001f4af'' }} *Степа* {{- ''\n'' -}} Вернулся на базу (длительность: {{- current_clean_duration -}}, площадь: {{- current_clean_area -}}), нужно снять бак с водой и заглянуть в контейнер пылесборника' - action: input_number.set_value data: entity_id: input_number.total_cleaned_area_saved value: '{{ (states(''sensor.xiaomi_vacuum_cleaner_total_clean_area'') | int(0) ) }}' - choose: - conditions: - condition: state entity_id: media_player.lg_smart_tv state: 'on' sequence: - action: notify.kotletochka_tv data: message: 'Степа: вернулся на базу' - alias: smoke detector alarm id: smoke detector alarm initial_state: true triggers: - trigger: state entity_id: - binary_sensor.0x158d0003943639_smoke - binary_sensor.0x158d00039a8358_smoke - binary_sensor.0x158d00039d9398_smoke - binary_sensor.0x158d00045ca483_smoke - binary_sensor.0x00158d00045cd551_smoke to: 'on' actions: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' areas_list: '{{ states.binary_sensor | selectattr(''entity_id'', ''match'', ''.*_smoke'') | selectattr(''state'', ''eq'', ''on'') | map(attribute=''entity_id'') | map(''area_name'') | reject(''none'') | unique | join('' '') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - parallel: - action: telegram_bot.send_message data: target: secret telegram_all_chat_id title: '{{ ''\U0001F525'' }} *Датчик дыма*' message: 'Сработали датчики: {{- ''\n'' -}} _{{- areas_list -}}_' inline_keyboard: - Выключить сирену:/stop_alarm - action: notify.notify data: data: ttl: 0 priority: high channel: alarm_stream actions: - action: stop_alarm title: Выключить сирену title: '{{ ''🔥'' }} Датчик дыма' message: 'Сработали датчики: {{- ''\n'' -}} {{- areas_list -}}' - action: notify.huawei_lte data: message: '{{ ''\U0001F525'' }} Сработали датчики дыма: {{- ''\n'' -}} {{- areas_list -}}' target: secret sms_phone_all data: url: http://192.168.8.1/ - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification cert expired id: notification cert expired initial_state: true triggers: - trigger: state entity_id: binary_sensor.cert_expired_keenetic_domain from: 'off' to: 'on' - trigger: state entity_id: binary_sensor.cert_expired_asuscomm_domain_klg from: 'off' to: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: ⚠️ *Сертификат SSL* message: '{%- set entity_name = trigger.entity_id | replace(''binary_'', '''') | replace(''_expired_'', ''_expiry_'') -%} Срок действия сертификата для _{{ trigger.to_state.name -}}_: *{{- states(entity_name) -}}* {{ state_attr(entity_name, ''unit_of_measurement'') }}' - alias: update available or installed notification initial_state: true mode: queued trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', None, null, ''''] }}' triggers: - trigger: event event_type: state_changed conditions: - '{{ trigger.event.data.entity_id.startswith(''update.'') }}' - '{{ trigger.event.data.old_state is not none and trigger.event.data.new_state is not none }}' - '{{ trigger.event.data.new_state.attributes.latest_version is defined and trigger.event.data.new_state.attributes.installed_version is defined }}' - '{{ trigger.event.data.old_state.attributes.latest_version is defined and trigger.event.data.old_state.attributes.installed_version is defined }}' - or: - condition: template value_template: "{{ \n trigger.event.data.new_state.state == 'on' and\n ((is_state_attr(trigger.event.data.entity_id,\ \ 'device_class', 'firmware')\n and version(trigger.event.data.new_state.attributes.latest_version)\ \ = version(trigger.event.data.old_state.attributes.latest_version))\n or\ \ version(trigger.event.data.new_state.attributes.latest_version) > version(trigger.event.data.old_state.attributes.latest_version))\ \ and\n trigger.event.data.new_state.attributes.latest_version not in not_has_state\ \ and\n trigger.event.data.new_state.attributes.latest_version is not none\n\ }}\n" - condition: template value_template: "{{ \n trigger.event.data.old_state.state == 'on' and trigger.event.data.new_state.state\ \ == 'off' and\n ((is_state_attr(trigger.event.data.entity_id, 'device_class',\ \ 'firmware')\n and version(trigger.event.data.new_state.attributes.installed_version)\ \ = version(trigger.event.data.old_state.attributes.installed_version))\n\ \ or version(trigger.event.data.new_state.attributes.installed_version) >\ \ version(trigger.event.data.old_state.attributes.installed_version)) and\n\ \ trigger.event.data.new_state.attributes.installed_version not in not_has_state\ \ and\n trigger.event.data.new_state.attributes.installed_version is not\ \ none\n}}\n" actions: - variables: release_url: "{% if trigger.event.data.entity_id == 'update.home_assistant_core_update'\ \ -%}\n {%- if state_attr(trigger.event.data.entity_id, 'latest_version').split('.')[2]\ \ | int(0) == 0 -%}\n {{- state_attr(trigger.event.data.entity_id, 'release_url')\ \ -}}\n {%- else -%}\n https://github.com/home-assistant/core/releases/tag/{{-\ \ trigger.event.data.new_state.attributes.latest_version -}}\n {%- endif\ \ -%}\n{%- elif state_attr(trigger.event.data.entity_id, 'release_url') is\ \ not none -%}\n {{- state_attr(trigger.event.data.entity_id, 'release_url')\ \ -}}\n{%- elif device_attr(trigger.event.data.entity_id, 'configuration_url')\ \ is match('homeassistant://', ignorecase=True) -%}\n {{- device_attr(trigger.event.data.entity_id,\ \ 'configuration_url') | replace('homeassistant:/', states('sensor.instance_external_url_config'))\ \ -}}\n{%- else -%}\n {{- states('sensor.instance_external_url_config') -}}/config/dashboard\n\ {%- endif %}" latest_version: '{{ trigger.event.data.new_state.attributes.latest_version }}' installed_version: '{{ state_attr(trigger.event.data.entity_id, ''installed_version'') }}' friendlyname: '{{- trigger.event.data.new_state.name | replace('' Update'', '''') -}}' - choose: - conditions: '{{ trigger.event.data.new_state.attributes.installed_version = trigger.event.data.old_state.attributes.installed_version }} ' sequence: - variables: old_installed_version: '{{ trigger.event.data.old_state.attributes.installed_version }}' - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''🎊'' }} *Системное обновление*' message: 'Обновлен {{ friendlyname }} с {{ old_installed_version }} на [{{ latest_version }}]({{- release_url }}) версию. ' disable_web_page_preview: true default: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''🎉'' }} *Системное обновление*' message: 'Доступна [{{ latest_version }}]({{- release_url }}) версия {{ friendlyname }} для установки, текущая *{{ installed_version }}*. ' disable_web_page_preview: true inline_keyboard: '{{ iif(state_attr(trigger.event.data.entity_id, ''supported_features'') | int(0) > 0, [''Установить:/installupdate '' + trigger.event.data.entity_id], []) }}' - sequence: - condition: '{{ not is_state_attr(trigger.event.data.entity_id, ''device_class'', ''firmware'') }}' - action: notify.html5 data: title: '{{ ''🎉'' }} *Системное обновление*' message: Доступна {{ latest_version }} версия {{ friendlyname }} для установки, текущая {{ installed_version }} target: n550jk data: url: '{{- release_url }}' actions: '{{ iif(state_attr(trigger.event.data.entity_id, ''supported_features'') | int(0) > 0, [{''action'':''install_update'', ''title'':''Обновить''}], []) }}' tag: 'update_available_notify_ {{- trigger.event.data.entity_id | replace(''update.'', '''') }} ' - alias: notification low battery zigbee id: notification low battery zigbee initial_state: true triggers: - trigger: time at: '20:00:00' conditions: "{%- set entities = expand('group.dynamic_group_sensor_battery') -%}\ \ {%- set datanames = namespace(entity_name=[]) -%} {% for x in entities -%}\n\ \ {% set entity_this_z2m = states.sensor[x.entity_id | replace('sensor.', '')\ \ | replace('_battery', '_last_seen')] is not none -%}\n {% set entity_this_gw3\ \ = states.sensor[x.entity_id | replace('sensor.', '') | replace('_battery', '_zigbee')]\ \ is not none -%}\n {% if (not x.entity_id.endswith(\"_low_battery\") and x.state\ \ | int(101) <= iif(entity_this_z2m or entity_this_gw3, 55, 20)) or (x.entity_id.endswith(\"\ _low_battery\") and x.state | string == 'on') -%}\n {% set datanames.entity_name\ \ = datanames.entity_name + ['_' + x.name + '_'] -%}\n {% endif %}\n{%- endfor\ \ %} {{ datanames.entity_name | list | count > 0 }}\n" actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''\U0001f50b'' -}} *Низкий заряд*' message: "Для устройств: {{- '\\n' -}} {%- set entities = expand('group.dynamic_group_sensor_battery')\ \ -%} {%- set datanames = namespace(entity_name=[]) -%} {% for x in entities\ \ -%}\n {% set entity_this_z2m = states.sensor[x.entity_id | replace('sensor.',\ \ '') | replace('_battery', '_last_seen')] is not none -%}\n {% set entity_this_gw3\ \ = states.sensor[x.entity_id | replace('sensor.', '') | replace('_battery',\ \ '_zigbee')] is not none -%}\n {% if (not x.entity_id.endswith(\"_low_battery\"\ ) and x.state | int(101) <= iif(entity_this_z2m or entity_this_gw3, 55, 20))\ \ -%}\n {% set datanames.entity_name = datanames.entity_name + ['_' + x.name\ \ + '_' + ': *' + x.state + '*%'] -%}\n {% endif -%}\n {% if (x.entity_id.endswith(\"\ _low_battery\") and x.state | string == 'on') -%}\n {% set datanames.entity_name\ \ = datanames.entity_name + ['_' + x.name + '_'] -%}\n {% endif %}\n{%- endfor\ \ %} {{- datanames.entity_name | list | join(', \\n') }}" - alias: notification safety sockets on restart id: notification safety sockets on restart initial_state: true triggers: - trigger: homeassistant event: start conditions: - condition: state entity_id: switch.0x842e14fffe5047f5 state: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''\U0001f50c'' }} *Управляемые розетки*' message: После перезапуска НА осталась включена розетка обогревателя. - alias: notification safety sockets off id: notification safety sockets off initial_state: true triggers: - trigger: numeric_state entity_id: - sensor.0x842e14fffe5047f5_power - sensor.0x842e14fffe13a854_power - sensor.0x588e81fffeff5c4f_power - sensor.0x842e14fffe36661f_power - sensor.shelly_plug_s_1_power - sensor.0x60a423fffef8d41a_power - sensor.shelly_plug_s_2_power - sensor.shelly_plug_s_nvr_power - sensor.shelly_plug_s_keenetic_hw_power - sensor.shelly_plug_s_htr_shelly_heated_tr_power above: 3000 actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: ⚠️ *Управляемые розетки* message: 'Сработала защита по превышению потребления для розетки: {{ ''\n'' }} _{{ device_attr(trigger.entity_id, ''name'') }}_' - alias: notification public ip changed id: notification public ip changed initial_state: true mode: queued triggers: - trigger: state entity_id: sensor.myip actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''\U0001f4f6'' }} *Трекинг устройств*' message: "{%- if trigger.from_state.state in ['unavailable', 'unknown', '']\ \ -%}\n Внешний IP-адрес определен `{{ trigger.to_state.state }}`\n{%-\ \ else -%}\n Внешний IP-адрес изменен с `{{ trigger.from_state.state\ \ }}` на `{{ trigger.to_state.state }}`\n{%- endif -%}" - action: notify.notify data: title: '{{ ''\U0001f4f6'' }} Трекинг устройств' message: "{%- if trigger.from_state.state in ['unavailable', 'unknown', '']\ \ -%}\n Внешний IP-адрес определен {{ trigger.to_state.state }}\n{%-\ \ else -%}\n Внешний IP-адрес изменен с {{ trigger.from_state.state }}\ \ на {{ trigger.to_state.state }}\n{%- endif -%}" - choose: - conditions: - condition: state entity_id: media_player.lg_smart_tv state: 'on' sequence: - action: notify.kotletochka_tv data: message: 'Интернет: возможно переключились на LTE' - alias: notification low level water id: notification low level water initial_state: true triggers: - trigger: state entity_id: binary_sensor.zhimi_humidifier_cb1_low_water_level from: 'off' to: 'on' - trigger: state entity_id: binary_sensor.zhimi_humidifier_ca4_low_water_level from: 'off' to: 'on' conditions: - '{{ states(trigger.entity_id | replace(''binary_sensor.'', ''sensor.'') | replace(''_low'', '''')) | int(0) > 0 }}' actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_all_chat_id title: '{{ ''\U0001F6B0'' }} *Увлажнители*' message: 'Пора залить воду в увлажнитель: _{{- trigger.to_state.name -}}_' - choose: - conditions: - condition: state entity_id: media_player.lg_smart_tv state: 'on' sequence: - action: notify.kotletochka_tv data: message: 'Нет воды: {{- trigger.to_state.name -}}' - alias: notification vacuum maintenance id: notification vacuum maintenance initial_state: true mode: queued triggers: - trigger: state entity_id: - binary_sensor.vacuum_cleaner_main_brush_maintenance - binary_sensor.vacuum_cleaner_side_brush_maintenance - binary_sensor.vacuum_cleaner_filter_maintenance - binary_sensor.vacuum_cleaner_sensor_dirty_maintenance from: 'off' to: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_all_chat_id title: '{{ ''\U0001F527'' }} *Степа*' message: 'Необходимо провести обслуживание: _{{- trigger.to_state.name -}}_' - alias: notifications control voltage id: notifications control voltage initial_state: true mode: queued triggers: - trigger: numeric_state entity_id: sensor.shelly_em_voltage above: 250 - trigger: numeric_state entity_id: sensor.shelly_em_voltage below: 180 - trigger: numeric_state entity_id: sensor.shelly_em_voltage above: 179.9 below: 250.1 conditions: - condition: template value_template: "{{ trigger.from_state.state not in ['unavailable', 'unknown',\ \ ''] and\n (\n trigger.above == None or trigger.below == None or\n \ \ (trigger.from_state.state | float(0.0) >= trigger.below\n or trigger.from_state.state\ \ | float(0.0) <= trigger.above)\n )\n and trigger.from_state.state |\ \ float(-1.0) >= 0\n and trigger.to_state.state | float(-1.0) >= 0\n}}" actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{% if trigger.above = None and trigger.below = None %} {{ ''\U00002705'' }} {% else %} ⚠️ {% endif -%} *Контроль напряжения*' message: "{% if trigger.above = None and trigger.below == None and trigger.to_state.state\ \ | float(0.0) >= trigger.above | float(0.0) %}\n Обнаружено *повышенное*\ \ напряжение сети {{ trigger.to_state.state }}В\n{% elif trigger.above ==\ \ None and trigger.below = None and trigger.to_state.state | float(0.0) <=\ \ trigger.below | float(0.0) %}\n Обнаружено *пониженное* напряжение сети\ \ {{ trigger.to_state.state }}В\n{% else %}\n В сети *нормальное* напряжение\ \ {{ trigger.to_state.state }}В\n{% endif %}" - alias: notifications backup instance info id: notifications backup instance info mode: queued trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', None, null, ''''] }}' triggers: - trigger: state entity_id: sensor.last_google_backup_train conditions: - condition: template value_template: "{{\n trigger.from_state.state is defined and\n trigger.to_state.state\ \ is defined and\n trigger.from_state.state not in not_has_state\n and trigger.to_state.state\ \ not in not_has_state\n and state_attr('sensor.backup_state', 'backups')\ \ | count > 0\n}}" actions: - action: homeassistant.update_entity entity_id: sensor.disk_use_percent - wait_for_trigger: - trigger: state entity_id: sensor.disk_use_percent timeout: seconds: 10 - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''\U0001F4BD'' }} *Резервное копирование*' message: Создана резервная копия с именем `{{ state_attr('sensor.backup_state', 'backups')[-1].name }}`, системный диск заполнен на *{{ states('sensor.disk_use_percent') -}}*%, свободно на Google диске *{{ state_attr('sensor.backup_state', 'free_space_in_google_drive') | replace(' ', '') }}* - alias: notifications failed login or block IP id: notifications failed login or block IP mode: parallel initial_state: true triggers: - trigger: persistent_notification id: http-login update_type: - added - updated notification_id: http-login - trigger: persistent_notification id: ip-ban update_type: - added - updated notification_id: ip-ban actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: "{%- if trigger.id == 'http-login' %}\n {{- '\\U0001F6AB' -}}\n\ {% else %}\n {{- '\\U000026D4' -}}\n{% endif %} *Вход в систему*" message: "{% set ipadress = trigger.notification.message | replace('\\n',\ \ ' ') | regex_replace('.*\\((?=\\d+\\.\\d+\\.\\d+\\.\\d+)') | regex_replace('\\\ ).*')\n | replace('Too many login attempts from ', '') %}\n\n{% if trigger.id\ \ == 'http-login' -%}\n Неудачная попытка входа в систему с адреса [{{\ \ ipadress }}](https://whatismyipaddress.com/ip/{{- ipadress }})\n{%- else\ \ -%}\n Заблокирован IP адрес [{{ ipadress }}](https://whatismyipaddress.com/ip/{{-\ \ ipadress }}), 5 попыток входа\n{%- endif %}, [логи]({{- states('sensor.instance_external_url_config')\ \ -}}/config/logs)\n" disable_web_page_preview: true - action: persistent_notification.dismiss data: notification_id: '{{ trigger.id }}' - alias: notification start or stop home assistant id: notification start or stop home assistant mode: parallel initial_state: true triggers: - trigger: homeassistant id: homeassistant_start event: start - trigger: homeassistant event: shutdown actions: - variables: long_start_integrations_name: "{% if states.sensor.start_time.attributes is\ \ defined and states.sensor.start_time.attributes.setup_time is defined %}\n\ \ {% set separator = joiner(', ') %}\n {% set attrs = states.sensor.start_time.attributes.setup_time\ \ %}\n {% for attr in attrs if attrs[attr] | float(0.0) >= 9 %}\n {{-\ \ separator() + attr | replace('_', '-') -}}\n {% endfor %}\n{% else %}\n\ \ {{ '' }}\n{% endif %}" - if: - condition: trigger id: homeassistant_start then: - action: homeassistant.update_entity data: entity_id: - sensor.errors_in_system_log_command_line - sensor.warnings_in_system_log_command_line - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true disable_web_page_preview: true title: "{%- if trigger.id == 'homeassistant_start' %}\n {{- '\\U00002705'\ \ -}}\n{% else %}\n {{- '\\U000026d4' -}}\n{% endif %} *Трекинг устройств*\n" message: "{% if trigger.id == 'homeassistant_start' -%}\n Home Assistant\ \ запущен за {{ states('sensor.start_time') }}сек. (версия Core: [{{ state_attr('update.home_assistant_core_update',\ \ 'installed_version') }}](https://github.com/home-assistant/core/releases/tag/{{-\ \ state_attr('update.home_assistant_core_update', 'installed_version') }}))\ \ {{- '\\n' -}}\n Ошибок: *{{ states('sensor.errors_in_system_log_command_line')\ \ }}*, предупреждений: *{{ states('sensor.warnings_in_system_log_command_line')\ \ }}* {{- '\\n' -}}\n {{ iif(long_start_integrations_name = '', 'Интеграции\ \ (>9c.): _' + long_start_integrations_name + '_', '') }}\n{% else -%}\n \ \ Home Assistant *остановлен*, время работы: {{ states('sensor.online_custom')\ \ }}\n{% endif -%}\n" - alias: notifications errors in automations or scripts id: notifications errors in automations or scripts mode: queued triggers: - trigger: event event_type: system_log_event event_data: level: ERROR conditions: - condition: state entity_id: binary_sensor.local_network_availability state: 'on' - '{{ (trigger.event.data.name | string) is not search(this.entity_id | string, ignorecase=True) }}' - condition: template value_template: "{{ \n trigger.event.data.message | regex_search('Error while\ \ executing automation') or\n trigger.event.data.message | regex_search('Error\ \ executing script')\n}}" - condition: template value_template: "{{ \n trigger.event.data.message | length < 4000\n}}" actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id parse_mode: html disable_web_page_preview: true title: '{{ ''⛔'' }} Ошибка выполнения скрипта' message: '{{ trigger.event.data.message | string | e -}} Check logs. ' - alias: notifications objects in unavailable status initial_state: true mode: queued max: 70 trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable''] }}' triggers: - trigger: event event_type: state_changed conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - '{{ trigger.event.data.new_state.state in not_has_state }}' - '{{ trigger.event.data.entity_id in expand(''group.important_devices_unavailable'') | map(attribute=''entity_id'') | list }}' - '{{ trigger.event.data.new_state.state = trigger.event.data.old_state.state }}' actions: - choose: - conditions: '{{ is_state(''input_boolean.instances_stoping'', ''off'') }}' sequence: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true parse_mode: html title: ⚠️ Трекинг устройств message: '{{ state_attr(trigger.event.data.entity_id, ''friendly_name'') }} сменил статус на {{ trigger.event.data.new_state.state }} ' - alias: notifications on off water heater id: notifications on off water heater mode: parallel initial_state: true trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', None, null, ''''] }}' triggers: - trigger: state entity_id: sensor.0x842e14fffe13a854_power conditions: - condition: state entity_id: input_boolean.water_heater_season state: 'on' - condition: template value_template: "{{ trigger.from_state.state not in not_has_state and\n trigger.to_state.state\ \ not in not_has_state and\n trigger.to_state.state = trigger.from_state.state\n\ }}\n" - condition: template value_template: "{{ \n (trigger.to_state.state | int(0) >= 850 and trigger.from_state.state\ \ | int(0) <= 30)\n or\n (trigger.to_state.state | int(0) < 30 and trigger.from_state.state\ \ | int(0) > 850)\n}}\n" actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true title: '{{ iif(trigger.to_state.state | int(0) >= 30, ''ℹ️'', ''\U00002705'') }} *Водонагреватель*' message: '{{ iif(trigger.to_state.state | int(0) >= 30, ''*Включен*'', ''*Отключен*'') }} нагрев воды' - alias: notifications stale google drive backup id: notifications stale google drive backup max_exceeded: silent initial_state: true triggers: - trigger: state entity_id: binary_sensor.backups_stale from: 'off' to: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_web_page_preview: true title: '{{ ''⛔'' }} *Резервное копирование БД*' message: 'Проблема с бекапом Google Drive, [логи]({{- states(''sensor.instance_external_url_config'') -}}/hassio/addon/cebe7a76_hassio_google_drive_backup/logs) ' - alias: notifications entry discovery integration id: notifications entry discovery integrations mode: queued initial_state: true triggers: - trigger: event event_type: config_entry_discovered actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true title: '{{ ''📟'' }} *Устройства*' message: 'Найдено новое устройство в сети, [просмотреть]({{- states(''sensor.instance_external_url_config'') -}}/config/integrations) ' - alias: notifications entry discovery id: notifications entry discovery mode: queued max: 99 max_exceeded: silent initial_state: true triggers: - trigger: event event_type: entity_registry_updated - trigger: event id: device_registry event_type: device_registry_updated conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' actions: - variables: name_for_send: "{% if trigger.id == 'device_registry' -%}\n {% if device_attr(trigger.event.data.device_id,\ \ 'name_by_user') = none -%}\n {{- device_attr(trigger.event.data.device_id,\ \ 'name_by_user') -}}\n {%- else -%}\n {% set temp_name = device_attr(trigger.event.data.device_id,\ \ 'name') %}\n {{- iif(temp_name = none, temp_name, trigger.event.data.device_id,\ \ trigger.event.data.device_id) -}}\n {%- endif -%}\n{%- else -%}\n ''\n\ {%- endif %}" - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true parse_mode: html title: '{{ ''📟'' }} Устройства' message: "{% if trigger.id == 'device_registry' %}\n {{ trigger.event.data.action\ \ | capitalize }}: {{ name_for_send }}\n{% else %}\n {{ trigger.event.data.action\ \ | capitalize }}: {{ trigger.event.data.old_entity_id + '->' if trigger.event.data.old_entity_id\ \ is defined }}{{ trigger.event.data.entity_id if trigger.event.data.entity_id\ \ is defined else 'NA' }}\n{% endif %}" - alias: notifications automation already running id: notifications automation already running initial_state: true mode: queued triggers: - trigger: event event_type: system_log_event event_data: level: WARNING conditions: - condition: template value_template: '{{ "Already running" in (trigger.event.data.message | string) }}' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true parse_mode: html title: ⚠️ Выполнение автоматизаций message: 'Повторный запуск автоматизации: {{ trigger.event.data.message | string | e }}' - alias: system log critical error notify id: system log critical error notify initial_state: true mode: queued triggers: - trigger: event event_type: system_log_event event_data: level: FATAL - trigger: event event_type: system_log_event event_data: level: CRITICAL actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id parse_mode: html disable_web_page_preview: true title: '{{ ''⛔'' }} Ошибки системного журнала' message: '{{ trigger.event.data.message | string | e -}} Check logs. ' - alias: notifications sms unread or full storage id: notifications sms unread or full storage initial_state: true max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', None, null, ''''] }}' triggers: - trigger: state entity_id: sensor.huawei_e3372h_320_sms_unread - trigger: state id: full_storage entity_id: binary_sensor.huawei_e3372h_320_sms_storage_full from: 'off' to: 'on' conditions: - condition: template value_template: "{{ trigger.id == 'full_storage' or\n trigger.to_state.state\ \ not in not_has_state and\n trigger.to_state.state | int(0) > trigger.from_state.state\ \ | int(0)\n}}\n" actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true title: '{% if trigger.id == ''full_storage'' -%} {{ ''\U0001F4EE'' }} {%- else -%} {{ ''\U00002709'' }} {%- endif %} *SMS через модем* ' message: 'Обнаружено {% if trigger.id == ''full_storage'' -%} заполнение памяти {%- else -%} *{{ trigger.to_state.state }}* {{ trigger.to_state.state | int(0) | format(morph=''непрочитанное'', as_text=false) | replace(trigger.to_state.state + '' '', '''') }} {%- endif %} sms на {{ device_attr(trigger.entity_id, ''name'') }} ' - alias: notifications link down keenetic id: notifications link down keenetic initial_state: true max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.check_keenetic_link_down to: 'off' - trigger: state entity_id: binary_sensor.check_keenetic_link_down to: 'on' - trigger: homeassistant event: start - trigger: event event_type: event_template_reloaded conditions: - condition: numeric_state entity_id: counter.counter_keenetic_link_down above: 0 actions: - parallel: - action: notify.huawei_lte data: message: '{{ ''\U0000203C'' }} {{ states(''sensor.check_keenetic_link_down'') | as_timestamp | timestamp_custom(''%Y-%m-%d %H:%M'') }} Keenetic link is down' target: secret sms_phone_enzokot data: url: http://192.168.8.1/ - action: counter.reset entity_id: counter.counter_keenetic_link_down - alias: notifications new rss posts id: notifications new rss posts mode: queued triggers: - trigger: event event_type: feedreader conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' actions: - variables: all_chat_id: secret telegram_all_chat_id enzokot_chat_id: secret telegram_enzokot_chat_id stormy_notification: '{{ trigger.event.data.feed_url is search(''shtormovye-i-ekstrennye-preduprezhdeniya'', ignorecase=True) }}' - action: telegram_bot.send_message data: target: "{% if stormy_notification %}\n {{ all_chat_id }}\n{% else %}\n \ \ {{ enzokot_chat_id }}\n{% endif %}\n" disable_notification: '{{ not stormy_notification }}' disable_web_page_preview: true parse_mode: html title: '{{ ''📰'' }} RSS новости' message: '{{- trigger.event.data.title | e }} ({{ trigger.event.data.link | regex_findall(find=''^(?:\w+://)?([^/?#]+)'', ignorecase=True) | join }}) ' - alias: notifications warnings or errors in syslog id: notifications warnings or errors in syslog initial_state: true max_exceeded: silent triggers: - trigger: time_pattern hours: /1 minutes: 30 - trigger: numeric_state entity_id: counter.system_log_warning_counter above: 10 - trigger: numeric_state entity_id: counter.system_log_error_counter above: 5 conditions: - '{{ states(''counter.system_log_error_counter'') | int(0) > 0 or states(''counter.system_log_warning_counter'') | int(0) > 0 }}' - condition: time after: '8:30:00' before: '23:00:00' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true title: '{{ ''📖'' }} *Данные системного журнала*' message: "{% if states('counter.system_log_error_counter') | int(0) > 0 -%}\n\ \ Ошибок в логе: *{{ states('counter.system_log_error_counter') }}*\n{%\ \ endif -%}\n{% if states('counter.system_log_warning_counter') | int(0) >\ \ 0 -%}\n Предупреждений в логе: *{{ states('counter.system_log_warning_counter')\ \ }}*\n{% endif -%}\n[Просмотр логов]({{- states('sensor.instance_external_url_config')\ \ -}}/config/logs)" - alias: telegram is offline for instance notification id: telegram is offline for instance notification initial_state: true triggers: - trigger: state entity_id: - sensor.telegram_status from: online to: offline for: 00:01:20 actions: - choose: - conditions: - condition: time after: '8:00:00' before: '23:00:00' sequence: - action: notify.huawei_lte data: message: '{{ ''\U0000203C'' }} Telegram API недоступно' target: secret sms_phone_enzokot data: url: http://192.168.8.1/ default: - action: notify.email_enzokot_ha data: title: ⚠️ Трекинг устройств message: Telegram API недоступно - alias: yandex station to or from local mode notification id: yandex station to or from local mode notification mode: queued initial_state: true triggers: - trigger: state id: non_local entity_id: - binary_sensor.yandex_station_ff98f029b620413b35e5e278_assumed_state - binary_sensor.yandex_station_lr0000000000000252130000de5d13d0_assumed_state - binary_sensor.yandex_station_m00ka4300h99tr_assumed_state from: 'off' to: 'on' - trigger: state entity_id: - binary_sensor.yandex_station_ff98f029b620413b35e5e278_assumed_state - binary_sensor.yandex_station_lr0000000000000252130000de5d13d0_assumed_state - binary_sensor.yandex_station_m00ka4300h99tr_assumed_state from: 'on' to: 'off' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true parse_mode: html title: '{% if trigger.id == ''non_local'' %} ⚠️ {% else %} {{ ''\U00002705'' }} {% endif -%} Трекинг устройств ' message: 'Станция {{- trigger.to_state.name | e -}} {% if trigger.id == ''non_local'' -%} отключила локальный режим управления {%- else -%} перешла в локальный режим управления {%- endif %} ' - alias: hot pipe low or up temperature notification id: hot pipe low or up temperature notification mode: queued initial_state: true triggers: - trigger: numeric_state id: below entity_id: - sensor.0x00158d0006c5f21e_temperature - sensor.0x158d0006b860cf_temperature - sensor.0x00158d0008386b56_temperature below: 40 for: minutes: 5 - trigger: numeric_state entity_id: - sensor.0x00158d0006c5f21e_temperature - sensor.0x158d0006b860cf_temperature - sensor.0x00158d0008386b56_temperature above: 40 for: minutes: 5 actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_all_chat_id title: '{{ iif(trigger.id == ''below'', ''\U0001F6B1'' , ''\U0001F6B0'') }} *Горячее водоснабжение*' message: '{{ iif(trigger.id == ''below'', ''Остывает'' , ''Нагревается'') }} горячая труба *{{ area_name(trigger.entity_id) }}*.' - choose: - conditions: '{{ trigger.id == ''below'' and trigger.entity_id == ''sensor.0x00158d0006c5f21e_temperature'' }}' sequence: - action: notify.huawei_lte data: message: '{{ ''\U0000203C'' }} Остывает горячая труба {{ area_name(trigger.entity_id) }}.' target: secret sms_phone_enzokot data: url: http://192.168.8.1/ - alias: system down uptime kuma notifications id: system down uptime kuma notifications mode: queued triggers: - trigger: webhook webhook_id: secret webhook_id_system_down_uptime_kuma local_only: true allowed_methods: - POST conditions: - '{{ trigger.json.monitor is not none }}' actions: - variables: status_from: '{{ iif(trigger.json.heartbeat is not none and trigger.json.heartbeat.status | int(0) == 1, ''online'', ''offline'', ''offline'') }}' - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id parse_mode: html title: '{{ iif(status_from == ''online'', ''\U00002705'', ''\U000026d4'', ''\U000026d4'') }} Трекинг устройств' message: '{{ trigger.json.monitor.name }} {{ iif(status_from == ''online'', ''в'', ''не в'', ''не в'') }} сети' - choose: - conditions: '{{ ''tsymbal'' in trigger.json.monitor.name | lower and is_state(''binary_sensor.internet_availability_ping'', ''on'') }}' sequence: - action: notify.huawei_lte data: message: '{{ iif(status_from == ''online'', ''\U00002705'', ''\U000026d4'', ''\U000026d4'') }} Link from Enzokot is {{ iif(status_from == ''online'', ''up'', ''down'', ''down'') }}' target: secret sms_phone_to4ko data: url: http://192.168.8.1/ - alias: gw2 alarm turn on off notification id: gw2 alarm turn on off notification initial_state: true triggers: - trigger: state entity_id: alarm_control_panel.signalka_shliuza_alarm not_from: - unknown - unavailable - '' to: - armed_away - disarmed actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id message: '{{ iif(is_state(''alarm_control_panel.signalka_shliuza_alarm'', ''disarmed''), ''🔇 Сигнализация *выключена*'', ''🔉 Сигнализация *включена*'') }}' - alias: repairs issue registry id: repairs issue registry mode: queued triggers: - trigger: state entity_id: sensor.repairs_state not_from: - unknown - unavailable - trigger: homeassistant id: homeassistant_start event: start conditions: - '{{ trigger.id == ''homeassistant_start'' and states(''sensor.repairs_state'') | int(0) > 0 or trigger.id = ''homeassistant_start'' and trigger.from_state.state | int(0) < trigger.to_state.state | int(0) }}' actions: - if: - '{{ trigger.id == ''homeassistant_start'' }}' then: - delay: 2 - condition: '{{ trigger.id == ''homeassistant_start'' and states(''sensor.repairs_state'') | int(0) > 0 or trigger.id = ''homeassistant_start'' and trigger.from_state.state | int(0) < trigger.to_state.state | int(0) }}' - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id parse_mode: html title: '{{ ''\U0001F41B'' }} Устранение проблем' message: "{%- set issues = state_attr('sensor.repairs_state', 'issues') -%}\ \ {%- set datanames = namespace(issue=[]) -%} {% for issue in issues %}\n\ \ {% set datanames.issue = datanames.issue + ['Домен: ' + issue.domain\ \ + ', описание: ' + issue.issue_id + ''] -%}\n{% endfor %} Обнаружены\ \ проблемы ({{- states('sensor.repairs_state') -}}шт):{{'\\n'-}} {{ datanames.issue\ \ | join(', \\n') }}" - alias: login ssh from servers id: login ssh from servers mode: queued triggers: - trigger: state entity_id: sensor.login_ssh_kotletochka_dell_srv not_from: - unknown - unavailable not_to: - unknown - unavailable actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id parse_mode: html title: '{{ ''\U00002328'' }} Вход по SSH' message: '{{- state_attr(''sensor.login_ssh_kotletochka_dell_srv'', ''friendly_name'') -}}: {{- as_timestamp(trigger.to_state.state) | timestamp_custom(''%d.%m.%Y %H:%M:%S'') -}} Пользователь: {{- trigger.to_state.attributes.user -}}, адрес: {{- trigger.to_state.attributes.address -}}, tty: {{- trigger.to_state.attributes.tty -}}' - alias: xiaomi mi scale new weight id: xiaomi mi scale new weight mode: queued triggers: - trigger: state entity_id: sensor.esp_xiaomi_mi_scale_weight not_from: - unknown - unavailable not_to: - unknown - unavailable actions: - variables: first_name_father: secret first_name_father first_name_mother: secret first_name_mother first_name_daughter: secret first_name_daughter - action: telegram_bot.send_message data: target: secret telegram_all_chat_id disable_notification: true title: '{{ ''⚖'' }} *Взвешивание*' message: '*{%- if trigger.to_state.state | float(0.0) >= 90 %} {{- first_name_father -}} {% elif trigger.to_state.state | float(0.0) >= 40 %} {{- first_name_mother -}} {% else %} {{- first_name_daughter -}} {% endif -%}* весит `{{- trigger.to_state.state -}}` {{ trigger.to_state.attributes.unit_of_measurement -}}' - alias: host kernel ext4 warning id: host kernel ext4 warning max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.kernel_ext4_warning from: 'off' to: 'on' - trigger: time at: '10:30:00' conditions: - condition: state entity_id: binary_sensor.kernel_ext4_warning state: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true title: ⚠️ *Host Kernel log* message: '{{ state_attr(''binary_sensor.kernel_ext4_warning'', ''friendly_name'') }}' - alias: notification wet entrance floor id: notification wet entrance floor initial_state: true max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.0x00158d000913dbf1_contact from: 'off' to: 'on' for: seconds: 5 conditions: - condition: time after: 06:00:00 before: '16:00:00' weekday: - mon - '{{ now() - state_attr(this.entity_id, ''last_triggered'') > timedelta(hours = 1) }}' actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''🧹'' }} *Влажная уборка*' message: Обнаружена уборка в общем коридоре - action: notify.huawei_lte data: message: Обнаружена уборка в общем коридоре target: secret sms_phone_users56_59 data: url: http://192.168.8.1/ - alias: notification water leak near nvr id: notification water leak near nvr initial_state: true mode: queued triggers: - trigger: state entity_id: - binary_sensor.0x00158d0009ea0949_water_leak - binary_sensor.0x00158d0009ea1c0e_water_leak to: 'on' for: seconds: 10 actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''💧'' }} *Датчики протечки*' message: 'Обнаружена протечка возле NVR/Камер: *{{ state_attr(trigger.entity_id, ''friendly_name'') }}*' - action: notify.huawei_lte data: message: 'Обнаружена протечка возле NVR/Камер: {{ state_attr(trigger.entity_id, ''friendly_name'') }}' target: secret sms_phone_users59_60 data: url: http://192.168.8.1/ - sequence: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - action: notify.notify data: title: '{{ ''💧'' }} Датчики протечки' message: 'Обнаружена протечка возле NVR: {{ state_attr(trigger.entity_id, ''friendly_name'') }}' data: ttl: 0 priority: high channel: alarm_stream - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification open door nvr box id: notification open door nvr box initial_state: true mode: queued triggers: - trigger: state entity_id: binary_sensor.0x00158d00093e4111_contact from: 'off' to: 'on' for: seconds: 5 actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''🔑'' }} *Датчик открытия/закрытия*' message: Обнаружено *открытие* дверцы шкафа с NVR - action: notify.huawei_lte data: message: Обнаружено открытие дверцы шкафа с NVR target: secret sms_phone_enzokot data: url: http://192.168.8.1/ - sequence: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - action: notify.notify data: title: '{{ ''🔑'' }} Датчик открытия/закрытия' message: Обнаружено открытие дверцы шкафа с NVR data: ttl: 0 priority: high channel: alarm_stream - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification overheating 1pm fan nvr box id: notification overheating 1pm fan nvr box initial_state: true mode: queued triggers: - trigger: state id: overheating entity_id: binary_sensor.shelly_1pm_fan_nvr_box_overheating from: 'off' to: 'on' for: seconds: 5 - trigger: numeric_state entity_id: sensor.shelly_1pm_fan_nvr_box_temperature above: 35 for: seconds: 5 actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''🌡'' }} *Реле кулера шкафа NVR*' message: "{{ \n iif(trigger.id == 'overheating', \n 'Обнаружен *перегрев*\ \ реле кулера шкафа NVR (*T=' + states('sensor.shelly_1pm_fan_nvr_box_device_temperature',\ \ true, true) + '*)', \n 'Обнаружена высокая (*' + trigger.to_state.state\ \ + '*) температура в шкафу NVR')\n}}" - alias: notification nvr in unavailable status id: notification nvr in unavailable status initial_state: true mode: queued triggers: - trigger: state entity_id: button.kotletochka_nvr_hw_restart to: null for: seconds: 10 conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - condition: numeric_state entity_id: sensor.shelly_plug_s_nvr_power below: 15 actions: - parallel: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''📼'' }} *Состояние NVR*' message: Обнаружено *отключение* NVR - action: notify.huawei_lte data: message: Обнаружено отключение NVR target: secret sms_phone_enzokot data: url: http://192.168.8.1/ - sequence: - variables: sm_g973f_rezhim_ne_bespokoit: '{{ states(''sensor.sm_g973f_do_not_disturb_sensor'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: 'off' - wait_for_trigger: - trigger: state entity_id: sensor.sm_g973f_do_not_disturb_sensor timeout: seconds: 5 - variables: sm_g973f_rezhim_zvonka: '{{ states(''sensor.sm_g973f_ringer_mode'') }}' - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.notify data: message: command_ringer_mode data: command: normal - action: notify.notify data: title: '{{ ''📼'' }} Состояние NVR' message: Обнаружено отключение NVR data: ttl: 0 priority: high channel: alarm_stream - choose: - conditions: '{{ sm_g973f_rezhim_zvonka = ''normal'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_ringer_mode data: command: '{{ sm_g973f_rezhim_zvonka }}' - choose: - conditions: '{{ sm_g973f_rezhim_ne_bespokoit = ''off'' }}' sequence: - action: notify.mobile_app_sm_g973f data: message: command_dnd data: command: '{{ sm_g973f_rezhim_ne_bespokoit }}' - alias: notification full battery level sm g973f id: notification full battery level sm g973f initial_state: true max_exceeded: silent triggers: - trigger: numeric_state entity_id: sensor.sm_g973f_battery_level above: 99 conditions: - condition: state entity_id: binary_sensor.sm_g973f_is_charging state: 'on' actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''🔋'' }} *Состояние телефона*' message: Телефон полностью заряжен - alias: notification tapo c100 cr or hw disconnected id: notification tapo c100 cr or hw disconnected initial_state: true mode: parallel triggers: - trigger: webhook id: cr webhook_id: secret webhook_id_cctv_cr_off local_only: true allowed_methods: - PUT - trigger: webhook webhook_id: secret webhook_id_cctv_hw_off local_only: true allowed_methods: - PUT actions: - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: ⚠️ *Трекинг устройств* message: Камера в *{{- iif(trigger.id == 'cr', 'детской', 'коридоре') -}}* отключена - alias: notification forward message from download station to telegram id: notification forward message from download station to telegram initial_state: true mode: parallel triggers: - trigger: event event_type: imap_content event_data: initial: true actions: - parallel: - action: imap.seen data: entry: '{{ trigger.event.data[''entry_id''] }}' uid: '{{ trigger.event.data[''uid''] }}' - sequence: - action: imap.fetch data: entry: '{{ trigger.event.data[''entry_id''] }}' uid: '{{ trigger.event.data[''uid''] }}' response_variable: message_text - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id title: '{{ ''📂'' }} *Download station*' message: '{{ message_text[''text''] }}' disable_web_page_preview: true - alias: turn off nvr from water leak id: turn off nvr from water leak initial_state: true triggers: - trigger: state entity_id: - binary_sensor.0x00158d0009ea0949_water_leak - binary_sensor.0x00158d0009ea1c0e_water_leak to: 'on' for: seconds: 7 actions: - parallel: - action: switch.turn_off target: entity_id: switch.shelly_plug_s_nvr - if: - '{{ trigger.entity_id == ''binary_sensor.0x00158d0009ea0949_water_leak'' }}' - condition: state entity_id: switch.shelly_1pm_fan_nvr_box state: 'on' then: - action: switch.turn_off target: entity_id: switch.shelly_1pm_fan_nvr_box - alias: turn on fan nvr box every hour or above temperature id: turn on fan nvr box every hour or above temperature initial_state: true mode: queued triggers: - trigger: time_pattern hours: /1 minutes: 0 id: time_trigger - trigger: numeric_state entity_id: - sensor.shelly_1pm_fan_nvr_box_temperature above: 34.5 conditions: - condition: state entity_id: - switch.shelly_1pm_fan_nvr_box - binary_sensor.0x00158d00093e4111_contact state: 'off' - '{{ is_state(''binary_sensor.0x00158d0009ea1c0e_water_leak'', ''off'') or not has_value(''binary_sensor.0x00158d0009ea1c0e_water_leak'') }}' - '{{ is_state(''binary_sensor.0x00158d0009ea0949_water_leak'', ''off'') or not has_value(''binary_sensor.0x00158d0009ea0949_water_leak'') }}' - "{% set time_now = now() %} {{ \n (today_at('9:00') <= time_now < today_at('21:00:00')\ \ or states('sensor.shelly_1pm_fan_nvr_box_temperature') | float(0.0) > 34.5)\n\ \ or trigger.id != 'time_trigger' and (time_now >= today_at('21:00:00') or\ \ time_now < today_at('9:00:00')) \n}}\n" actions: - action: switch.turn_on target: entity_id: switch.shelly_1pm_fan_nvr_box - alias: turn off fan nvr box when door is open id: turn off fan nvr box when door is open initial_state: true mode: queued triggers: - trigger: state entity_id: binary_sensor.0x00158d00093e4111_contact from: 'off' to: 'on' for: seconds: 3 conditions: - condition: state entity_id: switch.shelly_1pm_fan_nvr_box state: 'on' actions: - action: switch.turn_off target: entity_id: switch.shelly_1pm_fan_nvr_box - alias: night on off water heater id: night off water heater initial_state: true triggers: - trigger: time at: '22:30:00' - trigger: time at: 06:15:00 conditions: - condition: state entity_id: input_boolean.water_heater_season state: 'on' actions: - action: "{% if trigger.now.hour == 22 %}\n switch.turn_off\n{% else %}\n \ \ switch.turn_on\n{% endif %}\n" target: entity_id: switch.0x842e14fffe13a854 - alias: night mode on heater id: night mode on heater initial_state: true triggers: - trigger: time at: '22:00:00' conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'on' actions: - action: switch.turn_on target: entity_id: switch.0x842e14fffe5047f5 - action: timer.start target: entity_id: timer.turn_off_heater_night_mode - alias: night mode off heater id: night mode off heater initial_state: true triggers: - trigger: time at: 07:00:00 conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'on' actions: - action: timer.cancel target: entity_id: timer.turn_on_heater_night_mode - action: timer.cancel target: entity_id: timer.turn_off_heater_night_mode - action: switch.turn_off target: entity_id: switch.0x842e14fffe5047f5 - alias: night mode timer heater off id: night mode timer heater off initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.turn_off_heater_night_mode conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'on' - condition: time after: '22:00:00' before: 07:00:00 actions: - action: switch.turn_off target: entity_id: switch.0x842e14fffe5047f5 - action: timer.start target: entity_id: timer.turn_on_heater_night_mode - alias: night mode timer heater on id: night mode timer heater on initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.turn_on_heater_night_mode conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'on' - condition: time after: '22:00:00' before: 07:00:00 actions: - action: switch.turn_on target: entity_id: switch.0x842e14fffe5047f5 - action: timer.start target: entity_id: timer.turn_off_heater_night_mode - alias: on off night mode heater at action time id: on off night mode heater at action time initial_state: true triggers: - trigger: state entity_id: input_boolean.heater_night_mode conditions: - condition: time after: '22:00:00' before: 07:00:00 actions: - choose: - conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'off' sequence: - action: automation.trigger target: entity_id: automation.night_mode_off_heater - conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'on' sequence: - action: automation.trigger target: entity_id: automation.night_mode_on_heater - alias: safety power socets off id: safety power socets off initial_state: true triggers: - trigger: numeric_state entity_id: - sensor.0x842e14fffe5047f5_power - sensor.0x842e14fffe13a854_power - sensor.0x842e14fffe36661f_power - sensor.0x588e81fffeff5c4f_power - sensor.shelly_plug_s_1_power - sensor.0x60a423fffef8d41a_power - sensor.shelly_plug_s_2_power - sensor.shelly_plug_s_nvr_power - sensor.shelly_1pm_fan_nvr_box_power - sensor.shelly_plug_s_keenetic_hw_power - sensor.shelly_plug_s_htr_shelly_heated_tr_power above: 3000 actions: - action: switch.turn_off target: entity_id: '{{ trigger.entity_id | replace(''sensor'', ''switch'') | replace(''_power'', '''') }}' - alias: restart night mode heater after reboot id: restart night mode heater after reboot initial_state: true triggers: - trigger: homeassistant event: start conditions: - condition: state entity_id: input_boolean.heater_night_mode state: 'on' - condition: time after: '22:00:00' before: 07:00:00 actions: - choose: - conditions: - condition: state entity_id: switch.0x842e14fffe5047f5 state: 'off' sequence: - action: automation.trigger target: entity_id: automation.night_mode_timer_heater_on - conditions: - condition: state entity_id: switch.0x842e14fffe5047f5 state: 'on' sequence: - action: automation.trigger target: entity_id: automation.night_mode_timer_heater_off - alias: restart z2m or instance for energy id: restart z2m or instance for energy initial_state: true mode: parallel max: 100 trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none''] }}' entity_dict: "{{\n {\"sensor.0x842e14fffe5047f5_energy\": \"input_number.total_heater_socket_saved\"\ ,\n \"sensor.0x842e14fffe13a854_energy\": \"input_number.total_water_heater_socket_saved\"\ ,\n \"sensor.0x842e14fffe36661f_energy\": \"input_number.total_kitchen_socket1_saved\"\ ,\n \"sensor.0x588e81fffeff5c4f_energy\": \"input_number.total_bedroom_socket1_saved\"\ ,\n \"sensor.0x60a423fffef8d41a_energy\": \"input_number.total_bedroom_socket2_saved\"\ ,\n \"sensor.0x54ef441000096cbc_energy\": \"input_number.total_yeelight_ceiling_relay_saved\"\ ,\n \"sensor.shelly_em_energy\": \"input_number.total_shelly_em_saved\"\ ,\n \"sensor.shelly_plug_s_1_energy\": \"input_number.total_server_ac_saved\"\ ,\n \"sensor.shelly_plug_s_2_energy\": \"input_number.total_shelly_plug_s_2_saved\"\ ,\n \"sensor.0x54ef441000691265_energy\": \"input_number.total_kitchen_light_switch_working_area_saved\"\ ,\n \"sensor.shelly_1pm_fan_nvr_box_energy\": \"input_number.total_shelly_1pm_fan_nvr_box_saved\"\ ,\n \"sensor.shelly_plug_s_keenetic_hw_energy\": \"input_number.total_shelly_plug_s_keenetic_hw_saved\"\ ,\n \"sensor.shelly_plug_s_nvr_energy\": \"input_number.total_shelly_plug_s_nvr_saved\"\ ,\n \"sensor.shelly_plug_s_htr_shelly_heated_tr_energy\": \"input_number.total_shelly_plug_s_htr_saved\"\ }\n}}" triggers: - trigger: state entity_id: - sensor.0x842e14fffe5047f5_energy - sensor.0x842e14fffe13a854_energy - sensor.0x842e14fffe36661f_energy - sensor.0x588e81fffeff5c4f_energy - sensor.0x60a423fffef8d41a_energy - sensor.0x54ef441000096cbc_energy - sensor.shelly_em_energy - sensor.shelly_plug_s_1_energy - sensor.shelly_plug_s_2_energy - sensor.0x54ef441000691265_energy - sensor.shelly_plug_s_nvr_energy - sensor.shelly_1pm_fan_nvr_box_energy - sensor.shelly_plug_s_keenetic_hw_energy - sensor.shelly_plug_s_htr_shelly_heated_tr_energy conditions: - condition: template value_template: "{{ trigger.to_state.state not in not_has_state and\n trigger.from_state.state\ \ not in not_has_state and\n trigger.to_state.state != trigger.from_state.state\n\ }}" actions: - variables: entity_id: '{{ entity_dict[trigger.entity_id] }}' - action: input_number.set_value target: entity_id: '{{ entity_id }}' data: value: '{{ trigger.to_state.state }}' - alias: on move turn on garland childrens room id: on move turn on garland childrens room triggers: - trigger: state entity_id: binary_sensor.0x158d00054b8d72_motion from: 'off' to: 'on' conditions: - condition: or conditions: - condition: time after: 08:30:00 before: '12:30:00' - condition: time after: '16:30:00' before: '21:00:00' actions: - choose: - conditions: - condition: state entity_id: switch.0x842e14fffe5047f5 state: 'off' sequence: - action: switch.turn_on target: entity_id: switch.0x842e14fffe5047f5 - action: timer.start target: entity_id: timer.turn_off_garland_childrens_room data: duration: 300 - alias: on timer turn off garland childrens room id: on timer turn off garland childrens room initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.turn_off_garland_childrens_room conditions: - condition: state entity_id: switch.0x842e14fffe5047f5 state: 'on' actions: - action: switch.turn_off target: entity_id: switch.0x842e14fffe5047f5 - alias: DB purge everyday id: DB purge everyday initial_state: true triggers: - trigger: time at: 01:00:00 actions: - action: recorder.purge data: keep_days: 30 repack: true - alias: speedtest_integration_restart id: speedtest_integration_restart trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none''] }}' triggers: - trigger: time_pattern minutes: /45 conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - condition: state entity_id: binary_sensor.local_network_availability state: 'on' - condition: template value_template: "{{ states('sensor.speedtest_ping') in not_has_state and\n states('sensor.speedtest_download')\ \ in not_has_state and\n states('sensor.speedtest_upload') in not_has_state\n\ }}\n" actions: - action: homeassistant.reload_config_entry data: entry_id: '{{ config_entry_id(''sensor.speedtest_ping'') }}' - alias: speedtest_integration_restart_on_event id: speedtest_integration_restart_on_event mode: single max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none''] }}' triggers: - trigger: event event_type: state_changed event_data: entity_id: sensor.speedtest_ping - trigger: event event_type: state_changed event_data: entity_id: sensor.speedtest_download - trigger: event event_type: state_changed event_data: entity_id: sensor.speedtest_upload conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - '{{ as_timestamp(now()) - as_timestamp(state_attr(this.entity_id, ''last_triggered'')) > 60 }}' - condition: state entity_id: binary_sensor.local_network_availability state: 'on' - condition: template value_template: "{{ trigger.event.data.new_state.state = trigger.event.data.old_state.state\ \ \n and trigger.event.data.new_state.state in not_has_state\n}}" actions: - choose: - conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' sequence: - delay: seconds: 30 - action: homeassistant.reload_config_entry data: entry_id: '{{ config_entry_id(''sensor.speedtest_ping'') }}' - alias: system_event_instances_starting_stoping_set id: system_event_instances_starting_stoping_set initial_state: true triggers: - trigger: homeassistant event: start id: homeassistant_start - trigger: homeassistant event: shutdown actions: - parallel: - action: "{% if trigger.id == 'homeassistant_start' -%}\n input_boolean.turn_off\n\ {% else -%}\n input_boolean.turn_on\n{% endif %}\n" target: entity_id: input_boolean.instances_stoping - action: "{% if trigger.id == 'homeassistant_start' -%}\n automation.turn_on\n\ {% else -%}\n automation.turn_off\n{% endif %}\n" target: entity_id: automation.notifications_objects_in_unavailable_status - alias: counter increment link down keenetic id: counter increment link down keenetic initial_state: true mode: single max_exceeded: silent trigger_variables: not_has_state: '{{ [''unknown'', ''unavailable'', ''none'', None, null, '''', ''null''] }}' triggers: - trigger: state entity_id: sensor.check_keenetic_link_down conditions: - condition: template value_template: "{{ \n trigger.to_state.state not in not_has_state and trigger.from_state.state\ \ = '' and\n trigger.to_state.state = trigger.from_state.state\n}}\n" actions: - action: counter.increment target: entity_id: counter.counter_keenetic_link_down - alias: system log home assistant warning and error counter id: system log home assistant warning and error counter initial_state: true mode: queued max: 100 max_exceeded: silent trigger_variables: this_name: '{{ this.attributes.friendly_name | string }}' triggers: - trigger: event event_type: system_log_event event_data: level: ERROR - trigger: event event_type: system_log_event event_data: level: WARNING conditions: - condition: template value_template: '{{ not this_name in (trigger.event.data.message | string) }}' actions: - action: counter.increment target: entity_id: '{{ ''counter.system_log_'' + trigger.event.data.level | lower + ''_counter'' }}' - alias: system log clear warning and error reset counter id: system log clear warning and error reset counter initial_state: true mode: queued max_exceeded: silent triggers: - trigger: event event_type: call_service event_data: domain: system_log service: clear actions: - action: counter.reset target: entity_id: - counter.system_log_error_counter - counter.system_log_warning_counter - alias: restart e3372h 320 modem unavailable id: restart e3372h 320 modem unavailable initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: sensor.huawei_e3372h_320_sinr to: null - trigger: homeassistant event: start conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - '{{ not has_value(''sensor.huawei_e3372h_320_sinr'') }}' actions: - wait_template: '{{ has_value(''sensor.huawei_e3372h_320_sinr'') or is_state(''input_boolean.instances_stoping'', ''on'') }}' timeout: 00:05:00 - choose: - conditions: '{{ not wait.completed and is_state(''binary_sensor.local_network_availability'', ''on'') }}' sequence: - action: button.press target: entity_id: button.e3372h_320_restart - alias: update input text telegram bot api token id: update input text telegram bot api token initial_state: true mode: queued max_exceeded: silent triggers: - trigger: event event_type: event_telegram_reloaded actions: - action: input_text.set_value target: entity_id: input_text.var_telegram_bot_api_token data: value: secret telegram_api - alias: cert_expiry_timestamp_asuscomm_unavailable id: cert_expiry_timestamp_asuscomm_unavailable mode: single max_exceeded: silent triggers: - trigger: state entity_id: sensor.cert_expiry_timestamp_asuscomm to: null - trigger: homeassistant event: start conditions: - condition: state entity_id: input_boolean.instances_stoping state: 'off' - '{{ as_timestamp(now()) - as_timestamp(state_attr(this.entity_id, ''last_triggered'')) > 60 }}' - '{{ not has_value(''sensor.cert_expiry_timestamp_asuscomm'') }}' actions: - wait_template: '{{ has_value(''sensor.cert_expiry_timestamp_asuscomm'') or is_state(''input_boolean.instances_stoping'', ''on'') }}' timeout: 00:01:00 - choose: - conditions: '{{ not wait.completed and is_state(''binary_sensor.local_network_availability'', ''on'') }}' sequence: - action: homeassistant.reload_config_entry data: entry_id: '{{ config_entry_id(''sensor.cert_expiry_timestamp_asuscomm'') }}' - alias: repairs issue registry sensor update id: repairs issue registry sensor update mode: restart triggers: - trigger: event event_type: repairs_issue_registry_updated event_data: action: create - trigger: homeassistant event: start actions: - action: homeassistant.update_entity data: entity_id: sensor.repairs_state - alias: entity_update_every_2_minutes id: entity_update_every_2_minutes max_exceeded: silent triggers: - trigger: time_pattern minutes: /2 - trigger: homeassistant event: start actions: - action: homeassistant.update_entity data: entity_id: - binary_sensor.internet_availability_nic_ping - binary_sensor.internet_availability_yandex_ping - alias: vacuum later start cleaning action id: vacuum later start cleaning action" initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.vacumm_ten_minutes conditions: - condition: state entity_id: vacuum.xiaomi_vacuum_cleaner state: docked actions: - parallel: - action: vacuum.start target: entity_id: vacuum.xiaomi_vacuum_cleaner - action: telegram_bot.send_message data: target: '{{ states(''input_text.var_chat_id_vacuum_later_start'') }}' title: '{{ ''\U0001f680'' }} *Степа*' message: Начал полную уборку - action: input_text.set_value target: entity_id: input_text.var_chat_id_vacuum_later_start data: value: secret telegram_chita_chat_id - alias: vacuum later start cleaning not docked id: vacuum later start cleaning not docked initial_state: true triggers: - trigger: event event_type: timer.finished event_data: entity_id: timer.vacumm_ten_minutes conditions: - condition: not conditions: - condition: state entity_id: vacuum.xiaomi_vacuum_cleaner state: docked actions: - parallel: - action: telegram_bot.send_message data: target: '{{ states(''input_text.var_chat_id_vacuum_later_start'') }}' title: ⚠️ *Степа* message: Не смог начать полную уборку, потому что нахожусь не на базе - action: input_text.set_value target: entity_id: input_text.var_chat_id_vacuum_later_start data: value: secret telegram_chita_chat_id - alias: vacuum start stop camera map when docked cleaning id: vacuum start stop camera map when docked cleaning initial_state: true mode: queued triggers: - trigger: state entity_id: vacuum.xiaomi_vacuum_cleaner - trigger: homeassistant event: start - trigger: event event_type: event_xiaomi_cloud_map_extractor_reloaded conditions: - condition: template value_template: "{{ \n trigger.platform = 'state'\n or trigger.to_state.state\ \ = trigger.from_state.state\n}}\n" actions: - if: - '{{ states(''vacuum.xiaomi_vacuum_cleaner'') in [''docked'', ''unknown'', ''unavailable'', ''none'', None, null, ''''] }}' then: - delay: seconds: 45 - action: homeassistant.update_entity data: entity_id: camera.roborock_vacuum_map - action: camera.turn_off target: entity_id: camera.roborock_vacuum_map else: - action: camera.turn_on target: entity_id: camera.roborock_vacuum_map - alias: zigbee_device_joined_notification id: zigbee_device_joined_notification mode: queued triggers: - trigger: mqtt topic: zigbee2mqtt/bridge/event conditions: condition: template value_template: '{{trigger.payload_json.type == "device_interview" and trigger.payload_json.data.status == "successful" and trigger.payload_json.data.supported}}' actions: - action: telegram_bot.send_message data: title: '{{ ''\U0001f41d'' }} Добавление устройств Zigbee' message: 'Добавлено новое устройство: {{- ''\n'' -}} Имя: {{trigger.payload_json.data.friendly_name | e}}, {{- ''\n'' -}} Поставщик: {{trigger.payload_json.data.definition.vendor | e}}, {{- ''\n'' -}} Модель: {{trigger.payload_json.data.definition.model | e}} {{- ''\n'' -}} Описание: {{trigger.payload_json.data.definition.description | e}}' disable_notification: true parse_mode: html target: secret telegram_enzokot_chat_id - alias: zigbee2mqtt_devices_last_seen id: zigbee2mqtt_devices_last_seen triggers: - trigger: time_pattern hours: /1 conditions: - condition: template value_template: '{%- set time_limit = as_timestamp(now(), 0) - 3*60*60 -%} {%- set list_sensors = expand(''group.dynamic_group_sensor_last_seen'') | selectattr(''state'', ''ne'', None) | selectattr(''state'', ''ne'', ''None'') | selectattr(''state'', ''ne'', ''unknown'') -%} {%- set datanames = namespace(last_seen=[]) -%} {%- for state in list_sensors -%} {%- if state.entity_id.endswith(''_last_seen'') -%} {%- set time_ms = 1000 -%} {%- set state_ms = state.state -%} {%- else -%} {%- set time_ms = 1 -%} {%- set state_ms = as_timestamp(state.state , 0) -%} {%- endif -%} {%- if (state_ms | int(time_limit * time_ms, 0)) < (time_limit * time_ms) or not has_value(state.entity_id) -%} {%- set datanames.last_seen = datanames.last_seen + [state] -%} {%- endif -%} {%- endfor -%} {{ datanames.last_seen | length > 0 }} ' actions: - action: telegram_bot.send_message data: title: '{%- set time_limit = as_timestamp(now(), 0) - 3*60*60 -%} {%- set list_sensors = expand(''group.dynamic_group_sensor_last_seen'') | selectattr(''state'', ''ne'', None) | selectattr(''state'', ''ne'', ''None'') | selectattr(''state'', ''ne'', ''unknown'') -%} {%- set datanames = namespace(last_seen=[]) -%} {%- for state in list_sensors -%} {%- if state.entity_id.endswith(''_last_seen'') -%} {%- set time_ms = 1000 -%} {%- set state_ms = state.state -%} {%- else -%} {%- set time_ms = 1 -%} {%- set state_ms = as_timestamp(state.state, 0) -%} {%- endif -%} {%- if (state_ms | int(time_limit * time_ms)) < (time_limit * time_ms) or not has_value(state.entity_id) -%} {%- set datanames.last_seen = datanames.last_seen + [state] -%} {%- endif -%} {%- endfor -%} {%- set missing_count = datanames.last_seen | length -%} {%- if missing_count > 0 %} ⚠️ {%- else %} {{ ''\U00002705'' }} {%- endif %} *Контроль устройств Zigbee*' disable_notification: true target: secret telegram_enzokot_chat_id message: "{%- set time_limit = as_timestamp(now(), 0) - 3*60*60 -%} {%- set\ \ list_sensors = expand('group.dynamic_group_sensor_last_seen') | selectattr('state',\ \ 'ne', None) | selectattr('state', 'ne', 'None') | selectattr('state', 'ne',\ \ 'unknown') -%} {%- set datanames = namespace(device_name=[]) -%} {%- for\ \ state in list_sensors -%} {%- if state.entity_id.endswith('_last_seen')\ \ -%} {%- set time_ms = 1000 -%} {%- set state_ms = state.state -%} {%- else\ \ -%} {%- set time_ms = 1 -%} {%- set state_ms = as_timestamp(state.state,\ \ 0) -%} {%- endif -%} {%- if (state_ms | int(time_limit * time_ms)) < (time_limit\ \ * time_ms) or not has_value(state.entity_id) -%} {% if device_attr(state.entity_id,\ \ 'name_by_user') = none %}\n {%- set datanames.device_name = datanames.device_name\ \ + [device_attr(state.entity_id, 'name_by_user')] -%}\n{% else %}\n {%-\ \ set datanames.device_name = datanames.device_name + [device_attr(state.entity_id,\ \ 'name')] -%}\n{% endif %} {%- endif -%} {%- endfor -%}\n{%- set missing\ \ = datanames.device_name | list -%} {% set missing_count = missing | count\ \ %}\n{% if missing_count > 0 %}Более 3 часов не было данных от: {{ missing\ \ | join(', ') }} {% else %}Все устройства доступны.{% endif %}\n" - alias: zigbee2mqtt_devices_link_check id: zigbee2mqtt_devices_link_check triggers: - trigger: time_pattern hours: /1 conditions: - condition: template value_template: "{%- set list_sensors = expand('group.dynamic_group_sensor_linkquality')\ \ | selectattr('state', 'ne', None) | selectattr('state', 'ne', 'None') -%}\ \ {%- set datanames = namespace(low_linkquality=[]) -%} {%- for state in list_sensors\ \ -%} {%- if (state.entity_id.endswith('_linkquality') and (state.state | int(15))\ \ < 15) or \n (state.entity_id.endswith('_zigbee') and (state_attr(state.entity_id\ \ ,'linkquality') | int(15)) < 15)-%}\n{%- set datanames.low_linkquality = datanames.low_linkquality\ \ + [state] -%} {%- endif -%} {%- endfor -%} {{ datanames.low_linkquality |\ \ length > 0 }}\n" actions: - action: script.zigbee2mqtt_linkuality_check - alias: auto_local_temperature_calibration_thermostats id: auto_local_temperature_calibration_thermostats triggers: - trigger: time_pattern minutes: /3 actions: - parallel: - action: script.auto_local_temperature_calibration_thermostats data: namevalve: Bedroom valve with thermostat objectvalve: climate.0x60a423fffe968719 objectvalvewindow: switch.0x60a423fffe968719_window_detection objectsensortemperature: sensor.esp_xiaomi_bed_room_temperature - action: script.auto_local_temperature_calibration_thermostats data: namevalve: Living room valve with thermostat objectvalve: climate.0x5c0272fffec9db22 objectvalvewindow: switch.0x5c0272fffec9db22_window_detection objectsensortemperature: sensor.esp_xiaomi_living_room_temperature - action: script.auto_local_temperature_calibration_thermostats data: namevalve: Childrens room valve with thermostat objectvalve: climate.0x5c0272fffec89454 objectvalvewindow: switch.0x5c0272fffec89454_window_detection objectsensortemperature: sensor.esp_xiaomi_childrens_room_temperature - action: script.auto_local_temperature_calibration_thermostats data: namevalve: Kitchen valve with thermostat objectvalve: climate.0x5c0272fffe8de819 objectvalvewindow: switch.0x5c0272fffe8de819_window_detection objectsensortemperature: sensor.esp_xiaomi_kitchen_temperature - alias: auto_boost_mode_thermostats_at_sleeping_time id: auto_boost_mode_thermostats_at_sleeping_time triggers: - trigger: time at: - 02:30:00 - 05:30:00 actions: - parallel: - choose: - conditions: - condition: state entity_id: input_boolean.thermostat_bedroom_night_mode state: 'on' sequence: - action: climate.set_preset_mode target: entity_id: climate.0x60a423fffe968719 data: preset_mode: boost - choose: - conditions: - condition: state entity_id: input_boolean.thermostat_childrensroom_night_mode state: 'on' sequence: - action: climate.set_preset_mode target: entity_id: climate.0x5c0272fffec89454 data: preset_mode: boost - alias: switching_thermostat_night_mode id: switching_thermostat_night_mode initial_state: 'true' triggers: - trigger: state entity_id: - input_boolean.thermostat_bedroom_night_mode - input_boolean.thermostat_childrensroom_night_mode - automation.auto_boost_mode_thermostats_at_sleeping_time conditions: - condition: template value_template: "{{ \n (is_state('input_boolean.thermostat_bedroom_night_mode',\ \ 'off') and is_state('input_boolean.thermostat_childrensroom_night_mode', 'off')\ \ \n and is_state('automation.auto_boost_mode_thermostats_at_sleeping_time',\ \ 'on'))\n or\n ((is_state('input_boolean.thermostat_bedroom_night_mode',\ \ 'on') or is_state('input_boolean.thermostat_childrensroom_night_mode', 'on'))\ \ \n and is_state('automation.auto_boost_mode_thermostats_at_sleeping_time',\ \ 'off'))\n}}\n" actions: - choose: - conditions: - condition: template value_template: '{{ trigger.platform == ''state'' and trigger.to_state.domain == ''input_boolean'' }}' sequence: - action: "{% if is_state('input_boolean.thermostat_bedroom_night_mode', 'off')\ \ and is_state('input_boolean.thermostat_childrensroom_night_mode', 'off')\ \ %}\n automation.turn_off\n{% else %}\n automation.turn_on\n{% endif\ \ %}\n" target: entity_id: automation.auto_boost_mode_thermostats_at_sleeping_time - conditions: - condition: template value_template: '{{ trigger.platform == ''state'' and trigger.to_state.domain == ''automation'' }}' sequence: - action: "{% if is_state('automation.auto_boost_mode_thermostats_at_sleeping_time',\ \ 'off') %}\n input_boolean.turn_off\n{% else %}\n input_boolean.turn_on\n\ {% endif %}\n" target: entity_id: - input_boolean.thermostat_bedroom_night_mode - input_boolean.thermostat_childrensroom_night_mode - alias: auto_scrolling_thermostats_at_month id: auto_scrolling_thermostats_at_month triggers: - trigger: time at: '10:00:00' conditions: - '{{ now().timestamp() | timestamp_custom(''%d'') | int(0) in [1, 15] }}' - condition: state entity_id: - climate.0x5c0272fffec89454 - climate.0x60a423fffe968719 - climate.0x5c0272fffec9db22 - climate.0x5c0272fffe8de819 state: heat actions: - action: climate.set_hvac_mode target: entity_id: - climate.0x5c0272fffec89454 - climate.0x60a423fffe968719 - climate.0x5c0272fffec9db22 - climate.0x5c0272fffe8de819 data: hvac_mode: 'off' - delay: 00:02:00 - action: climate.set_hvac_mode target: entity_id: - climate.0x5c0272fffec89454 - climate.0x60a423fffe968719 - climate.0x5c0272fffec9db22 - climate.0x5c0272fffe8de819 data: hvac_mode: heat - delay: 00:01:00 - action: telegram_bot.send_message data: target: secret telegram_enzokot_chat_id disable_notification: true title: '{{ ''🔧'' }} *Обслуживание устройств*' message: Выполнено обслуживание TRV, необходимо проверить состояние и физическое положение штоков. - alias: set_options_for_selected_router_for_permit_join_z2m id: set_options_for_selected_router_for_permit_join_z2m mode: queued triggers: - trigger: state entity_id: sensor.router_devices_z2m not_from: null - trigger: homeassistant event: start - trigger: event event_type: automation_reloaded - trigger: event id: input_select_reload event_type: call_service event_data: domain: input_select service: reload actions: - if: - condition: trigger id: input_select_reload then: - wait_for_trigger: - trigger: state entity_id: input_select.selected_router_for_permit_join_z2m to: null timeout: seconds: 2 - variables: new_options: "{% set select_options = iif(states('sensor.router_devices_z2m')\ \ | int(0) > 0, state_attr('sensor.router_devices_z2m', 'routers'), ['Не выбрано'])\ \ %} {% set data = namespace(entities=[]) %} {% for i in select_options -%}\n\ \ {% if loop.first %}\n {% set data.entities = data.entities + ['Не\ \ выбрано'] %}\n {% endif %}\n {% set data.entities = data.entities\ \ + [i] %}\n{% endfor %} {{ data.entities | unique | list }}\n" old_options_with_new: "{% set data = namespace(entities=[]) %} {% for i in new_options\ \ -%}\n {% set data.entities = data.entities + [i] %}\n {% if loop.last\ \ %}\n {% set data.entities = data.entities + [states('input_select.selected_router_for_permit_join_z2m')]\ \ %}\n {% endif %}\n{% endfor %} {{ data.entities | unique | list }}\n" - action: input_select.set_options target: entity_id: input_select.selected_router_for_permit_join_z2m data: options: '{{ old_options_with_new }}' - action: input_select.select_option target: entity_id: input_select.selected_router_for_permit_join_z2m data: option: '{{ new_options | first }}' - action: input_select.set_options target: entity_id: input_select.selected_router_for_permit_join_z2m data: options: '{{ new_options }}' - action: input_select.select_first target: entity_id: input_select.selected_router_for_permit_join_z2m - alias: start_selected_router_permit_join_z2m id: start_selected_router_permit_join_z2m mode: restart triggers: - trigger: event event_type: call_service event_data: domain: input_select service: select_option service_data: entity_id: input_select.selected_router_for_permit_join_z2m conditions: - '{{ states.person | selectattr(''attributes.user_id'', ''eq'', trigger.event.context.user_id) | list | count > 0 }}' actions: - action: mqtt.publish data: topic: zigbee2mqtt/bridge/request/permit_join payload: '{{ ''{'' ~ iif(trigger.event.data.service_data.option == ''Не выбрано'', ''"time":0'', ''"time":254, "device":"'' ~ trigger.event.data.service_data.option) ~ ''"}'' }} ' - alias: set_option_for_selected_router_from_info_topic_z2m id: set_option_for_selected_router_from_info_topic_z2m mode: restart triggers: - trigger: state entity_id: switch.permit_join_switch_z2m id: switch_permit_join to: 'off' - trigger: state entity_id: sensor.zigbee2mqtt_add_on_permit_join_current_device_z2m id: sensor_current_device actions: - variables: permit_join_current_device: '{{ states(''sensor.zigbee2mqtt_add_on_permit_join_current_device_z2m'') if is_state(''switch.permit_join_switch_z2m'', ''on'') and has_value(''sensor.zigbee2mqtt_add_on_permit_join_current_device_z2m'') else ''Не выбрано'' }}' - parallel: - if: - condition: trigger id: switch_permit_join - '{{ not is_state(''input_select.select_option'', ''Не выбрано'') }}' then: - action: input_select.select_option target: entity_id: input_select.selected_router_for_permit_join_z2m data: option: Не выбрано - if: - condition: trigger id: sensor_current_device - '{{ not is_state(''input_select.selected_router_for_permit_join_z2m'', permit_join_current_device) }}' then: - action: input_select.select_option target: entity_id: input_select.selected_router_for_permit_join_z2m data: option: '{{ permit_join_current_device }}' - alias: start_timer_permit_join_timeout_z2m id: start_timer_permit_join_timeout_z2m initial_state: true mode: restart triggers: - trigger: state entity_id: sensor.zigbee2mqtt_add_on_permit_join_end_z2m - trigger: homeassistant event: start - trigger: event event_type: automation_reloaded actions: - variables: time_remaining: '{{ ((states(''sensor.zigbee2mqtt_add_on_permit_join_end_z2m'') | int(0)) / 1000 - (as_timestamp(utcnow(), 0) | int(0))) | int(0) }}' - if: - '{{ time_remaining > 0 }}' then: - action: timer.start target: entity_id: timer.permit_join_timeout_z2m data: duration: '{{ time_remaining }}' else: - action: timer.cancel target: entity_id: timer.permit_join_timeout_z2m