- alias: Alarm - Triggered Armed Away id: alarm_triggered_armed_away triggers: - trigger: state entity_id: alarm_control_panel.alarm to: triggered conditions: [] actions: - action: notify.mobile_apps data: title: Alarm Triggered! message: The alarm was triggered data: group: alarm notification_icon: mdi:shield-home-outline ttl: 0 priority: high - alias: Alarm - Away Door Alarm id: alarm_away_door_alarm triggers: - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open_3 to: 'on' variables: location_name: Kitchen - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open_7 to: 'on' variables: location_name: Front - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_access_control_window_door_is_open_5 to: 'on' variables: location_name: Laundry - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open to: 'on' variables: location_name: Office conditions: - condition: state entity_id: alarm_control_panel.alarm state: armed_away actions: - action: alarm_control_panel.alarm_trigger entity_id: alarm_control_panel.alarm - action: notify.mobile_apps data: title: Door Alarm Triggered! message: '{{ location_name }} Door Alarm Triggered!' data: group: alarm notification_icon: mdi:shield-home-outline ttl: 0 priority: high - action: notify.email data_template: title: Door Alarm Triggered message: '{{ location_name }} door alarm triggered!' - alias: Bedtime routine id: bedtime_routine description: Trigger bedtime routine at 10:30pm. triggers: platform: time at: '22:30:00' actions: action: script.bedtime - alias: Announce Door Opened id: announce_door_opened triggers: - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open_3 to: 'on' variables: location_name: Kitchen - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open_7 to: 'on' variables: location_name: Front - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_access_control_window_door_is_open_5 to: 'on' variables: location_name: Laundry - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open to: 'on' variables: location_name: Office mode: queued conditions: - condition: state entity_id: binary_sensor.halloween_month state: 'off' - condition: state entity_id: binary_sensor.thanksgiving_month state: 'off' - condition: state entity_id: binary_sensor.christmas_month state: 'off' - condition: state entity_id: binary_sensor.today_is_someones_birthday state: 'off' actions: action: script.sonos_say data: message: '{{ location_name }} door open' delay: 00:00:03 - alias: Announce Door Closed id: announce_door_closed triggers: - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open_3 to: 'off' variables: location_name: Kitchen - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open_7 to: 'off' variables: location_name: Front - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_access_control_window_door_is_open_5 to: 'off' variables: location_name: Laundry - trigger: state entity_id: binary_sensor.z_wave_door_window_sensor_window_door_is_open to: 'off' variables: location_name: Office mode: queued conditions: - condition: state entity_id: binary_sensor.halloween_month state: 'off' - condition: state entity_id: binary_sensor.thanksgiving_month state: 'off' - condition: state entity_id: binary_sensor.christmas_month state: 'off' - condition: state entity_id: binary_sensor.today_is_someones_birthday state: 'off' actions: action: script.sonos_say data: message: '{{ location_name }} door closed' delay: 00:00:03 - alias: Announce Door Opened (Event) id: announce_door_opened_event triggers: trigger: state entity_id: - binary_sensor.z_wave_door_window_sensor_window_door_is_open - binary_sensor.z_wave_door_window_sensor_window_door_is_open_7 - binary_sensor.z_wave_door_window_sensor_window_door_is_open_3 - binary_sensor.z_wave_door_window_sensor_access_control_window_door_is_open_5 to: 'on' mode: queued actions: - choose: - conditions: - condition: state entity_id: binary_sensor.today_is_someones_birthday state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/birthday01.mp3 delay: 00:00:16 - conditions: - condition: state entity_id: binary_sensor.halloween_month state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/ghost01.mp3 delay: 00:00:08 - conditions: - condition: state entity_id: binary_sensor.thanksgiving_month state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/turkey01.mp3 delay: 00:00:08 - conditions: - condition: state entity_id: binary_sensor.christmas_month state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/christmas01.mp3 delay: 00:00:08 - alias: Announce Door Closed (Event) id: announce_door_closed_event triggers: trigger: state entity_id: - binary_sensor.z_wave_door_window_sensor_window_door_is_open - binary_sensor.z_wave_door_window_sensor_window_door_is_open_7 - binary_sensor.z_wave_door_window_sensor_window_door_is_open_3 - binary_sensor.z_wave_door_window_sensor_access_control_window_door_is_open_5 to: 'off' mode: queued actions: - choose: - conditions: - condition: state entity_id: binary_sensor.today_is_someones_birthday state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/birthday01.mp3 delay: 00:00:16 - conditions: - condition: state entity_id: binary_sensor.halloween_month state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/howl01.mp3 delay: 00:00:08 - conditions: - condition: state entity_id: binary_sensor.thanksgiving_month state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/turkey01.mp3 delay: 00:00:08 - conditions: - condition: state entity_id: binary_sensor.christmas_month state: 'on' sequence: - action: script.sonos_play_file data: audio_url: audio/christmas01.mp3 delay: 00:00:08 - alias: Turn Off Air Purifier Weekdays id: turn_off_air_purifier_weekdays triggers: trigger: time at: 07:00:00 conditions: - condition: time weekday: - mon - tue - wed - thu - fri actions: action: script.air_purifier - alias: Turn Off Air Purifier Weekends id: turn_off_air_purifier_weekends triggers: trigger: time at: 09:00:00 conditions: - condition: time weekday: - sat - sun actions: action: script.air_purifier - alias: Motion - Turn Off Guest Bathroom Fan When No Motion Detected id: motion_turn_off_guest_bathroom_fan_when_no_motion_detected triggers: - trigger: state entity_id: binary_sensor.4_in_1_sensor_motion_detection from: 'on' to: 'off' for: 00:05:00 conditions: - condition: state entity_id: switch.double_switch_1 state: 'on' actions: - action: switch.turn_off entity_id: switch.double_switch_1 - alias: Turn Off Main Bathroom Fan After Period Of Time id: turn_off_main_bathroom_fan_after_period_of_time description: 'Turn off the fan if it''s been on for 20 minutes. There isn''t motion detection available. ' triggers: - trigger: state entity_id: switch.double_switch_1_2 to: 'on' for: 00:20:00 conditions: [] actions: - action: switch.turn_off entity_id: switch.double_switch_1_2 - alias: Turn on Lights to Wake Us Up id: turn_on_light_to_wake_us_up description: Fade lights in on weekday mornings to simulate a sunrise next to our faces to wake us up. initial_state: true triggers: trigger: time at: 06:00:00 conditions: - condition: time weekday: - mon - tue - wed - thu - fri actions: action: light.turn_on data: entity_id: light.hue_white_lamp_1 brightness: 255 transition: 1800 - alias: Turn Off Lights Before Work id: turn_off_lights_before_work description: Turn off lights weekday mornings after sunrise. initial_state: true triggers: - trigger: numeric_state entity_id: sun.sun attribute: elevation above: 6.0 conditions: - condition: time weekday: - mon - tue - wed - thu - fri actions: action: light.turn_off entity_id: light.hue_white_lamp_1 - alias: Turn On Lights Before Sunset description: Gradually fade in lights as the sun sets into the night. initial_state: true triggers: trigger: sun event: sunset offset: '-1:15:00' actions: action: light.turn_on data: entity_id: - light.hue_white_lamp_1 - light.hue_white_lamp_2 brightness: 255 transition: 1500 - alias: Turn Off Lee's Bedside at Night initial_state: true triggers: trigger: time at: '20:00:00' actions: action: light.turn_off data: entity_id: light.hue_white_lamp_2 transition: 1800 - alias: Turn Off Andrei's Bedside By 9:00pm id: turn_off_andrei_s_bedside_by_9_00pm triggers: trigger: time at: '20:30:00' actions: action: light.turn_off data: entity_id: light.hue_white_lamp_1 transition: 1800 - alias: Turn On Night-Light at Sunset id: turn_on_night_light_at_sunset initial_state: true triggers: trigger: sun event: sunset offset: -0:30:00 actions: action: light.turn_on data: entity_id: light.controller_rgb_44_key_ir_cde6d9 brightness: 13 - alias: Turn Off Night-Light After Sunrise id: turn_off_night_light_after_sunrise description: Turn off night-light 15 minutes after sunrise. initial_state: true triggers: trigger: sun event: sunrise offset: 00:15:00 actions: action: light.turn_off data: entity_id: light.controller_rgb_44_key_ir_cde6d9 - alias: Turn On Dining Room Lamp Before Sunset initial_state: true triggers: trigger: sun event: sunset offset: '-1:00:00' actions: action: switch.turn_on data: entity_id: switch.tp_link_smart_plug_ac23 - alias: Turn Off Dining Room Lamp initial_state: true triggers: trigger: time at: '22:30:00' actions: action: switch.turn_off data: entity_id: switch.tp_link_smart_plug_ac23 - alias: Toggle Live Sign When Busy in Teams triggers: trigger: state entity_id: binary_sensor.teams_on_call actions: - action: switch.turn_{{ trigger.to_state.state }} target: entity_id: switch.tp_link_smart_plug_d6d2 - alias: Turn On Both Living Room Bookshelf Lamps From Single Switch id: turn_on_both_living_room_bookshelf_lamps_from_single_switch description: Physically toggling the one reachable switch should toggle the other switch in tandem triggers: - trigger: state entity_id: switch.tp_link_smart_plug_ac7b actions: - action: switch.turn_{{ trigger.to_state.state }} target: entity_id: switch.tp_link_smart_plug_1106 - alias: Motion - Turn On Guest Bathroom When Motion Detected Daytime id: motion_turn_on_guest_bathroom_when_motion_detected_daytime triggers: - trigger: state entity_id: binary_sensor.4_in_1_sensor_motion_detection from: 'off' to: 'on' conditions: - condition: state entity_id: light.double_switch state: 'off' - condition: time after: 06:00:00 before: '22:15:00' actions: - action: light.turn_on entity_id: light.double_switch data: brightness_pct: 100 - alias: Motion - Turn On Guest Bathroom When Motion Detected Night id: motion_turn_on_guest_bathroom_when_motion_detected_night triggers: - trigger: state entity_id: binary_sensor.4_in_1_sensor_motion_detection from: 'off' to: 'on' conditions: - condition: state entity_id: light.double_switch state: 'off' - condition: time after: '22:15:00' before: 06:15:00 actions: - action: light.turn_on entity_id: light.double_switch data: brightness_pct: 21 - alias: Motion - Turn Off Guest Bathroom When No Motion Detected id: motion_turn_off_guest_bathroom_when_no_motion_detected triggers: - trigger: state entity_id: binary_sensor.4_in_1_sensor_motion_detection from: 'on' to: 'off' for: 00:03:00 conditions: - condition: state entity_id: light.double_switch state: 'on' actions: - action: light.turn_off entity_id: light.double_switch - alias: Motion - Send Camera Snapshot Notification On Motion id: motion_send_camera_snapshot_notification_on_motion description: 'Send a notification to the Companion App with a camera snapshot. ' mode: queued triggers: - trigger: state entity_id: binary_sensor.office_motion_alarm to: 'on' variables: camera_name: camera.office_main - trigger: state entity_id: binary_sensor.laundry_motion_alarm to: 'on' variables: camera_name: camera.laundry_main - trigger: state entity_id: binary_sensor.front_door_smart_motion_human to: 'on' variables: camera_name: camera.front_door_main variables: snapshot_filename: '{{ camera_name }}-{{ now().strftime(''%Y%m%d-%H%M%S.%f'') }}.jpg ' snapshot_absolute_path: www/images/snapshots/{{ snapshot_filename }} snapshot_base_url: secret camera_snapshots_public_url actions: - delay: seconds: 4 - action: camera.snapshot data: entity_id: '{{ camera_name }}' filename: '{{ snapshot_absolute_path }}' - action: notify.mobile_apps data: title: Camera Motion Detected message: '' data: image: '{{ snapshot_base_url }}/{{ snapshot_filename }}' - alias: Laundry flooding id: laundry_flooding triggers: trigger: state entity_id: binary_sensor.flood_sensor_water_leak_state from: 'off' to: 'on' for: 00:00:15 actions: - action: notify.email data_template: title: Laundry room is flooding message: You should probably check it out. - action: script.sonos_say data: message: Crikey! We've sprunga leak in the laundry room! I said crikey! We've sprunga leak in the laundry room! delay: 00:00:15 - action: notify.mobile_apps data: message: The laundry room is flooding - alias: Low Battery Notification id: low_battery_notification description: Notify of low battery level in devices which have batteries. mode: parallel triggers: - trigger: state entity_id: - binary_sensor.flood_sensor_low_battery_level - binary_sensor.z_wave_door_window_sensor_low_battery_level - binary_sensor.z_wave_door_window_sensor_low_battery_level_2 - binary_sensor.z_wave_door_window_sensor_low_battery_level_4 - binary_sensor.z_wave_door_window_sensor_low_battery_level_5 from: 'off' to: 'on' for: hours: 1 - trigger: numeric_state entity_id: - sensor.4_in_1_sensor_battery_level below: 11 for: hours: 8 - trigger: numeric_state entity_id: - sensor.zcombo_g_smoke_co_alarm_battery_level - sensor.zcombo_g_smoke_co_alarm_battery_level_2 - sensor.zcombo_g_smoke_co_alarm_battery_level_3 below: 78 for: hours: 8 actions: - action: notify.mobile_apps data: message: The {{ trigger.to_state.attributes.friendly_name }} is Low data: tag: bettery group: battery - action: notify.email data_template: title: Low Battery Detected message: The {{ trigger.to_state.attributes.friendly_name }} is low. You should probably check it out. - alias: Smoke Alarm - Alert id: smoke_alarm_alert triggers: - trigger: state entity_id: binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_smoke_detected to: 'on' for: 00:00:15 variables: type_detected: Smoke location_detected: workshop - trigger: state entity_id: binary_sensor.zcombo_g_smoke_co_alarm_co_alarm_carbon_monoxide_detected to: 'on' for: 00:00:15 variables: type_detected: Carbon monoxide location_detected: workshop - trigger: state entity_id: binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_smoke_detected_2 to: 'on' for: 00:00:15 variables: type_detected: Smoke location_detected: laundry - trigger: state entity_id: binary_sensor.zcombo_g_smoke_co_alarm_co_alarm_carbon_monoxide_detected_2 to: 'on' for: 00:00:15 variables: type_detected: Carbon monoxide location_detected: laundry - trigger: state entity_id: binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_smoke_detected_3 to: 'on' for: 00:00:15 variables: type_detected: Smoke location_detected: hallway - trigger: state entity_id: binary_sensor.zcombo_g_smoke_co_alarm_co_alarm_carbon_monoxide_detected_3 to: 'on' for: 00:00:15 variables: type_detected: Carbon monoxide location_detected: hallway actions: - action: notify.email data_template: title: Alert! {{ type_detected }} detected in {{ location_detected }} room message: '{{ type_detected }} was detected in the {{ location_detected }} room! Investigate immediately and evacuate!' - action: script.sonos_say data: message: '{{ type_detected }} was detected in the {{ location_detected }} room! Investigate immediately and evacuate!' delay: 00:00:06 - action: notify.mobile_apps data: message: Alert! {{ type_detected }} detected in {{ location_detected }} room! Investigate immediately and evacuate! - alias: Smoke Alarm - Turn On Lights id: smoke_alarm_turn_on_lights triggers: trigger: state entity_id: - binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_smoke_detected - binary_sensor.zcombo_g_smoke_co_alarm_co_alarm_carbon_monoxide_detected - binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_smoke_detected_2 - binary_sensor.zcombo_g_smoke_co_alarm_co_alarm_carbon_monoxide_detected_2 - binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_smoke_detected_3 - binary_sensor.zcombo_g_smoke_co_alarm_co_alarm_carbon_monoxide_detected_3 to: 'on' for: 00:00:15 actions: action: light.turn_on data: entity_id: - light.hue_color_lamp_1 - light.hue_white_lamp_1 - light.hue_white_lamp_2 - light.double_switch - light.double_switch_2 - switch.living_room_bookshelf_lamps - switch.in_wall_paddle_switch_qfsw_500s_2 - alias: System - Clean Up Camera Snapshots Directory Periodically id: system_clean_up_camera_snapshots_directory_periodically description: 'Daily delete of all camera shapshots files older than 3 days. ' triggers: - trigger: time at: 05:27:18 actions: - action: shell_command.clean_camera_snapshots data: days_threshold: 3