- id: a4fe52e0-99f0-449d-9bc7-50378d9d6df8 alias: night_ambiance initial_state: true mode: restart triggers: - trigger: numeric_state entity_id: sun.sun attribute: elevation below: -3.0 - trigger: state entity_id: group.household to: home conditions: - condition: time before: input_datetime.evening_ambiance_end - condition: numeric_state entity_id: sun.sun attribute: elevation below: -3.0 - condition: state entity_id: group.household state: home actions: - parallel: - action: script.evening_ambiance - action: light.turn_on target: entity_id: - light.backyard_string - light.front_porch - light.side_porch_sconce - light.shed_outdoor - id: 2c48ecbc-7b65-4938-af37-dcda12952465 alias: arrival_lights initial_state: true mode: restart triggers: - trigger: state entity_id: - person.chris - person.karine - group.guests to: home conditions: - condition: numeric_state entity_id: sun.sun attribute: elevation below: -3.0 actions: - action: light.turn_on target: entity_id: - light.front_porch - light.side_porch_sconce - id: a109af89-0910-45b2-9a0e-11d3ae43ec7c alias: turn_off_outdoor initial_state: true mode: restart triggers: - trigger: state entity_id: light.outdoor_lights to: 'on' for: 300 - trigger: time at: input_datetime.evening_ambiance_end - trigger: state entity_id: binary_sensor.guest_mode to: 'off' conditions: - condition: state entity_id: binary_sensor.guest_mode state: 'off' - condition: state entity_id: light.outdoor_lights state: 'on' for: 300 - condition: time after: input_datetime.evening_ambiance_end before: '15:00:00' actions: - action: light.turn_off target: entity_id: light.outdoor_lights - id: 36afcfe6-d475-447c-b089-d33aec62a774 alias: broadcast_notifications initial_state: true mode: queued max: 25 triggers: - trigger: homeassistant event: start - trigger: state entity_id: todo.audio_broadcast - trigger: state entity_id: group.household to: home for: 120 - trigger: time at: - input_datetime.broadcast_weekday_start - input_datetime.broadcast_weekend_start conditions: - condition: numeric_state entity_id: todo.audio_broadcast above: 0 - condition: state entity_id: group.household state: home for: 120 - or: - condition: time after: input_datetime.broadcast_weekday_start before: input_datetime.broadcast_weekday_end weekday: - mon - tue - wed - thu - condition: time after: input_datetime.broadcast_weekday_start before: input_datetime.broadcast_weekend_end weekday: - fri - condition: time after: input_datetime.broadcast_weekend_start before: input_datetime.broadcast_weekend_end weekday: - sat - condition: time after: input_datetime.broadcast_weekend_start before: input_datetime.broadcast_weekday_end weekday: - sun actions: - action: todo.get_items response_variable: broadcast_items target: entity_id: todo.audio_broadcast data: status: - needs_action - variables: broadcast_item: '{{ broadcast_items[''todo.audio_broadcast''][''items''][0] }}' - action: script.broadcast_notification data: message: '{{ broadcast_item[''description''] | default(broadcast_item[''summary''], true) }}' - wait_template: '{{ is_state(''script.broadcast_notification'', ''off'') }}' - action: script.manage_broadcast_queue data: action: pop tag: '{{ broadcast_item[''summary''] }}' - id: e50d2e13-9c88-4b02-89af-e863a7d763d5 alias: chris_remote_restore_initial_option description: Restore entity selected by Chris' remote after some time use_blueprint: path: reset_input_select.yaml input: default_option: light.bedside_chris delay: 300 entity_id: input_select.chris_remote_entity - id: ff872bdf-a0af-4e30-9aa3-449d7ff4367b alias: chris_remote_apply_color_change description: Turn on and change the color on Chris' remote entity initial_state: true max_exceeded: silent mode: queued triggers: - trigger: state entity_id: input_select.chris_remote_color actions: - action: light.turn_on target: entity_id: '{{ states(''input_select.chris_remote_entity'') }}' data: rgb_color: '{{ trigger.to_state.state }}' - id: abf7b09f-0e7b-4b0c-b6ef-85631f25c63e alias: chris_remote description: Map Chris' remote buttons to useful actions use_blueprint: path: zha/bedside_remote.yaml input: color_input_select: input_select.chris_remote_color device_ieee: 00:0d:6f:ff:fe:61:69:25 entity_input_select: input_select.chris_remote_entity - id: 1ff64444-5414-49d5-b314-b0a3a82075c5 alias: update_backend_theme initial_state: true mode: queued triggers: - trigger: state entity_id: - input_select.default_theme - binary_sensor.use_alarm_theme - binary_sensor.winter_credit_peak_event to: null actions: - action: frontend.set_theme data: name: "{%\n set mode = 'dark'\n if is_state('binary_sensor.use_dark_theme',\ \ 'on')\n else 'light'\n-%} {% if is_state('binary_sensor.use_alarm_theme',\ \ 'on') -%}\n ios-{{ mode }}-mode-red\n{%- elif is_state('binary_sensor.winter_credit_peak_event',\ \ 'on') -%}\n ios-{{ mode }}-mode-light-blue\n{%- else -%}\n {{ states('input_select.default_theme')\ \ | default('default', True) -}}\n{% endif %}" - id: a87a26c7-b1d4-4080-842b-4ee8a6e5b6f5 alias: update_default_theme initial_state: true mode: restart triggers: - trigger: state entity_id: - binary_sensor.use_dark_theme - input_boolean.automatic_night_theme - input_select.day_theme - input_select.night_theme to: null - trigger: homeassistant event: start conditions: - condition: state entity_id: input_boolean.automatic_night_theme state: 'on' actions: - action: input_select.select_option target: entity_id: input_select.default_theme data: option: "{{\n states(\n 'input_select.'\n ~ ('night' if is_state('binary_sensor.use_dark_theme',\ \ 'on') else 'day' )\n ~ '_theme'\n ) | default('default')\n}}" - id: 54655af9-ddc7-491d-9200-41aaaddbb21a alias: empty_house initial_state: true triggers: - trigger: state entity_id: group.household from: home for: 30 conditions: - condition: state entity_id: binary_sensor.guest_mode state: 'off' actions: - action: script.everything_off - action: lock.lock target: entity_id: lock.kitchen_door - id: 77087f1e-f617-4fa6-8520-22793f3c1bfb alias: Use internal heat pump temperature probe description: Switch to the internal heat pump temperature probe mode: restart triggers: - trigger: state entity_id: input_boolean.use_heat_pump_virtual_probe to: 'off' actions: - action: esphome.ground_floor_heat_pump_use_internal_temperature - id: 4c8cf214-db8a-4d0e-b039-f502dc5e21ed alias: Sync virtual heat pump temperature probe description: Keep the heat pump's external temperature prope in sync with thermostat readings mode: restart triggers: - trigger: homeassistant event: start - trigger: state entity_id: input_boolean.use_heat_pump_virtual_probe to: 'on' - trigger: state entity_id: sensor.heat_pump_virtual_probe for: 5 not_to: unavailable conditions: - condition: state entity_id: input_boolean.use_heat_pump_virtual_probe state: 'on' - not: - condition: state entity_id: sensor.heat_pump_virtual_probe state: unavailable actions: - action: esphome.ground_floor_heat_pump_set_remote_temperature data: temperature: '{{ states(''sensor.heat_pump_virtual_probe'') | round(precision = 0) }}' - id: 6ea34d47-1181-4c94-9ab6-43fe4c0b42cc alias: notify_update_available initial_state: true mode: parallel triggers: - trigger: state entity_id: sensor.latest_home_assistant_version not_to: - unknown - unavailable conditions: '{{ trigger.to_state.state | version > states(''sensor.current_home_assistant_version'') }}' actions: - action: python_script.notify data: persistent: true push_target: admin tag: hass_version url: https://github.com/home-assistant/home-assistant/releases/tag/{{ trigger.to_state.state }} title: Home Assistant Update message: Home Assistant {{ trigger.to_state.state }} is available. - id: 0c595e90-4186-4152-b80e-41a491749dde alias: notify_failed_login_attempt initial_state: true mode: parallel triggers: - trigger: event event_type: call_service event_data: domain: persistent_notification action: create service_data: notification_id: http-login actions: - action: python_script.notify data: push_target: admin title: '{{ trigger.event.data.service_data.title }}' message: '{{ trigger.event.data.service_data.message }}' - id: 673d5462-19e1-4a63-ad41-75c0690dcaa2 alias: Notify HA status. triggers: - trigger: homeassistant event: start variables: action: started - trigger: homeassistant event: shutdown variables: action: shut down actions: - action: notify.admin data: message: Home-Assistant has {{ action }}. data: tag: homeassistant-status - alias: Reload jinja2 templates id: c7929657-8241-478e-9a89-d2562c720120 mode: single max_exceeded: silent triggers: - trigger: state entity_id: event.jinja2_custom_templates_updated actions: - action: homeassistant.reload_custom_templates - alias: presence_alarm_armed id: 2c7d9807-9f19-4b55-b944-17005a27e6c0 description: Initialize home alarm states when arming is enabled. initial_state: true triggers: - trigger: state entity_id: binary_sensor.presence_armed from: 'off' to: 'on' actions: - action: notify.send_message target: entity_id: notify.intrusion_log data: message: Intrusion alarm armed. - action: script.initialize_alarm_states - alias: log_intrusion_clear id: 249f90de-0afe-4735-9b17-a59f035ec4f3 description: Log intrusion cleared events. initial_state: true mode: single max_exceeded: silent triggers: - trigger: state entity_id: binary_sensor.intrusion_activity from: 'on' to: 'off' actions: - action: notify.send_message target: entity_id: notify.intrusion_log data: message: ({{ states('input_text.presence_armed_id') }}) Intrusion cleared. - alias: log_presence_alarm_disarmed id: 64ef04c6-d94c-4d70-a116-d50ab1b295a5 description: Log disarming of presence alarm. initial_state: true triggers: - trigger: state entity_id: binary_sensor.presence_armed from: 'on' to: 'off' actions: - action: notify.send_message target: entity_id: notify.intrusion_log data: message: ({{ states('input_text.presence_armed_id') }}) Presence alarm disarmed. - alias: record_activity_while_armed id: 1bbacc2c-2ce3-428a-bfdd-6d9480be23b8 description: Record activity in the house while system is armed. initial_state: true mode: queued triggers: - trigger: state entity_id: - sensor.current_door - sensor.current_motion - sensor.current_window variables: entity_id: '{{ trigger.to_state.state }}' - trigger: state entity_id: - event.hallway_spots_dimmer_on_pressed - event.hallway_spots_dimmer_off_pressed - event.kitchen_track_light_dimmer_off_pressed - event.kitchen_track_light_dimmer_on_pressed - event.backyard_soffit_spots_dimmer_off_pressed - event.backyard_soffit_spots_dimmer_on_pressed - event.dining_room_light_dimmer_off_pressed - event.dining_room_light_dimmer_on_pressed - event.side_porch_sconce_dimmer_off_pressed - event.side_porch_sconce_dimmer_on_pressed - event.master_bedroom_sconces_dimmer_off_pressed - event.master_bedroom_sconces_dimmer_on_pressed - event.master_bedroom_spots_dimmer_off_pressed - event.master_bedroom_spots_dimmer_on_pressed - event.kitchen_sink_light_switch_off_pressed - event.kitchen_sink_light_switch_on_pressed - event.front_porch_light_switch_off_pressed - event.front_porch_light_switch_on_pressed - event.shed_outdoor_light_switch_on_pressed - event.shed_outdoor_light_switch_off_pressed - event.shed_light_switch_off_pressed - event.shed_light_switch_on_pressed - event.master_bedroom_closet_light_switch_off_pressed - event.master_bedroom_closet_light_switch_on_pressed - event.basement_bathroom_fan_switch_on_pressed - event.basement_bathroom_fan_switch_off_pressed - event.basement_bathroom_light_switch_on_pressed - event.basement_bathroom_light_switch_off_pressed - event.basement_bathroom_vanity_dimmer_on_pressed - event.basement_bathroom_vanity_dimmer_off_pressed - event.basement_hallway_dimmer_on_pressed - event.basement_hallway_dimmer_off_pressed - event.downstairs_light_switch_on_pressed - event.downstairs_light_switch_off_pressed - event.guest_bedroom_closet_light_switch_on_pressed - event.guest_bedroom_closet_light_switch_off_pressed - event.guest_bedroom_spots_dimmer_off_pressed - event.guest_bedroom_spots_dimmer_on_pressed - event.laundry_dimmer_off_pressed - event.laundry_dimmer_on_pressed - event.bookshelf_light_switch_on_pressed - event.bookshelf_light_switch_off_pressed - event.foyer_light_switch_on_pressed - event.foyer_light_switch_off_pressed - event.living_room_dimmer_off_pressed - event.living_room_dimmer_on_pressed - event.staircase_dimmer_on_pressed - event.staircase_dimmer_off_pressed - event.lounge_dimmer_off_pressed - event.lounge_dimmer_on_pressed - event.main_bathroom_dimmer_on_pressed - event.main_bathroom_dimmer_off_pressed - event.main_bathroom_fan_switch_on_pressed - event.main_bathroom_fan_switch_off_pressed - event.main_bathroom_vanity_light_switch_on_pressed - event.main_bathroom_vanity_light_switch_off_pressed - event.office_spots_dimmer_off_pressed - event.office_spots_dimmer_on_pressed - event.studio_panel_light_switch_off_pressed - event.studio_panel_light_switch_on_pressed - event.studio_spots_dimmer_off_pressed - event.studio_spots_dimmer_on_pressed - event.workshop_light_switch_on_pressed - event.workshop_light_switch_off_pressed variables: entity_id: '{{ trigger.entity_id }}' conditions: - condition: state entity_id: binary_sensor.presence_armed state: 'on' - condition: template value_template: '{{ entity_id != '''' }}' actions: - action: notify.send_message target: entity_id: notify.intrusion_log data: message: '({{ states(''input_text.presence_armed_id'') }}) Intrusion activity: {{ entity_id | device_name }} ({{ entity_id }})' - action: todo.add_item target: entity_id: todo.intrusion_record data: item: '{{ entity_id }}' - alias: start_intrusion_alarm id: 6943625e-997b-4650-b608-acb10bf3ca57 description: Trigger alarm notifications when an intrusion is detected. use_blueprint: path: alarm/start_alarm.yaml input: name: Intrusion group: binary_sensor.intrusion_activity tag: '{{ states(''input_text.presence_armed_id'') }}' actions: - action: silence_{{ states('input_text.presence_armed_id') }} title: Silence - action: reset_{{ states('input_text.presence_armed_id') }} title: Reset silenced: - condition: state entity_id: input_boolean.silence_intrusion_alarm state: 'off' - alias: clear_intrusion_alarm id: 8e77137f-af56-48bd-b82c-7e5bb0ab4ff8 description: Clear alarm notifications when an intrusion is no longer active. use_blueprint: path: alarm/clear_alarm.yaml input: name: Intrusion group: binary_sensor.intrusion_activity tag: '{{ states(''input_text.presence_armed_id'') }}' - alias: silence_intrusion_alarm id: 65383759-a03c-4c81-9965-7154e83626fd description: Silence the home alarm audio when requested. initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action variables: arming_id: '{{ states(''input_text.presence_armed_id'') }}' conditions: - condition: state entity_id: binary_sensor.intrusion_activity state: 'on' - '{{ trigger.event.data.action == ''silence_'' ~ arming_id }}' actions: - action: input_boolean.turn_on target: entity_id: input_boolean.silence_intrusion_alarm - action: notify.send_message target: entity_id: notify.intrusion_log data: message: ({{ arming_id }}) Intrusion alarm silenced. - alias: reset_intrusion_alarm id: f1d67201-6a81-4214-a528-8a5afff919c0 description: Reinitialize the home alarm when requested. initial_state: true mode: single max_exceeded: silent triggers: - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action variables: arming_id: '{{ states(''input_text.presence_armed_id'') }}' conditions: - condition: state entity_id: binary_sensor.intrusion_activity state: 'on' - '{{ trigger.event.data.action == ''reset_'' ~ arming_id }}' actions: - action: notify.send_message target: entity_id: notify.intrusion_log data: message: ({{ arming_id }}) Intrusion alarm cleared manually. - action: script.initialize_alarm_states - id: 686ea290-b4ee-4220-ad02-e233771483b7 alias: karine_remote_restore_initial_option description: Restore entity selected by Karine's remote after some time use_blueprint: path: reset_input_select.yaml input: default_option: light.bedside_karine delay: 300 entity_id: input_select.karine_remote_entity - id: 3ff136d3-b8cb-4016-bf56-c9b0a4b65e09 alias: karine_remote_apply_color_change description: Turn on and change the color on Karine's remote entity mode: queued triggers: - trigger: state entity_id: input_select.karine_remote_color actions: - action: light.turn_on target: entity_id: '{{ states(''input_select.karine_remote_entity'') }}' data: rgb_color: '{{ trigger.to_state.state }}' - id: b214c9a3-937d-4391-9915-98185b7cb152 alias: karine_remote description: Map Karine's remote buttons to useful actions use_blueprint: path: zha/bedside_remote.yaml input: color_input_select: input_select.karine_remote_color device_ieee: 14:b4:57:ff:fe:7c:23:0e entity_input_select: input_select.karine_remote_entity - id: automation.notify_jammed_lock alias: notify_jammed_lock initial_state: true mode: parallel triggers: - trigger: state entity_id: binary_sensor.kitchen_door_lock_jammed to: - 'on' - 'off' variables: is_jammed: '{{ trigger.to_state.state }}' actions: - if: '{{ is_jammed == ''on'' }}' then: - action: python_script.notify data: tag: kitchen_lock_jammed audio: true persistent: true push_target: household priority: true title: The kitchen door lock is jammed. else: - action: python_script.notify data: tag: kitchen_lock_jammed audio: true persistent: true push_target: household priority: true dismiss: true - id: f614d09a-6589-4e21-9f86-205edea10917 alias: master_bed_occupied triggers: - trigger: state entity_id: - binary_sensor.master_bed_occupied_chris - binary_sensor.master_bed_occupied_karine to: 'on' action: if: - condition: state entity_id: binary_sensor.master_bed_occupied_both state: 'off' - condition: state entity_id: - person.karine - person.chris state: home then: - action: script.bedtime else: - action: lock.lock target: entity_id: lock.kitchen_door - action: script.everything_off - id: 650fdbf6-2f22-4bd0-b430-c8a1c29d3217 alias: master_bedroom_spots_dimmer_scenes use_blueprint: path: zwave/paddle_scenes.yaml input: on_entity_id: event.master_bedroom_spots_dimmer_on_pressed off_entity_id: event.master_bedroom_spots_dimmer_off_pressed tap_on_2x: - action: light.turn_on target: entity_id: light.bedside_chris tap_off_2x: - action: light.turn_off target: entity_id: light.bedside_chris tap_on_3x: - action: light.turn_on target: entity_id: light.master_bedroom_lights tap_off_3x: - action: light.turn_off target: entity_id: light.master_bedroom_lights - id: 7d71c23b-929c-4553-a150-2f990fc7ff87 alias: master_bedroom_sconces_dimmer_scenes use_blueprint: path: zwave/paddle_scenes.yaml input: on_entity_id: event.master_bedroom_sconces_dimmer_on_pressed off_entity_id: event.master_bedroom_sconces_dimmer_off_pressed tap_on_2x: - action: light.turn_on target: entity_id: light.bedside_karine tap_off_2x: - action: light.turn_off target: entity_id: light.bedside_karine tap_on_3x: - action: light.turn_on target: entity_id: light.master_bedroom_lights tap_off_3x: - action: light.turn_off target: entity_id: light.master_bedroom_lights - id: 0a607c5b-9dc1-4e86-b46c-f5dd6ebcc542 alias: master_bedroom_closet_dimmer_scenes use_blueprint: path: zwave/paddle_scenes.yaml input: on_entity_id: event.master_bedroom_closet_light_switch_on_pressed off_entity_id: event.master_bedroom_closet_light_switch_off_pressed tap_on_2x: - action: light.turn_on target: entity_id: - light.master_bedroom_sconces - light.master_bedroom_spots tap_off_2x: - action: light.turn_off target: entity_id: light.master_bedroom_lights - alias: select_manual_climate_mode id: a8b031db-937a-4b34-bd64-a30f51900ed0 description: Flag climate entity to manual mode when the managed temperature differs from the actual temperature. initial_state: true mode: parallel max: 9 triggers: - trigger: state entity_id: - climate.heat_pump - climate.basement_hallway_thermostat - climate.dining_room_thermostat - climate.guest_bedroom_thermostat - climate.living_room_thermostat - climate.lounge_thermostat - climate.master_bedroom_thermostat - climate.office_thermostat - climate.studio_thermostat attribute: temperature not_to: unavailable for: 5 variables: name: "{{\n trigger.to_state.object_id\n | replace('_auto_mode', '')\n \ \ | replace('_mode', '')\n | replace('_comfort_setpoint', '')\n | replace('_eco_setpoint',\ \ '')\n}}" auto_mode: '{{ states(''input_select.{}_auto_mode''.format(name)) | default(''Eco'') }}' mode: '{{ states(''input_select.{}_mode''.format(name)) | default(''Auto'') }}' target_setpoint: '{{ states(''input_number.{}_{}_setpoint''.format(name, auto_mode | lower)) | default | float(0) }}' current_setpoint: '{{ trigger.to_state.attributes.temperature | default | float(0) }}' conditions: '{{ trigger.to_state.attributes.preset_mode | default(''none'') != ''none'' or target_setpoint != current_setpoint }}' actions: - action: input_select.select_option target: entity_id: input_select.{{ name }}_mode data: option: Manual - alias: update_climate_setpoint id: 0954c8e4-8429-4777-a8ba-4a1c99853ea2 description: Update climate setpoint initial_state: true mode: queued max: 10 triggers: - trigger: state entity_id: &id001 - input_select.heat_pump_mode - input_select.basement_hallway_thermostat_mode - input_select.dining_room_thermostat_mode - input_select.guest_bedroom_thermostat_mode - input_select.living_room_thermostat_mode - input_select.lounge_thermostat_mode - input_select.master_bedroom_thermostat_mode - input_select.office_thermostat_mode - input_select.studio_thermostat_mode to: Auto - trigger: state entity_id: - input_select.heat_pump_auto_mode - input_select.basement_hallway_thermostat_auto_mode - input_select.dining_room_thermostat_auto_mode - input_select.guest_bedroom_thermostat_auto_mode - input_select.living_room_thermostat_auto_mode - input_select.lounge_thermostat_auto_mode - input_select.master_bedroom_thermostat_auto_mode - input_select.office_thermostat_auto_mode - input_select.studio_thermostat_auto_mode to: null - trigger: state entity_id: - input_number.heat_pump_comfort_setpoint - input_number.basement_hallway_thermostat_comfort_setpoint - input_number.dining_room_thermostat_comfort_setpoint - input_number.guest_bedroom_thermostat_comfort_setpoint - input_number.living_room_thermostat_comfort_setpoint - input_number.lounge_thermostat_comfort_setpoint - input_number.master_bedroom_thermostat_comfort_setpoint - input_number.office_thermostat_comfort_setpoint - input_number.studio_thermostat_comfort_setpoint to: null for: 5 - trigger: state entity_id: - input_number.heat_pump_eco_setpoint - input_number.basement_hallway_thermostat_eco_setpoint - input_number.dining_room_thermostat_eco_setpoint - input_number.guest_bedroom_thermostat_eco_setpoint - input_number.living_room_thermostat_eco_setpoint - input_number.lounge_thermostat_eco_setpoint - input_number.master_bedroom_thermostat_eco_setpoint - input_number.office_thermostat_eco_setpoint - input_number.studio_thermostat_eco_setpoint to: null for: 5 variables: name: "{{\n trigger.to_state.object_id\n | replace('_auto_mode', '')\n \ \ | replace('_mode', '')\n | replace('_comfort_setpoint', '')\n | replace('_eco_setpoint',\ \ '')\n}}" auto_mode: '{{ states(''input_select.{}_auto_mode''.format(name)) | default(''Eco'') }}' mode: '{{ states(''input_select.{}_mode''.format(name)) | default(''Auto'') }}' target_setpoint: '{{ states(''input_number.{}_{}_setpoint''.format(name, auto_mode | lower)) | default | float(0) }}' current_setpoint: '{{ state_attr(''climate.{}''.format(name), ''temperature'') | default | float(0) }}' conditions: '{{ mode == ''Auto'' and target_setpoint != current_setpoint }}' actions: - action: climate.set_temperature target: entity_id: climate.{{ name }} data: temperature: '{{ target_setpoint }}' - alias: start_manual_climate_reset_timer id: 330d72c1-954a-4d1e-a3e1-47412d134dc5 description: Start the timer to reset climate modes to auto (managed) after it has been on manual for some time. mode: parallel max: 15 triggers: - trigger: state entity_id: *id001 not_to: Auto actions: - action: timer.start target: entity_id: timer.{{ trigger.to_state.object_id | replace('_mode', '_manual_mode_reset') }} data: duration: '{{ states(''input_datetime.climate_manual_mode_timer'') }}' - alias: revert_manual_climate_mode id: 5c387ec4-b18b-4ec6-9174-8d844e7e88e9 description: Reset climate mode to auto (managed) when the timer for manual time is elapsed. mode: parallel max: 15 triggers: - trigger: state entity_id: &id002 - timer.heat_pump_manual_mode_reset - timer.basement_hallway_thermostat_manual_mode_reset - timer.dining_room_thermostat_manual_mode_reset - timer.guest_bedroom_thermostat_manual_mode_reset - timer.living_room_thermostat_manual_mode_reset - timer.lounge_thermostat_manual_mode_reset - timer.master_bedroom_thermostat_manual_mode_reset - timer.office_thermostat_manual_mode_reset - timer.studio_thermostat_manual_mode_reset from: active to: idle conditions: - condition: state entity_id: input_boolean.climate_scheduling_enabled state: 'on' actions: - action: input_select.select_option target: entity_id: input_select.{{ trigger.to_state.object_id | replace('_manual_mode_reset', '_mode') }} data: option: Auto - alias: revert_all_expired_manual_climate_mode id: 2e58b9fa-1838-4c38-8b4a-d38b43c76105 description: Reset climate mode to auto (managed) when the timer for manual time is elapsed. mode: single triggers: - trigger: homeassistant event: start - trigger: state entity_id: input_boolean.climate_scheduling_enabled from: 'off' to: 'on' actions: repeat: for_each: *id002 sequence: - if: '{{ is_state(repeat.item, ''idle'') }}' then: - action: input_select.select_option target: entity_id: input_select.{{ states[repeat.item].object_id | replace('_manual_mode_reset', '_mode') }} data: option: Auto - id: 88b9562c-a5bf-4be6-bd7b-d3dfe109a816 alias: Notify low batteries initial_state: true mode: parallel triggers: - trigger: numeric_state entity_id: - sensor.basement_bathroom_multisensor_battery - sensor.basement_smoke_co_detector_battery - sensor.chris_bedside_remote_battery - sensor.drake_battery - sensor.guest_bedroom_window_sensor_battery - sensor.karine_bedside_remote_battery - sensor.kitchen_door_lock_battery - sensor.kitchen_door_sensor_battery - sensor.kitchen_sink_leak_sensor_battery - sensor.living_room_door_sensor_battery - sensor.living_room_remote_battery - sensor.living_room_smoke_co_detector_battery - sensor.laundry_motion_sensor_battery - sensor.lounge_airthings_battery - sensor.lounge_window_sensor_battery - sensor.main_bathroom_multisensor_battery - sensor.maitre_doyle_battery - sensor.snicket_battery - sensor.spidy_battery - sensor.studio_window_sensor_battery - sensor.ups_battery_status - sensor.viny_battery - sensor.water_heater_leak_sensor_battery - sensor.workshop_motion_sensor_battery value_template: "{% if state.state in ['unknown', 'unavailable'] -%}\n 100\n\ {%- else -%}\n {{ state.state | int - state.attributes.battery_warning_level\ \ | default | int(25) - 1 }}\n{%- endif %}" below: 0 actions: - action: python_script.notify data: persistent: true push_target: household tag: battery_low_{{ trigger.to_state.object_id }} url: "{% set battery_type = trigger.to_state.attributes.battery_type %} {% if\ \ battery_type is undefined %}\n \"/lovelace/settings\"\n{% else %}\n https://www.amazon.ca/s/?field-keywords=battery+{{\ \ battery_type | replace(' ', '+') }}\n{% endif %}" title: Replace {{ trigger.to_state.name | lower }} message: "{% set battery_type = trigger.to_state.attributes.battery_type %}\ \ {% if battery_type is defined %}\n Search on Amazon for \"{{ battery_type\ \ }}\" batteries.\n{% endif %}" - id: 994eba31-84de-4769-8958-f24b5346111a alias: notify_plant_problems initial_state: true mode: parallel triggers: - trigger: state attribute: problem entity_id: - plant.drake - plant.spidy - plant.viny variables: name: '{{ trigger.to_state.name }}' tag: plant_{{ trigger.to_state.object_id }} issues: "{{\n (trigger.to_state.attributes.problem | default('') | lower).split(',\ \ ')\n | reject('match', '.*(unavailable|unknown|none)', ignorecase=true)\n\ \ | reject('match', '(brightness|battery).*', ignorecase=true)\n | reject('in',\ \ ['conductivity high'])\n | map('replace', 'moisture low', 'thirsty')\n\ \ | map('replace', 'moisture high', 'drowning')\n | map('replace', 'temperature\ \ low', 'cold')\n | map('replace', 'temperature high', 'hot')\n | map('replace',\ \ 'conductivity low', 'hungry')\n | sort\n}}" actions: - if: '{{ issues | length == 0 }}' then: - action: python_script.notify data: audio: '{{ is_state(''input_boolean.broadcast_plant_problems'', ''on'') }}' persistent: true push_target: household tag: '{{ tag }}' dismiss: true else: - action: python_script.notify data: audio: '{{ is_state(''input_boolean.broadcast_plant_problems'', ''on'') }}' persistent: true push_target: household tag: '{{ tag }}' url: /lovelace/livings title: Check {{ name }} message: "{% for issue in issues -%}\n {%- if loop.first %}{{ name }} is\ \ {% elif loop.last %} and {% else %}, {% endif -%}\n {{ issue }}\n {%-\ \ if loop.last %}.{% endif %}\n{%- endfor %}" - id: 91bb52da-440a-4082-a6f3-4e58253a51c8 alias: notify_guest_arrives initial_state: true mode: parallel triggers: - trigger: state entity_id: - person.guest_cava - person.guest_gipa - person.guest_laboro - person.guest_stfr - person.guest_syvi to: home conditions: "{{\n is_state('input_boolean.notify_individual_guest_arrivals', 'on')\n\ \ or is_state_attr('sensor.guests_home', 'count', '1')\n}}" actions: - action: python_script.notify data: persistent: true push_target: household tag: presence_{{ trigger.to_state.object_id }} title: '{{ trigger.to_state.name }} is here' message: '{{ state_attr(''sensor.guests_home'', ''count'') }} guests are home.' - id: 33ae901e-24b8-4576-b876-4d2a87a7bd3b alias: notify_household_person_arrives initial_state: true mode: parallel triggers: - trigger: state entity_id: &id003 - person.chris - person.karine to: home conditions: - condition: state entity_id: input_boolean.notify_household_changes state: 'on' actions: - action: python_script.notify data: push_target: admin tag: presence_{{ trigger.to_state.object_id }} title: '{{ trigger.to_state.name }} arrived home.' message: Household is {{ states_translated('group.household') }}. - id: b3882bea-08d5-4c54-a076-092754457354 alias: notify_household_person_leaves initial_state: true mode: parallel triggers: - trigger: state entity_id: *id003 from: home conditions: - condition: state entity_id: input_boolean.notify_household_changes state: 'on' actions: - action: python_script.notify data: push_target: admin tag: presence_{{ trigger.to_state.object_id }} title: '{{ trigger.to_state.name }} left home.' message: Household is {{ states_translated('group.household') }}. - id: fd33012e-1f9a-4205-8c29-3639015bd2ad alias: apply_scheduled_climate_preset initial_state: true mode: restart triggers: - trigger: state entity_id: sensor.scheduled_climate_preset to: null - trigger: state entity_id: input_boolean.climate_scheduling_enabled to: 'on' conditions: - condition: state entity_id: input_boolean.climate_scheduling_enabled state: 'on' - '{{ has_value(''sensor.scheduled_climate_preset'') }}' actions: - action: script.apply_scheduled_climate_preset - id: a179c0b0-9c03-4be6-9437-c2bd6c58e9b7 alias: notify_new_network_device initial_state: true mode: parallel triggers: - trigger: event event_type: device_tracker_new_device actions: - action: python_script.notify data: push_target: admin persistent: true title: New device detected on network message: 'Device data: {{ trigger.event.data | tojson }}' - id: 778a17bc-898a-43ca-a457-b42c5c32b193 alias: notify_server_state_change initial_state: true mode: parallel triggers: - trigger: state entity_id: - switch.network_media to: null for: 45 variables: state: '{% if trigger.to_state.state == ''on'' %}on{% else %}off{% endif %}' state_action: '{% if state == ''on'' %}off{% else %}on{% endif %}' conditions: - condition: state entity_id: input_boolean.notify_server_outages state: 'on' actions: - action: python_script.notify data: push_target: admin tag: server_{{ trigger.to_state.object_id }} title: '{{ trigger.to_state.name }} server is {{ state }}line' url: /admin-infrastructure/network push_data: entity_id: '{{ trigger.entity_id }}' push_actions: - action: power_{{ state_action }}_server title: Power {{ state_action }} icon: /local/icons/power-plug-{{ state_action }}.png - id: ed45f4fc-3c90-456d-b499-516f568adf4e alias: power_on_server initial_state: true mode: parallel triggers: - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action event_data: action: power_on_server actions: - action: switch.turn_on target: entity_id: '{{ trigger.event.data.data.entity_id }}' - id: c4358eec-8328-4049-ba29-25438eb44fa6 alias: power_off_server initial_state: true mode: parallel triggers: - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action event_data: action: power_off_server actions: - action: switch.turn_off target: entity_id: '{{ trigger.event.data.data.entity_id }}' - id: 5cdf949f-e2e8-48b2-88c1-59f2c2f4fad2 alias: power_outage_management initial_state: true mode: restart triggers: - trigger: state entity_id: binary_sensor.ups_online_status to: 'off' for: 30 variables: shutdown_minutes: 2 actions: - action: python_script.notify data: persistent: true push_target: household tag: power_outage title: Power outage url: /admin-infrastructure/network message: 'A power outage is ongoing at home. {%- if is_state(''switch.managed_auxialiary_servers'', ''off'') %} Auxiliary servers are already turned off. {%- elif is_state(''input_boolean.power_outage_manage_devices'', ''on'') %} Auxiliary servers will automatically shutdown in {{ shutdown_minutes }} minutes. {%- else %} Automatic shutdown of auxiliary servers is disabled. {%- endif %}' push_actions: "{% set ns = namespace(actions = []) %} {% if is_state('switch.managed_auxialiary_servers',\ \ 'on') %}\n {% set ns.actions = ns.actions + [{\"action\": \"power_outage_shutdown\"\ , \"title\": \"Shutdown now\"}] %}\n {% if is_state('input_boolean.power_outage_manage_devices',\ \ 'on') %}\n {% set ns.actions = ns.actions + [{\"action\": \"power_outage_cancel\"\ , \"title\": \"Cancel\"}] %}\n {% endif %}\n{% endif %} {{ ns.actions }}" - condition: state entity_id: switch.managed_auxialiary_servers state: 'on' - wait_for_trigger: - trigger: state entity_id: binary_sensor.ups_online_status to: 'on' - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action event_data: action: power_outage_shutdown - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action event_data: action: power_outage_cancel timeout: minutes: '{{ shutdown_minutes if is_state(''input_boolean.power_outage_manage_devices'', ''on'') else 240 }}' continue_on_timeout: true - condition: "{% set timed_out = wait.trigger is none %} {{\n is_state('binary_sensor.ups_online_status',\ \ 'off')\n and (\n (timed_out and is_state('input_boolean.power_outage_manage_devices',\ \ 'on'))\n or (not timed_out and wait.trigger.event.data.action != 'power_outage_cancel')\n\ \ )\n}}" - action: switch.turn_off target: entity_id: switch.network_media - action: python_script.notify data: persistent: true push_target: household tag: power_outage title: Power outage url: /admin-infrastructure/network message: A power outage is ongoing at home. Auxiliary servers have been shutdown. - id: 37c346a4-c34f-40bf-9ad9-d34407afc29c alias: notify_power_restored initial_state: true mode: restart triggers: - trigger: state entity_id: binary_sensor.ups_online_status to: 'on' for: 60 - trigger: homeassistant event: start variables: power_on_minutes: 2 conditions: - condition: state entity_id: binary_sensor.ups_online_status state: 'on' for: 60 actions: - action: python_script.notify data: persistent: true push_target: household title: Power restored message: 'A power outage has finished after {{ time_since(trigger.from_state.last_changed, 0) }}. {%- if is_state(''switch.managed_auxialiary_servers'', ''on'') %} Auxiliary servers are already powered on. {%- elif is_state(''input_boolean.power_outage_manage_devices'', ''on'') %} Auxiliary servers will automatically power on in {{ power_on_minutes }} minutes. {%- else %} Automatic power on of auxiliary servers is disabled. {%- endif %}' push_actions: "{% set ns = namespace(actions = []) %} {% if is_state('switch.managed_auxialiary_servers',\ \ 'off') and is_state('input_boolean.power_outage_manage_devices', 'on') %}\n\ \ {% set ns.actions = ns.actions + [{\"action\": \"power_restored_cancel\"\ , \"title\": \"Cancel\"}] %}\n{% endif %} {{ ns.actions }}" - condition: and conditions: - condition: state entity_id: switch.managed_auxialiary_servers state: 'off' - condition: state entity_id: input_boolean.power_outage_manage_devices state: 'on' - wait_for_trigger: - trigger: state entity_id: binary_sensor.ups_online_status to: 'off' - trigger: event event_type: - html5_notification.clicked - mobile_app_notification_action event_data: action: power_restored_cancel timeout: minutes: '{{ power_on_minutes }}' continue_on_timeout: true - condition: "{% set timed_out = wait.trigger is none %} {{\n is_state('binary_sensor.ups_online_status',\ \ 'on')\n and timed_out\n and is_state('input_boolean.power_outage_manage_devices',\ \ 'on')\n}}" - action: switch.turn_on target: entity_id: switch.network_media - id: dc44848a-cdb1-4b0b-bd76-711a2f81e4b2 alias: schedule_hydro_peak_event initial_state: true mode: parallel triggers: - trigger: state entity_id: sensor.chris_pixel_6_last_notification to: null variables: text: '{{ trigger.to_state.attributes[''android.text''] | default('''') }}' conditions: - '{{ is_state(''binary_sensor.winter_credit_enabled'', ''on'') }}' - '{{ trigger.to_state.attributes[''package''] | default('''') == ''com.hydroquebec.mf_android'' }}' - '{{ ''Winter Credit Option:'' in text }}' - '{{ ''Reminder.'' not in text }}' actions: - variables: text: '{{ text | replace(''a.m.'', ''AM'') | replace(''p.m.'', ''PM'') }}' pattern: '(?:([a-z]+\.? \d{1,2}), )?from (\d{1,2}(?::\d{2})?)(?: (AM|PM))? to (\d{1,2}(?::\d{2})?)(?: (AM|PM)?)' date_time_format: '%Y-%m-%d %H:%M:%S' count: '{{ text | regex_findall(pattern, ignorecase = True) | length }}' events: "{% set ns = namespace(day = None, events = []) %}\n{% for match in\ \ (text | regex_findall(pattern, ignorecase = True)) %}\n {% set ns.day =\ \ strptime(match[0] | regex_replace('[^a-zA-Z0-9 ]', ''), '%b %d', None) |\ \ default(ns.day, True) -%}\n {% set start_hour = strptime(\n match[1]\n\ \ ~ (':00' if ':' not in match[1])\n ~ ' ' ~ (match[2] or match[4]\ \ or 'AM'),\n '%I:%M %p', None) -%}\n {% set end_hour = strptime(\n\ \ match[3]\n ~ (':00' if ':' not in match[3])\n ~ ' ' ~\ \ (match[4] or match[2] or 'AM'),\n '%I:%M %p', None) -%}\n\n {% if\ \ [ns.day, start_hour, end_hour] | select('none') | first is not none -%}\n\ \ {%- set start = ns.day.replace(year = now().year, hour = start_hour.hour,\ \ minute = start_hour.minute) -%}\n {%- set end = ns.day.replace(year =\ \ now().year, hour = end_hour.hour, minute = end_hour.minute) -%}\n {%\ \ set ns.events = ns.events + [{\n 'start': (start - timedelta(minutes\ \ = 90)) | as_timestamp | timestamp_custom(date_time_format),\n 'end':\ \ start | as_timestamp | timestamp_custom(date_time_format),\n 'preset':\ \ 'Boost',\n }, {\n 'start': start | as_timestamp | timestamp_custom(date_time_format),\n\ \ 'end': end | as_timestamp | timestamp_custom(date_time_format),\n \ \ 'preset': 'Winter Credit: Peak Event',\n }, {\n 'start': end\ \ | as_timestamp | timestamp_custom(date_time_format),\n 'end': (end\ \ + timedelta(minutes = 90)) | as_timestamp | timestamp_custom(date_time_format),\n\ \ 'preset': 'Boost',\n }] -%}\n {% endif -%}\n{% endfor %}\n{{ ns.events\ \ }}\n" - if: '{{ count == 0 or count != events | length / 3 }}' then: - action: persistent_notification.create data: title: Failed to parse peak event notification message: '{{ text }}
{{ events }}
'
else:
- repeat:
for_each: '{{ events }}'
sequence:
- action: calendar.create_event
target:
entity_id: calendar.climate_exceptions
data:
summary: '{{ repeat.item.preset }}'
description: '{{ text }}'
start_date_time: '{{ repeat.item.start }}'
end_date_time: '{{ repeat.item.end }}'
- id: automation.detect_dead_zwave_nodes
alias: detect_dead_zwave_nodes
initial_state: true
triggers:
- trigger: state
entity_id: &id004
- sensor.backyard_outlet_node_status
- sensor.backyard_soffit_spots_dimmer_node_status
- sensor.basement_bathroom_fan_switch_node_status
- sensor.basement_bathroom_light_switch_node_status
- sensor.basement_bathroom_multisensor_node_status
- sensor.basement_bathroom_vanity_dimmer_node_status
- sensor.basement_hallway_dimmer_node_status
- sensor.basement_hallway_thermostat_node_status
- sensor.basement_smoke_co_detector_node_status
- sensor.bookshelf_light_switch_node_status
- sensor.dining_room_light_dimmer_node_status
- sensor.dining_room_thermostat_node_status
- sensor.downstairs_light_switch_node_status
- sensor.front_porch_light_switch_node_status
- sensor.guest_bedroom_closet_light_switch_node_status
- sensor.guest_bedroom_dimmer_node_status
- sensor.guest_bedroom_thermostat_node_status
- sensor.guest_bedroom_window_sensor_node_status
- sensor.hallway_spots_dimmer_node_status
- sensor.kitchen_door_lock_node_status
- sensor.kitchen_door_sensor_node_status
- sensor.kitchen_sink_light_switch_node_status
- sensor.kitchen_track_light_dimmer_node_status
- sensor.kitchen_sink_leak_sensor_node_status
- sensor.laundry_dimmer_node_status
- sensor.laundry_motion_sensor_node_status
- sensor.living_room_couch_outlet_node_status
- sensor.living_room_door_sensor_node_status
- sensor.living_room_remote_node_status
- sensor.living_room_smoke_co_detector_node_status
- sensor.living_room_thermostat_node_status
- sensor.lounge_dimmer_node_status
- sensor.lounge_thermostat_node_status
- sensor.lounge_window_sensor_node_status
- sensor.main_bathroom_dimmer_node_status
- sensor.main_bathroom_fan_switch_node_status
- sensor.main_bathroom_multisensor_node_status
- sensor.main_bathroom_vanity_light_switch_node_status
- sensor.main_water_shut_off_valve_node_status
- sensor.master_bedroom_closet_light_switch_node_status
- sensor.master_bedroom_sconces_switch_node_status
- sensor.master_bedroom_spots_switch_node_status
- sensor.master_bedroom_thermostat_node_status
- sensor.office_spots_dimmer_node_status
- sensor.office_lamp_node_status
- sensor.office_thermostat_node_status
- sensor.shed_light_switch_node_status
- sensor.shed_outdoor_light_switch_node_status
- sensor.side_porch_sconce_dimmer_node_status
- sensor.lydia_power_strip_node_status
- sensor.staircase_dimmer_node_status
- sensor.studio_dimmer_node_status
- sensor.studio_thermostat_node_status
- sensor.studio_window_sensor_node_status
- sensor.washing_machine_leak_sensor_node_status
- sensor.water_heater_leak_sensor_node_status
- sensor.water_heater_switch_node_status
- sensor.workshop_light_switch_node_status
- sensor.workshop_motion_sensor_node_status
from: alive
to: dead
for: 60
variables:
dismiss: false
- trigger: state
entity_id: *id004
from: dead
to: alive
variables:
dismiss: true
actions:
- action: python_script.notify
data:
push_target: admin
persistent: true
dismiss: '{{ dismiss }}'
tag: '{{ trigger.to_state.entity_id }}'
title: '☠️ {{ trigger.to_state.name | lower | replace('': node status'', '''')
| title }} is dead '