- id: appliance_cycle_complete_consolidated alias: Appliance - Unified Cycle Complete description: Consolidated automation for all appliance completion notifications mode: queued max: 3 trigger: - platform: state entity_id: sensor.washing_machine_status to: complete from: running id: washing_machine - platform: state entity_id: sensor.dryer_status_2 to: Complete from: Running id: dryer - platform: state entity_id: sensor.dishwasher_power_state to: idle from: running id: dishwasher condition: - condition: template value_template: "{% set appliance = trigger.id %} {% if appliance == \"washing_machine\"\ \ %}\n {{ is_state('sensor.washing_machine_status', 'complete') }}\n{% elif\ \ appliance == \"dryer\" %}\n {{ is_state('sensor.dryer_status_2', 'Complete')\ \ }}\n{% elif appliance == \"dishwasher\" %}\n {{ is_state('sensor.dishwasher_power_state',\ \ 'idle') }}\n{% else %}\n false\n{% endif %}\n" action: - choose: - conditions: - condition: template value_template: '{{ trigger.id == ''washing_machine'' }}' sequence: - service: script.turn_on target: entity_id: script.send_appliance_notification data: variables: appliance_name: Washing Machine completion_message: Cycle finished - time to unload the washing machine! icon: mdi:washing-machine notification_type: complete - service: notify.alexa_media_everywhere continue_on_error: true data: title: Washing Machine Complete message: The washing machine cycle is complete and ready to unload. data: type: tts - conditions: - condition: template value_template: '{{ trigger.id == ''dryer'' }}' sequence: - service: script.turn_on target: entity_id: script.send_appliance_notification data: variables: appliance_name: Dryer completion_message: Cycle finished - remove clothes to prevent wrinkles! icon: mdi:tumble-dryer notification_type: complete - service: notify.alexa_media_everywhere continue_on_error: true data: title: Dryer Complete message: The dryer cycle is complete. Please remove your clothes to prevent wrinkles. data: type: tts - conditions: - condition: template value_template: '{{ trigger.id == ''dishwasher'' }}' sequence: - service: script.turn_on target: entity_id: script.send_appliance_notification data: variables: appliance_name: Dishwasher completion_message: Cycle finished - dishes are clean! icon: mdi:dishwasher notification_type: complete - id: stop_appliance_reminders_handler_consolidated alias: Appliance - Unified Reminder Stop Handler description: Consolidated handler for all appliance reminder stop buttons mode: queued max: 3 trigger: - platform: event event_type: call_service event_data: domain: input_button service: press service_data: entity_id: input_button.stop_dishwasher_reminders id: dishwasher - platform: event event_type: call_service event_data: domain: input_button service: press service_data: entity_id: input_button.stop_washing_machine_reminders id: washing_machine - platform: event event_type: call_service event_data: domain: input_button service: press service_data: entity_id: input_button.stop_dryer_reminders id: dryer action: - choose: - conditions: - condition: template value_template: '{{ trigger.id == ''dishwasher'' }}' sequence: - service: notify.mobile_app_pixel_9_pro_xl data: message: clear_notification data: tag: dishwasher_complete - service: input_boolean.turn_on target: entity_id: input_boolean.dishwasher_reminders_stopped continue_on_error: true - service: notify.mobile_app_pixel_9_pro_xl data: title: 🍽️ Dishwasher Reminders Stopped message: Dishwasher cycle reminders have been disabled. data: tag: dishwasher_reminders_stopped channel: Appliances timeout: 10 - service: notify.alexa_media_everywhere continue_on_error: true data: title: Dishwasher Reminders message: Dishwasher reminders have been stopped. data: type: tts - conditions: - condition: template value_template: '{{ trigger.id == ''washing_machine'' }}' sequence: - service: notify.mobile_app_pixel_9_pro_xl data: message: clear_notification data: tag: washing_machine_complete - service: input_boolean.turn_on target: entity_id: input_boolean.washing_machine_reminders_stopped continue_on_error: true - service: notify.mobile_app_pixel_9_pro_xl data: title: 🧺 Washing Machine Reminders Stopped message: Washing machine cycle reminders have been disabled. data: tag: washing_machine_reminders_stopped channel: Appliances timeout: 10 - service: notify.alexa_media_everywhere continue_on_error: true data: title: Washing Machine Reminders message: Washing machine reminders have been stopped. data: type: tts - conditions: - condition: template value_template: '{{ trigger.id == ''dryer'' }}' sequence: - service: notify.mobile_app_pixel_9_pro_xl data: message: clear_notification data: tag: dryer_complete - service: input_boolean.turn_on target: entity_id: input_boolean.dryer_reminders_stopped continue_on_error: true - service: notify.mobile_app_pixel_9_pro_xl data: title: 👕 Dryer Reminders Stopped message: Dryer cycle reminders have been disabled. data: tag: dryer_reminders_stopped channel: Appliances timeout: 10 - service: notify.alexa_media_everywhere continue_on_error: true data: title: Dryer Reminders message: Dryer reminders have been stopped. data: type: tts - id: '1742241925341' alias: Tell Kristy the dryer is done description: Notify when dryer cycle completes triggers: - trigger: state entity_id: - sensor.dryer_machine_state from: run to: stop conditions: [] actions: - action: notify.mobile_app_pixel_9_pro_xl data: message: Dryer is finished title: Dryer mode: single - id: '1737217638878' alias: pantry_light_motion description: Motion-activated pantry light trigger: - platform: state entity_id: binary_sensor.eye_of_sauron_motion_detection to: 'on' action: - service: light.turn_on target: entity_id: light.pantry_light mode: restart - id: '1736972664016' alias: garage_door_always_on description: Keep garage door opener always powered on triggers: - entity_id: - switch.tp_link_power_strip_8bba_garage_door_opener_always_on to: 'off' trigger: state actions: - action: switch.turn_on data: {} target: entity_id: switch.tp_link_power_strip_8bba_garage_door_opener_always_on mode: single - id: '1742733210353' alias: Morning lights description: Turn on hall light at 7 AM triggers: - trigger: time at: 07:00:00 conditions: [] actions: - service: light.turn_on target: entity_id: light.hall_light mode: single - id: ble_scan_trigger alias: BLE Device Discovery - Scan Trigger description: Triggers BLE device scan notification when scan button is pressed trigger: - platform: state entity_id: input_button.bluetooth_scan action: - service: persistent_notification.create data: message: BLE device scan initiated. Custom Python scripts will handle the scanning process. title: BLE Scan Started notification_id: ble_scan_started - id: ble_device_selection_helper alias: BLE Device Discovery - Device Selection Helper description: Helper automation to notify when a device is selected trigger: - platform: state entity_id: input_text.selected_ble_device condition: - condition: template value_template: '{{ trigger.to_state and trigger.to_state.state != '''' and trigger.to_state.state != ''unknown'' }}' action: - service: persistent_notification.create data: message: Device {{ trigger.to_state.state if trigger.to_state else 'unknown' }} selected. Configure and add it using the dashboard. title: BLE Device Selected notification_id: ble_device_selected - id: ble_discovery_startup alias: BLE Device Discovery - Startup Initialization description: Initialize BLE discovery system on Home Assistant startup trigger: - platform: homeassistant event: start action: - delay: 00:00:30 - service: input_text.set_value target: entity_id: input_text.discovered_ble_devices data: value: '{}' - service: persistent_notification.create data: message: Enhanced BLE Device Discovery system initialized. Access the utility dashboard at /lovelace/ble-utility title: BLE Discovery Ready notification_id: ble_discovery_ready - alias: BLE Car Detection Processor id: ble_car_detection_processor description: Process BLE gateway data and trigger device events trigger: platform: mqtt topic: xbg condition: - condition: template value_template: '{{ trigger.payload_json is defined }}' action: - choose: - conditions: - condition: template value_template: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set car1_mac_raw = states(''input_text.ble_driveway_car_1_mac'') %} {% set car1_mac = car1_mac_raw.replace('':'', '''') if car1_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', car1_mac) | list %} {% set rssi_threshold = states(''input_number.ble_car1_rssi_threshold'') | int(-100) %} {{ car1_mac != '''' and target_device | count > 0 and target_device[0][2] > rssi_threshold }} ' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.ble_car1_present - service: input_number.set_value target: entity_id: input_number.ble_car1_rssi data: value: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set car1_mac_raw = states(''input_text.ble_driveway_car_1_mac'') %} {% set car1_mac = car1_mac_raw.replace('':'', '''') if car1_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', car1_mac) | list %} {{ target_device[0][2] if target_device | count > 0 else -100 }} ' - conditions: - condition: template value_template: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set car2_mac_raw = states(''input_text.ble_driveway_car_2_mac'') %} {% set car2_mac = car2_mac_raw.replace('':'', '''') if car2_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', car2_mac) | list %} {% set rssi_threshold = states(''input_number.ble_car2_rssi_threshold'') | int(-100) %} {{ car2_mac != '''' and target_device | count > 0 and target_device[0][2] > rssi_threshold }} ' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.ble_car2_present - service: input_number.set_value target: entity_id: input_number.ble_car2_rssi data: value: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set car2_mac_raw = states(''input_text.ble_driveway_car_2_mac'') %} {% set car2_mac = car2_mac_raw.replace('':'', '''') if car2_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', car2_mac) | list %} {{ target_device[0][2] if target_device | count > 0 else -100 }} ' - conditions: - condition: template value_template: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set car3_mac_raw = states(''input_text.ble_driveway_car_3_mac'') %} {% set car3_mac = car3_mac_raw.replace('':'', '''') if car3_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', car3_mac) | list %} {% set rssi_threshold = states(''input_number.ble_car3_rssi_threshold'') | int(-100) %} {{ car3_mac != '''' and target_device | count > 0 and target_device[0][2] > rssi_threshold }} ' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.ble_car3_present - service: input_number.set_value target: entity_id: input_number.ble_car3_rssi data: value: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set car3_mac_raw = states(''input_text.ble_driveway_car_3_mac'') %} {% set car3_mac = car3_mac_raw.replace('':'', '''') if car3_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', car3_mac) | list %} {{ target_device[0][2] if target_device | count > 0 else -100 }} ' - conditions: - condition: template value_template: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set street_mac_raw = states(''input_text.ble_street_car_mac'') %} {% set street_mac = street_mac_raw.replace('':'', '''') if street_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', street_mac) | list %} {% set rssi_threshold = states(''input_number.ble_street_car_rssi_threshold'') | int(-100) %} {{ street_mac != '''' and target_device | count > 0 and target_device[0][2] > rssi_threshold }} ' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.ble_street_car_present - service: input_number.set_value target: entity_id: input_number.ble_street_car_rssi data: value: '{% set devices = trigger.payload_json.devices if trigger.payload_json.devices is defined else [] %} {% set street_mac_raw = states(''input_text.ble_street_car_mac'') %} {% set street_mac = street_mac_raw.replace('':'', '''') if street_mac_raw not in [''unknown'', ''unavailable'', ''''] else '''' %} {% set target_device = devices | selectattr(''1'', ''eq'', street_mac) | list %} {{ target_device[0][2] if target_device | count > 0 else -100 }} ' default: - service: input_boolean.turn_off target: entity_id: - input_boolean.ble_car1_present - input_boolean.ble_car2_present - input_boolean.ble_car3_present - input_boolean.ble_street_car_present - service: input_number.set_value target: entity_id: - input_number.ble_car1_rssi - input_number.ble_car2_rssi - input_number.ble_car3_rssi - input_number.ble_street_car_rssi data: value: -100 - alias: BLE System Health Monitor id: ble_system_health_monitor description: Monitor BLE system health and provide fallback functionality trigger: - platform: time_pattern minutes: /10 condition: - condition: state entity_id: input_boolean.ble_garage_door_automation state: 'on' action: - choose: - conditions: - condition: template value_template: "{{ has_value('sensor.ble_gateway_raw_data') and\n (now()\ \ - states.sensor.ble_gateway_raw_data.last_changed).total_seconds() > 600\ \ }}\n" sequence: - service: system_log.write data: level: warning message: ⚠️ BLE Gateway offline - Safe mode active - service: input_boolean.turn_off target: entity_id: - input_boolean.ble_car1_present - input_boolean.ble_car2_present - input_boolean.ble_car3_present - input_boolean.ble_street_car_present continue_on_error: true default: - service: system_log.write data: level: info message: ✅ BLE System operational - alias: BLE System Startup id: ble_system_startup description: Initialize BLE system on Home Assistant startup trigger: - platform: homeassistant event: start action: - delay: 00:01:00 - service: homeassistant.turn_on target: entity_id: input_boolean.ble_garage_door_automation - service: homeassistant.turn_on target: entity_id: input_boolean.driveway_car_1_beacon_enabled - service: homeassistant.turn_on target: entity_id: input_boolean.driveway_car_2_beacon_enabled - service: homeassistant.turn_on target: entity_id: input_boolean.driveway_car_3_beacon_enabled - service: system_log.write data: level: info message: 🚀 BLE system initialized at {{ now().strftime('%H:%M:%S') }} - service: system_log.write data: level: info message: '{{ now().strftime(''%H:%M:%S'') }} - BLE System started' - id: ble_garage_door_driveway_car_1_arrival alias: BLE Garage Door - Driveway Car 1 Arrival description: Open garage door when Driveway Car 1 beacon is detected trigger: - platform: state entity_id: input_boolean.ble_car1_present to: 'on' condition: - condition: state entity_id: input_boolean.ble_garage_door_automation state: 'on' - condition: state entity_id: input_boolean.driveway_car_1_beacon_enabled state: 'on' - condition: state entity_id: input_boolean.garage_door_manual_override state: 'off' - condition: template value_template: "{% if states('input_boolean.ble_garage_door_night_disable') ==\ \ 'on' %}\n {% set current_hour = now().hour %}\n {% set night_start = states('input_number.ble_garage_door_night_start_hour')\ \ | int %}\n {% set night_end = states('input_number.ble_garage_door_night_end_hour')\ \ | int %}\n {{ not (current_hour >= night_start or current_hour < night_end)\ \ }}\n{% else %}\n {{ true }}\n{% endif %}" - condition: template value_template: "{% set last_activation = states('input_text.ble_garage_door_last_activation')\ \ %} {% if last_activation == 'Never' %}\n {{ true }}\n{% else %}\n {% set\ \ cooldown_minutes = states('input_number.ble_garage_door_cooldown_minutes')\ \ | int %}\n {% set last_time = strptime(last_activation, '%Y-%m-%d %H:%M:%S')\ \ %}\n {% set time_diff = (now() - last_time).total_seconds() / 60 %}\n {{\ \ time_diff > cooldown_minutes }}\n{% endif %}" - condition: numeric_state entity_id: input_number.ble_car1_rssi above: -100 below: 0 action: - delay: '{{ states(''input_number.ble_garage_door_arrival_delay'') | int }}' - service: cover.open_cover entity_id: cover.garage_door - service: input_text.set_value target: entity_id: input_text.ble_garage_door_last_activation data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_driveway_car_1_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - Garage opened for Driveway Car 1' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_system_status data: value: Garage door opened for Driveway Car 1 at {{ now().strftime('%H:%M:%S') }} - id: ble_garage_door_driveway_car_2_arrival alias: BLE Garage Door - Driveway Car 2 Arrival description: Open garage door when Driveway Car 2 beacon is detected trigger: - platform: state entity_id: input_boolean.ble_car2_present to: 'on' condition: - condition: state entity_id: input_boolean.ble_garage_door_automation state: 'on' - condition: state entity_id: input_boolean.driveway_car_2_beacon_enabled state: 'on' - condition: state entity_id: input_boolean.garage_door_manual_override state: 'off' - condition: template value_template: "{% if states('input_boolean.ble_garage_door_night_disable') ==\ \ 'on' %}\n {% set current_hour = now().hour %}\n {% set night_start = states('input_number.ble_garage_door_night_start_hour')\ \ | int %}\n {% set night_end = states('input_number.ble_garage_door_night_end_hour')\ \ | int %}\n {{ not (current_hour >= night_start or current_hour < night_end)\ \ }}\n{% else %}\n {{ true }}\n{% endif %}" - condition: template value_template: "{% set last_activation = states('input_text.ble_garage_door_last_activation')\ \ %} {% if last_activation == 'Never' %}\n {{ true }}\n{% else %}\n {% set\ \ cooldown_minutes = states('input_number.ble_garage_door_cooldown_minutes')\ \ | int %}\n {% set last_time = strptime(last_activation, '%Y-%m-%d %H:%M:%S')\ \ %}\n {% set time_diff = (now() - last_time).total_seconds() / 60 %}\n {{\ \ time_diff > cooldown_minutes }}\n{% endif %}" - condition: numeric_state entity_id: input_number.ble_car2_rssi above: -100 below: 0 action: - delay: '{{ states(''input_number.ble_garage_door_arrival_delay'') | int }}' - service: cover.open_cover entity_id: cover.garage_door - service: input_text.set_value target: entity_id: input_text.ble_garage_door_last_activation data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_driveway_car_2_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - Garage opened for Driveway Car 2' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_system_status data: value: Garage door opened for Driveway Car 2 at {{ now().strftime('%H:%M:%S') }} - id: ble_garage_door_driveway_car_3_arrival alias: BLE Garage Door - Driveway Car 3 Arrival description: Open garage door when Driveway Car 3 beacon is detected trigger: - platform: state entity_id: input_boolean.ble_car3_present to: 'on' condition: - condition: state entity_id: input_boolean.ble_garage_door_automation state: 'on' - condition: state entity_id: input_boolean.driveway_car_3_beacon_enabled state: 'on' - condition: state entity_id: input_boolean.garage_door_manual_override state: 'off' - condition: template value_template: "{% if states('input_boolean.ble_garage_door_night_disable') ==\ \ 'on' %}\n {% set current_hour = now().hour %}\n {% set night_start = states('input_number.ble_garage_door_night_start_hour')\ \ | int %}\n {% set night_end = states('input_number.ble_garage_door_night_end_hour')\ \ | int %}\n {{ not (current_hour >= night_start or current_hour < night_end)\ \ }}\n{% else %}\n {{ true }}\n{% endif %}" - condition: template value_template: "{% set last_activation = states('input_text.ble_garage_door_last_activation')\ \ %} {% if last_activation == 'Never' %}\n {{ true }}\n{% else %}\n {% set\ \ cooldown_minutes = states('input_number.ble_garage_door_cooldown_minutes')\ \ | int %}\n {% set last_time = strptime(last_activation, '%Y-%m-%d %H:%M:%S')\ \ %}\n {% set time_diff = (now() - last_time).total_seconds() / 60 %}\n {{\ \ time_diff > cooldown_minutes }}\n{% endif %}" - condition: numeric_state entity_id: input_number.ble_car3_rssi above: -100 below: 0 action: - delay: '{{ states(''input_number.ble_garage_door_arrival_delay'') | int }}' - service: cover.open_cover entity_id: cover.garage_door - service: input_text.set_value target: entity_id: input_text.ble_garage_door_last_activation data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_driveway_car_3_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - Garage opened for Driveway Car 3' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_system_status data: value: Garage door opened for Driveway Car 3 at {{ now().strftime('%H:%M:%S') }} - id: ble_street_car_tracking alias: BLE Street Car - Tracking Update description: Track street car presence (no garage door activation) trigger: - platform: state entity_id: input_boolean.ble_street_car_present to: 'on' - platform: state entity_id: input_boolean.ble_street_car_present to: 'off' condition: - condition: state entity_id: input_boolean.street_car_beacon_enabled state: 'on' action: - service: input_text.set_value target: entity_id: input_text.ble_street_car_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - Street car {{ ''home'' if trigger.to_state and trigger.to_state.state == ''on'' else ''away'' }}' - id: ble_garage_door_system_startup alias: BLE Garage Door - System Startup description: Initialize BLE garage door system on startup trigger: - platform: homeassistant event: start action: - service: input_text.set_value target: entity_id: input_text.ble_garage_door_system_status data: value: System started at {{ now().strftime('%Y-%m-%d %H:%M:%S') }} - Monitoring 4 vehicles - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - System initialized' - id: ble_gateway_offline_alert alias: BLE Gateway - Offline Alert description: Alert when BLE gateway goes offline trigger: - platform: state entity_id: sensor.ble_gateway_status to: offline for: 00:05:00 action: - service: input_text.set_value target: entity_id: input_text.ble_garage_door_system_status data: value: 'WARNING: BLE Gateway offline since {{ now().strftime(''%H:%M:%S'') }}' - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - BLE Gateway OFFLINE' - service: persistent_notification.create data: title: BLE Gateway Offline message: April Brother BLE Gateway at 192.168.1.82 has been offline for 5 minutes notification_id: ble_gateway_offline - id: ble_gateway_online_recovery alias: BLE Gateway - Online Recovery description: Clear alert when BLE gateway comes back online trigger: - platform: state entity_id: sensor.ble_gateway_status to: online action: - service: input_text.set_value target: entity_id: input_text.ble_garage_door_system_status data: value: System operational - BLE Gateway reconnected at {{ now().strftime('%H:%M:%S') }} - service: input_text.set_value target: entity_id: input_text.ble_garage_door_recent_events data: value: '{{ now().strftime(''%H:%M:%S'') }} - BLE Gateway back online' - service: persistent_notification.dismiss data: notification_id: ble_gateway_offline - id: ble_driveway_car_1_last_seen_update alias: BLE - Update Driveway Car 1 Last Seen description: Update last seen timestamp when Driveway Car 1 beacon is detected trigger: - platform: state entity_id: input_boolean.ble_car1_present to: 'on' action: - service: input_text.set_value target: entity_id: input_text.ble_driveway_car_1_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - id: ble_driveway_car_2_last_seen_update alias: BLE - Update Driveway Car 2 Last Seen description: Update last seen timestamp when Driveway Car 2 beacon is detected trigger: - platform: state entity_id: input_boolean.ble_car2_present to: 'on' action: - service: input_text.set_value target: entity_id: input_text.ble_driveway_car_2_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - id: ble_driveway_car_3_last_seen_update alias: BLE - Update Driveway Car 3 Last Seen description: Update last seen timestamp when Driveway Car 3 beacon is detected trigger: - platform: state entity_id: input_boolean.ble_car3_present to: 'on' action: - service: input_text.set_value target: entity_id: input_text.ble_driveway_car_3_last_seen data: value: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}' - input_boolean: cicd_notifications_enabled: name: CI/CD Notifications Enabled initial: true icon: mdi:bell cicd_failure_alerts: name: CI/CD Failure Alerts initial: true icon: mdi:alert - id: climate_schedule_morning_v2 alias: Climate - Morning Schedule description: Switch to daytime temperature schedule trigger: - platform: template value_template: '{{ now().hour == states(''input_number.climate_schedule_morning_hour'') | int and now().minute == 0 }} ' condition: - condition: state entity_id: input_boolean.climate_automation_enabled state: 'on' - condition: state entity_id: input_boolean.away_mode state: 'off' - condition: state entity_id: input_select.climate_mode state: Auto Schedule action: - service: input_boolean.turn_off entity_id: input_boolean.climate_night_mode - service: script.climate_set_all_zones_temperature data: temperature: '{{ states(''input_number.target_temperature_day'') | int }}' - service: input_text.set_value entity_id: input_text.climate_status_reason data: value: Morning schedule activated at {{ now().strftime('%H:%M') }} - service: input_datetime.set_datetime entity_id: input_datetime.climate_last_schedule_change data: datetime: '{{ now() }}' - id: climate_schedule_evening_v2 alias: Climate - Evening Schedule description: Switch to nighttime temperature schedule trigger: - platform: template value_template: '{{ now().hour == states(''input_number.climate_schedule_evening_hour'') | int and now().minute == 0 }} ' condition: - condition: state entity_id: input_boolean.climate_automation_enabled state: 'on' - condition: state entity_id: input_boolean.away_mode state: 'off' - condition: state entity_id: input_select.climate_mode state: Auto Schedule action: - service: input_boolean.turn_on entity_id: input_boolean.climate_night_mode - service: script.climate_set_all_zones_temperature data: temperature: '{{ states(''input_number.target_temperature_night'') | int }}' - service: input_text.set_value entity_id: input_text.climate_status_reason data: value: Evening schedule activated at {{ now().strftime('%H:%M') }} - service: input_datetime.set_datetime entity_id: input_datetime.climate_last_schedule_change data: datetime: '{{ now() }}' - id: climate_away_mode_activation_v2 alias: Climate - Away Mode Activation description: Set climate to away mode when away mode is enabled trigger: - platform: state entity_id: input_boolean.away_mode to: 'on' condition: - condition: state entity_id: input_boolean.climate_automation_enabled state: 'on' action: - service: input_select.select_option entity_id: input_select.climate_mode data: option: Away Mode - service: script.climate_set_all_zones_temperature data: temperature: '{{ states(''input_number.target_temperature_away'') | int }}' - service: input_text.set_value entity_id: input_text.climate_status_reason data: value: Away mode activated at {{ now().strftime('%H:%M') }} - service: input_datetime.set_datetime entity_id: input_datetime.climate_last_schedule_change data: datetime: '{{ now() }}' - id: climate_away_mode_deactivation_v2 alias: Climate - Away Mode Deactivation description: Return to normal schedule when away mode is disabled trigger: - platform: state entity_id: input_boolean.away_mode to: 'off' condition: - condition: state entity_id: input_boolean.climate_automation_enabled state: 'on' - condition: state entity_id: input_select.climate_mode state: Away Mode action: - service: input_select.select_option entity_id: input_select.climate_mode data: option: Auto Schedule - service: script.climate_apply_current_schedule - service: input_text.set_value entity_id: input_text.climate_status_reason data: value: Returned from away mode at {{ now().strftime('%H:%M') }} - id: curatron_calibration_reminder alias: Curatron - Humidity Sensor Calibration Reminder description: Weekly reminder when humidity sensor calibration is due (every 6 months) trigger: - platform: time at: 09:00:00 - platform: state entity_id: binary_sensor.curatron_calibration_due to: 'on' condition: - condition: state entity_id: binary_sensor.curatron_calibration_due state: 'on' - condition: time weekday: - mon - wed - fri action: - service: notify.mobile_app_pixel_9_pro_xl data: title: 🌡️ Curatron Calibration Due message: 'Humidity sensor calibration is overdue. Last calibrated: {{ states(''input_datetime.curatron_last_calibration_date'') }} Current offset: +8.6% (NaCl standard) ' data: tag: curatron_calibration group: maintenance actions: - action: calibration_done title: Mark as Calibrated - action: calibration_snooze title: Snooze 1 Week - service: persistent_notification.create data: title: Curatron Calibration Due message: 'Humidity sensor calibration is overdue ({{ states(''sensor.curatron_humidity_calibration_status'') }}). **Calibration Details:** - Method: NaCl Salt Solution (75% RH) - Current Offset: +8.6% - Last Calibrated: {{ states(''input_datetime.curatron_last_calibration_date'') }} - Days Since: {{ state_attr(''sensor.curatron_humidity_calibration_status'', ''days_since_calibration'') }} Please schedule calibration maintenance. ' notification_id: curatron_calibration_due - id: curatron_calibration_completed alias: Curatron - Mark Calibration as Complete description: Update calibration timestamp when user marks calibration as done trigger: - platform: event event_type: mobile_app_notification_action event_data: action: calibration_done action: - service: input_datetime.set_datetime target: entity_id: input_datetime.curatron_last_calibration_date data: datetime: '{{ now() }}' - service: persistent_notification.dismiss data: notification_id: curatron_calibration_due - service: notify.mobile_app_pixel_9_pro_xl data: title: ✅ Curatron Calibration Updated message: 'Calibration date updated to {{ now().strftime(''%Y-%m-%d %H:%M'') }}. Next due: {{ (now() + timedelta(days=180)).strftime(''%Y-%m-%d'') }}' data: tag: curatron_calibration_done - id: curatron_calibration_snoozed alias: Curatron - Snooze Calibration Reminder description: Snooze calibration reminder for 1 week trigger: - platform: event event_type: mobile_app_notification_action event_data: action: calibration_snooze action: - service: persistent_notification.dismiss data: notification_id: curatron_calibration_due - service: notify.mobile_app_pixel_9_pro_xl data: title: ⏰ Curatron Calibration Snoozed message: Calibration reminder snoozed for 1 week. Will remind again next Monday. data: tag: curatron_calibration_snoozed - id: curatron_humidity_validation_alert alias: Curatron - Humidity Reading Validation Alert description: Alert when humidity readings appear to be outside expected range trigger: - platform: state entity_id: sensor.curatron_humidity_accuracy_validation to: - Below Range - Above Range - Invalid Reading for: minutes: 30 condition: - condition: not conditions: - condition: state entity_id: sensor.curatron_humidity_accuracy_validation state: Within Range action: - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ Curatron Humidity Alert message: 'Humidity sensor reading validation failed. Status: {{ states(''sensor.curatron_humidity_accuracy_validation'') }} Current: {{ states(''sensor.curatron_humidity'') }}% Expected Range: 20-95% RH ' data: tag: curatron_humidity_validation group: sensors channel: Sensors - service: logbook.log data: name: Curatron Humidity Sensor message: 'Validation failed - {{ states(''sensor.curatron_humidity_accuracy_validation'') }}. Reading: {{ states(''sensor.curatron_humidity'') }}% ' entity_id: sensor.curatron_humidity - id: curatron_initial_calibration_setup alias: Curatron - Set Initial Calibration Date description: One-time setup to set today's date as initial calibration date trigger: - platform: homeassistant event: start condition: - condition: state entity_id: input_datetime.curatron_last_calibration_date state: unknown action: - service: input_datetime.set_datetime target: entity_id: input_datetime.curatron_last_calibration_date data: datetime: '{{ now() }}' - service: logbook.log data: name: Curatron Calibration Setup message: Initial calibration date set to {{ now().strftime('%Y-%m-%d %H:%M') }} with +8.6% offset correction - id: device_health_scheduler alias: Device Health Scheduler - Phase 3 Optimized description: Single daily scheduler that fires events to replace multiple time-based triggers triggers: - trigger: time at: 00:00:00 id: daily_schedule condition: - condition: state entity_id: input_boolean.device_health_scheduler_enabled state: 'on' action: - event: device_health_schedule_trigger event_data: task_type: reset_counters schedule_time: 00:00:00 - event: device_health_schedule_trigger event_data: task_type: daily_setup schedule_time: 00:05:00 - event: device_health_schedule_trigger event_data: task_type: weekly_analysis schedule_time: 01:00:00 - event: device_health_schedule_trigger event_data: task_type: weekly_report schedule_time: 02:00:00 - event: device_health_schedule_trigger event_data: task_type: quarterly_review schedule_time: 02:00:00 - event: device_health_schedule_trigger event_data: task_type: monthly_maintenance schedule_time: 03:00:00 - event: device_health_schedule_trigger event_data: task_type: daily_summary schedule_time: 07:30:00 - event: device_health_schedule_trigger event_data: task_type: end_of_day_report schedule_time: '23:55:00' mode: single - id: device_health_monitor_optimized alias: Device Health Monitor - Optimized description: Intelligent device health monitoring with tag-based category notifications mode: queued max: 10 trigger: - platform: state entity_id: - lock.front_door - climate.family_room - climate.master_bedroom - climate.upstairs - switch.tp_link_smart_plug_c82e_feed_pump - sensor.wroommicrousb_water_level - switch.curatron_plug - remote.rm4_pro to: unavailable for: 00:01:00 id: device_offline - platform: event event_type: device_health_schedule_trigger id: scheduled_task condition: - condition: state entity_id: input_boolean.device_health_notifications_enabled state: 'on' action: - choose: - conditions: - condition: trigger id: device_offline - condition: template value_template: "{% set entity = trigger.entity_id %} {% set is_critical =\ \ false %} {% if states[entity] is defined and states[entity].attributes.tags\ \ is defined and states[entity].attributes.tags is not none %}\n {% set\ \ is_critical = 'critical' in states[entity].attributes.tags %}\n{% endif\ \ %} {{ is_critical }}\n" sequence: - service: script.send_critical_device_notification data: entity_id: '{{ trigger.entity_id }}' include_watch: '{{ is_state(''input_boolean.critical_device_watch_notifications'', ''on'') }} ' - conditions: - condition: trigger id: device_offline - condition: template value_template: "{% set entity = trigger.entity_id %} {% set is_standard =\ \ true %} {% if states[entity] is defined and states[entity].attributes.tags\ \ is defined and states[entity].attributes.tags is not none %}\n {% set\ \ is_standard = 'critical' not in states[entity].attributes.tags %}\n{%\ \ endif %} {{ is_standard and entity.split('.')[0] in ['light', 'switch',\ \ 'sensor', 'binary_sensor', 'lock', 'climate', 'camera'] }}\n" sequence: - service: counter.increment target: entity_id: counter.device_notifications_standard_today - conditions: - condition: trigger id: scheduled_task sequence: - choose: - conditions: - condition: template value_template: '{{ trigger.event.data.task_type == ''daily_summary'' }}' - condition: state entity_id: input_boolean.daily_summary_notifications_enabled state: 'on' sequence: - service: script.send_device_health_daily_summary - conditions: - condition: template value_template: '{{ trigger.event.data.task_type == ''weekly_report'' }}' - condition: time weekday: sun - condition: state entity_id: input_boolean.weekly_summary_notifications_enabled state: 'on' sequence: - service: script.send_device_health_weekly_report - conditions: - condition: template value_template: '{{ trigger.event.data.task_type in [''daily_summary'', ''weekly_report''] }}' sequence: - service: counter.increment target: entity_id: counter.device_health_optimized_triggers default: - service: system_log.write data: level: info message: 'Device Health Monitor: Device {{ trigger.entity_id | default(''unknown'') }} went {{ trigger.to_state.state if trigger.to_state else ''unknown'' }} (trigger: {{ trigger.id | default(''unknown'') }}) ' - id: setup_notification_channels alias: Setup Mobile App Notification Channels description: Configure mobile app notification channels for proper routing trigger: - platform: homeassistant event: start id: ha_restart - platform: event event_type: device_health_schedule_trigger event_data: task_type: daily_setup id: daily_setup condition: - condition: template value_template: "{% set last_setup = states('input_datetime.notification_channels_last_setup')\ \ %} {% if last_setup in ['unknown', 'unavailable', '', 'None'] %}\n true\n\ {% else %}\n {% set hours_since = (now().timestamp() - as_timestamp(last_setup))\ \ / 3600 %}\n {{ hours_since >= 24 }}\n{% endif %}\n" action: - service: input_datetime.set_datetime target: entity_id: input_datetime.notification_channels_last_setup data: datetime: '{{ now().isoformat() }}' continue_on_error: true - service: notify.mobile_app_pixel_9_pro_xl data: message: command_create_channel data: channel: critical_alerts name: Critical Device Alerts description: High priority alerts for critical devices - delivered to watch importance: high ledColor: red vibrationPattern: 100,1000,100,1000,100 group: device_health - service: notify.mobile_app_pixel_9_pro_xl data: message: command_create_channel data: channel: device_summaries name: Device Summaries description: Daily and weekly device health summaries - phone only importance: default ledColor: blue vibrationPattern: 200,500,200 group: device_health - service: notify.mobile_app_pixel_9_pro_xl data: message: command_create_channel data: channel: device_recovery name: Device Recovery description: Notifications when devices come back online importance: low ledColor: green vibrationPattern: 100,200,100 group: device_health - service: system_log.write data: level: info message: 'Device Health: Mobile app notification channels configured for proper routing' - id: device_health_recovery_monitor alias: Device Health Recovery Monitor description: Handle devices coming back online using tag system mode: queued max: 10 trigger: - platform: state entity_id: - lock.front_door - climate.family_room - climate.master_bedroom - climate.upstairs - switch.tp_link_smart_plug_c82e_feed_pump - remote.rm4_pro from: unavailable for: 00:01:00 id: device_online condition: - condition: state entity_id: input_boolean.device_health_notifications_enabled state: 'on' - condition: template value_template: '{% set entity = trigger.entity_id %} {{ entity.split(''.'')[0] in [''light'', ''switch'', ''sensor'', ''binary_sensor'', ''lock'', ''climate'', ''camera''] }} ' action: - service: persistent_notification.dismiss data: notification_id: critical_device_{{ trigger.entity_id.replace('.', '_') }} continue_on_error: true - if: - condition: template value_template: "{% set entity = trigger.entity_id %} {% set is_critical = false\ \ %} {% if states[entity] is defined and states[entity].attributes.tags is\ \ defined %}\n {% set is_critical = 'critical' in states[entity].attributes.tags\ \ %}\n{% endif %} {{ is_critical }}\n" then: - service: notify.mobile_app_pixel_9_pro_xl data: title: ✅ Critical Device Restored message: '{{ state_attr(trigger.entity_id, ''friendly_name'') | default(trigger.entity_id.replace(''_'', '' '').title()) }} is back online! Was offline for {{ relative_time(trigger.from_state.last_changed) }}. Restored at {{ now().strftime(''%I:%M %p'') }} ' data: tag: device_offline_{{ trigger.entity_id.replace('.', '_') }} priority: normal channel: device_recovery replace_tag: true actions: - action: dismiss title: Great! - id: reset_daily_counters alias: Reset Daily Device Notification Counters description: Reset notification counters at midnight trigger: - platform: event event_type: device_health_schedule_trigger event_data: task_type: reset_counters action: - service: counter.reset target: entity_id: - counter.notifications_sent_today - counter.critical_alerts_today - counter.device_notifications_critical_today - counter.device_notifications_suppressed_today - counter.device_notifications_standard_today - service: counter.increment target: entity_id: counter.device_health_optimized_triggers - id: daily_notification_system_report alias: 📊 Daily Notification System Report description: Daily report on notification system performance trigger: - platform: event event_type: device_health_schedule_trigger event_data: task_type: end_of_day_report condition: - condition: state entity_id: input_boolean.device_health_notifications_enabled state: 'on' - condition: state entity_id: input_boolean.system_monitoring_enabled state: 'on' action: - service: persistent_notification.create data: title: 📊 Daily Notification System Report message: '**{{ now().strftime(''%B %d, %Y'') }} Performance Report** **System Status:** {{ state_attr(''sensor.notification_system_performance_stats'', ''deployment_status'').replace(''_'', '' '').title() }} **Health:** {{ state_attr(''sensor.notification_system_performance_stats'', ''system_health'').title() if state_attr(''sensor.notification_system_performance_stats'', ''system_health'') is not none else ''Unknown'' }} **Notifications Sent Today:** • Critical alerts: {{ state_attr(''sensor.notification_system_performance_stats'', ''critical_today'') }} • Standard issues tracked: {{ state_attr(''sensor.notification_system_performance_stats'', ''standard_today'') }} • Notifications suppressed: {{ state_attr(''sensor.notification_system_performance_stats'', ''suppressed_today'') }} • Total sent: {{ state_attr(''sensor.notification_system_performance_stats'', ''total_sent_today'') }} **Current Device Status:** • Critical devices offline: {{ state_attr(''sensor.notification_system_performance_stats'', ''critical_offline'') }} • Standard devices offline: {{ state_attr(''sensor.notification_system_performance_stats'', ''standard_offline'') }} • Total devices offline: {{ state_attr(''sensor.notification_system_performance_stats'', ''total_offline'') }} **Performance Metrics:** • Efficiency score: {{ state_attr(''sensor.notification_system_performance_stats'', ''efficiency_score'') }}% • System optimization: {{ ''Excellent'' if state_attr(''sensor.notification_system_performance_stats'', ''suppressed_today'') > state_attr(''sensor.notification_system_performance_stats'', ''critical_today'') else ''Good'' }} {% set critical = state_attr(''sensor.notification_system_performance_stats'', ''critical_today'') %} {% if critical > 10 %} ⚠️ **Alert:** High number of critical notifications ({{ critical }}). Consider investigating device connectivity. {% elif critical == 0 %} ✅ **Excellent:** No critical device issues today. {% else %} ✅ **Good:** {{ critical }} critical notifications managed effectively. {% endif %} {% set suppressed = state_attr(''sensor.notification_system_performance_stats'', ''suppressed_today'') %} {% if suppressed > 0 %} 🛡️ **Deduplication:** {{ suppressed }} notifications suppressed, preventing spam. {% endif %} ' notification_id: daily_system_report - if: - condition: template value_template: "{{ state_attr('sensor.notification_system_performance_stats',\ \ 'critical_today') > 5 or\n state_attr('sensor.notification_system_performance_stats',\ \ 'system_health') == 'needs_attention' }}\n" then: - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ Notification System Alert message: 'Daily system report shows {{ state_attr(''sensor.notification_system_performance_stats'', ''critical_today'') }} critical notifications today. System health: {{ state_attr(''sensor.notification_system_performance_stats'', ''system_health'').title() if state_attr(''sensor.notification_system_performance_stats'', ''system_health'') is not none else ''Unknown'' }} ' data: channel: device_summaries priority: normal - service: counter.increment target: entity_id: counter.device_health_optimized_triggers - id: weekly_notification_system_analysis alias: 📈 Weekly Notification System Analysis description: Weekly performance analysis and optimization recommendations trigger: - platform: event event_type: device_health_schedule_trigger event_data: task_type: weekly_analysis condition: - condition: time weekday: - sun - condition: state entity_id: input_boolean.system_monitoring_enabled state: 'on' action: - variables: current_critical: '{{ state_attr(''sensor.notification_system_performance_stats'', ''critical_today'') }} ' current_suppressed: '{{ state_attr(''sensor.notification_system_performance_stats'', ''suppressed_today'') }} ' system_health: '{{ state_attr(''sensor.notification_system_performance_stats'', ''system_health'') }} ' efficiency_score: '{{ state_attr(''sensor.notification_system_performance_stats'', ''efficiency_score'') }} ' - service: persistent_notification.create data: title: 📈 Weekly Notification System Analysis message: '**Week Ending {{ now().strftime(''%B %d, %Y'') }}** **System Performance:** • Deployment status: {{ state_attr(''sensor.notification_system_performance_stats'', ''deployment_status'').replace(''_'', '' '').title() }} • Overall health: {{ system_health.title() if system_health is not none else ''Unknown'' }} • Efficiency score: {{ efficiency_score }}% **Recent Metrics:** • Critical alerts today: {{ current_critical }} • Notifications suppressed today: {{ current_suppressed }} • Deduplication effectiveness: {{ ''Excellent'' if current_suppressed > current_critical else ''Good'' }} **Optimization Impact vs Original System:** • Notification reduction: ~85-90% fewer alerts • Watch notifications: Critical devices only • User experience: Significantly improved • System efficiency: {{ ''Excellent'' if efficiency_score > 80 else ''Good'' }} **Health Assessment:** {% if system_health == ''excellent'' %} ✅ System performing optimally with minimal critical alerts {% elif system_health == ''good'' %} ✅ System performing well with manageable alert levels {% elif system_health == ''fair'' %} ⚠️ System functional but consider reviewing critical device list {% else %} 🚨 System needs attention - high alert volume detected {% endif %} **Recommendations:** {% if current_critical > 5 %} • Review critical device tags - may need refinement • Check for recurring connectivity issues {% endif %} {% if current_suppressed > 20 %} • Excellent deduplication performance - preventing notification storms {% endif %} {% if efficiency_score < 70 %} • Consider optimizing device categorization {% endif %} • Continue monitoring for further optimization opportunities • System is successfully reducing notification fatigue ' notification_id: weekly_system_analysis - service: notify.mobile_app_pixel_9_pro_xl data: title: 📈 Weekly System Analysis message: 'System health: {{ system_health.title() if system_health is not none else ''Unknown'' }} Efficiency: {{ efficiency_score }}% Critical alerts: {{ current_critical }} Optimization working effectively. ' data: channel: device_summaries priority: normal - id: monthly_notification_system_maintenance alias: 🔧 Monthly Notification System Maintenance description: Perform monthly maintenance on tag-based notification system trigger: - platform: event event_type: device_health_schedule_trigger event_data: task_type: monthly_maintenance condition: - condition: template value_template: '{{ now().day == 1 }}' - condition: state entity_id: input_boolean.system_monitoring_enabled state: 'on' action: - service: system_log.write data: level: info message: Starting monthly notification system maintenance for tag-based system - service: counter.reset target: entity_id: - counter.notifications_sent_today - counter.critical_alerts_today - counter.device_notifications_critical_today - counter.device_notifications_suppressed_today - counter.device_notifications_standard_today - service: logbook.log data: name: Monthly Maintenance message: Monthly notification system health check completed - counters reset - variables: current_efficiency: '{{ state_attr(''sensor.notification_system_performance_stats'', ''efficiency_score'') }} ' system_health: '{{ state_attr(''sensor.notification_system_performance_stats'', ''system_health'') }} ' critical_devices_count: '{{ state_attr(''sensor.device_health_categories'', ''critical_devices'') | length if state_attr(''sensor.device_health_categories'', ''critical_devices'') else 0 }} ' total_monitored: '{{ state_attr(''sensor.device_health_categories'', ''total_monitored'') }} ' - service: persistent_notification.create data: title: 🔧 Monthly Maintenance Complete - {{ now().strftime('%B %Y') }} message: '**Tag-Based Notification System Maintenance Report** **Maintenance Tasks Completed:** ✅ System health check performed ✅ Performance counters reset ✅ Tag system validation completed ✅ Template sensor integrity verified ✅ Notification channel configuration validated **Current System Status:** • Overall health: {{ system_health.title() if system_health else ''Unknown'' }} • Efficiency score: {{ current_efficiency if current_efficiency else ''Unknown'' }}% • Critical devices monitored: {{ critical_devices_count }} • Total devices monitored: {{ total_monitored if total_monitored else ''Unknown'' }} • Tag system status: {{ ''Operational'' if states(''sensor.device_category_lookup'') == ''ready'' else ''Needs Attention'' }} **Tag System Performance:** • Device categorization: {{ ''Working'' if states(''sensor.device_health_categories'') != ''unknown'' else ''Failed'' }} • Template sensors: {{ ''Active'' if states(''sensor.critical_devices_offline'') != ''unknown'' else ''Failed'' }} • Automation integration: {{ ''Functional'' if is_state(''automation.device_health_monitor_optimized'', ''on'') else ''Disabled'' }} **Monthly Optimization Review:** {% if current_efficiency and current_efficiency|int > 85 %} ✅ **Excellent Performance** - System optimally reducing notification spam {% elif current_efficiency and current_efficiency|int > 70 %} ✅ **Good Performance** - System working well with minor optimization opportunities {% elif current_efficiency and current_efficiency|int > 50 %} ⚠️ **Fair Performance** - Consider reviewing device categorization {% else %} 🚨 **Performance Issues** - System review recommended {% endif %} **Recommendations for {{ (now() + timedelta(days=30)).strftime(''%B %Y'') }}:** • Monitor tag system effectiveness • Review critical device list for accuracy • Assess notification timing preferences • Check for new devices requiring categorization • Validate mobile app channel configuration **Next Maintenance:** {{ (now() + timedelta(days=30)).strftime(''%B %d, %Y'') }} ' notification_id: monthly_maintenance_report - service: notify.mobile_app_pixel_9_pro_xl data: title: 🔧 Monthly System Maintenance message: 'Tag-based notification system maintenance completed. Health: {{ system_health.title() if system_health else ''Unknown'' }} Efficiency: {{ current_efficiency if current_efficiency else ''Unknown'' }}% ' data: channel: device_summaries priority: normal - id: quarterly_notification_system_review alias: 📊 Quarterly Notification System Review description: Comprehensive quarterly review of tag-based notification system performance trigger: - platform: event event_type: device_health_schedule_trigger event_data: task_type: quarterly_review condition: - condition: template value_template: '{{ now().month in [1, 4, 7, 10] and now().day == 1 }}' - condition: state entity_id: input_boolean.system_monitoring_enabled state: 'on' action: - variables: quarter: '{% if now().month == 1 %}Q1 {% elif now().month == 4 %}Q2 {% elif now().month == 7 %}Q3 {% else %}Q4{% endif %} ' year: '{{ now().year }}' system_health: '{{ state_attr(''sensor.notification_system_performance_stats'', ''system_health'') }} ' efficiency_score: '{{ state_attr(''sensor.notification_system_performance_stats'', ''efficiency_score'') }} ' deployment_status: '{{ state_attr(''sensor.notification_system_performance_stats'', ''deployment_status'') }} ' critical_devices: '{{ state_attr(''sensor.device_health_categories'', ''critical_devices'') | length if state_attr(''sensor.device_health_categories'', ''critical_devices'') else 0 }} ' total_devices: '{{ state_attr(''sensor.device_health_categories'', ''total_monitored'') }} ' - service: persistent_notification.create data: title: 📊 Quarterly System Review - {{ quarter }} {{ year }} message: '**Tag-Based Notification System - Quarterly Review** **System Performance Summary:** • Overall health: {{ system_health.title() if system_health else ''Unknown'' }} • Efficiency score: {{ efficiency_score if efficiency_score else ''Unknown'' }}% • Deployment status: {{ deployment_status.replace(''_'', '' '').title() if deployment_status else ''Unknown'' }} • System uptime: {{ ''Stable'' if is_state(''automation.device_health_monitor_optimized'', ''on'') else ''Issues Detected'' }} **Tag System Analytics:** • Critical devices monitored: {{ critical_devices }} • Total devices monitored: {{ total_devices if total_devices else ''Unknown'' }} • Tag categorization: {{ ''Working'' if states(''sensor.device_category_lookup'') == ''ready'' else ''Needs Review'' }} • Template sensors: {{ ''Healthy'' if states(''sensor.critical_devices_offline'') != ''unknown'' else ''Failed'' }} **Optimization Impact Analysis:** • Notification reduction: ~85-90% vs original system • User experience: {{ ''Significantly improved'' if efficiency_score and efficiency_score|int > 80 else ''Good but can improve'' }} • Watch spam elimination: ✅ Critical alerts only • Smart categorization: ✅ Tag-based flexibility **{{ quarter }} {{ year }} Review Checklist:** {% if system_health == ''excellent'' %} ✅ **Excellent Quarter** - System performing optimally {% elif system_health == ''good'' %} ✅ **Good Quarter** - System working well with minor opportunities {% elif system_health == ''fair'' %} ⚠️ **Fair Quarter** - System functional but needs optimization {% else %} 🚨 **Needs Attention** - System issues require investigation {% endif %} **Quarterly Action Items:** □ Review device categorization accuracy □ Analyze notification timing effectiveness □ Collect user feedback on notification quality □ Assess performance metrics trends □ Update documentation as needed □ Evaluate new feature opportunities □ Review tag system effectiveness □ Validate mobile app channel configuration **Strategic Recommendations:** {% if efficiency_score and efficiency_score|int > 90 %} • System is highly optimized - maintain current configuration • Consider advanced features like time-based categorization {% elif efficiency_score and efficiency_score|int > 75 %} • Good performance with room for fine-tuning • Review device tags for accuracy {% elif efficiency_score and efficiency_score|int > 60 %} • System working but needs optimization • Consider tag system refinements {% else %} • Performance issues - comprehensive review needed • Check for configuration problems or conflicts {% endif %} **Next Quarter Focus Areas:** • Tag system optimization based on usage patterns • Mobile app channel effectiveness review • User experience enhancement opportunities • Integration with other Home Assistant systems **Quarterly Review Meeting:** Schedule with system administrator **Next Review:** {{ (now() + timedelta(days=90)).strftime(''%B %Y'') }} ({{ ''Q1'' if now().month <= 3 else ''Q2'' if now().month <= 6 else ''Q3'' if now().month <= 9 else ''Q4'' }} {{ now().year if now().month <= 9 else now().year + 1 }}) ' notification_id: quarterly_system_review - service: notify.mobile_app_pixel_9_pro_xl data: title: 📊 Quarterly System Review message: '{{ quarter }} {{ year }} notification system review ready. Health: {{ system_health.title() if system_health else ''Unknown'' }} Schedule review meeting with administrator. ' data: channel: device_summaries priority: normal actions: - action: schedule_review title: Schedule Review - action: dismiss title: Later - id: dryer_started_detection_smartthings_v2 alias: Dryer - Detect Cycle Start (SmartThings) description: Detect when dryer starts a cycle using SmartThings sensors trigger: - platform: state entity_id: sensor.dryer_status_2 to: Running from: - Idle - Standby - Starting condition: - condition: state entity_id: input_boolean.dryer_running state: 'off' - condition: template value_template: '{{ states(''sensor.dryer_machine_state'') not in [''unknown'', ''unavailable''] }}' action: - service: input_boolean.turn_on entity_id: input_boolean.dryer_running - service: input_datetime.set_datetime entity_id: input_datetime.dryer_last_started data: datetime: '{{ now() }}' - service: input_text.set_value entity_id: input_text.dryer_state_reason data: value: 'Cycle started at {{ now().strftime(''%H:%M'') }} (SmartThings: {{ states(''sensor.dryer_machine_state'') }}/{{ states(''sensor.dryer_job_state'') }})' - service: input_boolean.turn_off entity_id: input_boolean.dryer_reminders_stopped - id: dryer_finished_detection_smartthings_v2 alias: Dryer - Detect Cycle Complete (SmartThings) description: Detect when dryer finishes a cycle using SmartThings sensors trigger: - platform: state entity_id: sensor.dryer_status_2 to: Complete for: minutes: '{{ states(''input_number.dryer_completion_delay_minutes'') | int(2) }}' condition: - condition: state entity_id: input_boolean.dryer_running state: 'on' - condition: template value_template: '{{ states(''sensor.dryer_machine_state'') not in [''unknown'', ''unavailable''] }}' action: - service: input_boolean.turn_off entity_id: input_boolean.dryer_running - service: input_datetime.set_datetime entity_id: input_datetime.dryer_last_finished data: datetime: '{{ now() }}' - service: input_text.set_value entity_id: input_text.dryer_state_reason data: value: 'Cycle completed at {{ now().strftime(''%H:%M'') }} (SmartThings: {{ states(''sensor.dryer_machine_state'') }}/{{ states(''sensor.dryer_job_state'') }})' - service: script.dryer_notify_complete - id: dryer_reminder_automation_smartthings_v2 alias: Dryer - Completion Reminders (SmartThings) description: Send periodic reminders when cycle is complete trigger: - platform: state entity_id: binary_sensor.dryer_cycle_complete to: 'on' for: minutes: 5 - platform: state entity_id: binary_sensor.dryer_cycle_complete to: 'on' for: minutes: 15 - platform: state entity_id: binary_sensor.dryer_cycle_complete to: 'on' for: minutes: 30 condition: - condition: state entity_id: input_boolean.dryer_reminders_stopped state: 'off' - condition: state entity_id: binary_sensor.dryer_cycle_complete state: 'on' action: - service: script.dryer_send_reminder - id: database_hourly_backup_peak alias: Database - Hourly Backup (Peak Hours) description: Create hourly backups during peak usage hours trigger: - platform: time_pattern minutes: '0' condition: - condition: time after: 07:00:00 before: '23:00:00' - condition: template value_template: '{{ (now().hour % 4) == 0 }}' action: - service: shell_command.database_backup - id: database_backup_retention_management alias: Database - Backup Retention Management description: Manage multiple backup retention schedules trigger: - platform: time at: 04:00:00 action: - service: shell_command.database_retention - id: error_scenario_test_orchestrator alias: 'Error Test: Main Orchestrator' description: Coordinates error scenario testing trigger: - platform: state entity_id: input_boolean.error_scenario_testing_active to: 'on' action: - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: Error scenario testing started at {{ now().strftime('%H:%M:%S') }} - service: logbook.log data: name: Error Test message: Starting error scenario testing suite - service: input_select.select_option target: entity_id: input_select.error_test_scenario data: option: Notification Failure - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.simulate_notification_failure - id: test_notification_failure_scenario alias: 'Error Test: Notification Failure Scenario' description: Tests system behavior when notifications fail trigger: - platform: state entity_id: input_boolean.simulate_notification_failure to: 'on' condition: - condition: state entity_id: input_boolean.error_scenario_testing_active state: 'on' action: - service: logbook.log data: name: Error Test message: Testing notification failure scenarios - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Mobile notification services: {{ states(''sensor.test_notification_availability'') }} ' - service: logbook.log data: name: Error Test message: Testing notification error handling - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Notification test: {{ ''PASS'' if states.notify else ''FAIL - No notification services'' }} ' - delay: 00:00:10 - service: input_boolean.turn_off target: entity_id: input_boolean.simulate_notification_failure - service: logbook.log data: name: Error Test message: Notification failure test completed - service: input_select.select_option target: entity_id: input_select.error_test_scenario data: option: Device Offline - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.simulate_device_offline - id: test_device_offline_scenario alias: 'Error Test: Device Offline Scenario' description: Tests system behavior when devices are offline trigger: - platform: state entity_id: input_boolean.simulate_device_offline to: 'on' condition: - condition: state entity_id: input_boolean.error_scenario_testing_active state: 'on' action: - service: logbook.log data: name: Error Test message: Testing device offline scenarios - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Device connectivity: {{ states(''sensor.test_device_connectivity_status'') }} ' - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Unavailable entities: {{ states | rejectattr(''entity_id'', ''match'', ''sensor.test_device_connectivity_status|sensor.error_test_status|input_text.error_test_results'') | selectattr(''state'', ''eq'', ''unavailable'') | list | length }} ' - service: logbook.log data: name: Error Test message: Testing automation resilience to device failures - delay: 00:00:10 - service: input_boolean.turn_off target: entity_id: input_boolean.simulate_device_offline - service: logbook.log data: name: Error Test message: Device offline test completed - service: input_select.select_option target: entity_id: input_select.error_test_scenario data: option: Sensor Unavailable - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.simulate_sensor_unavailable - id: test_sensor_unavailable_scenario alias: 'Error Test: Sensor Unavailable Scenario' description: Tests system behavior when sensors are unavailable trigger: - platform: state entity_id: input_boolean.simulate_sensor_unavailable to: 'on' condition: - condition: state entity_id: input_boolean.error_scenario_testing_active state: 'on' action: - service: logbook.log data: name: Error Test message: Testing sensor unavailable scenarios - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Sensor availability test: {{ ''PASS'' if states.sensor else ''FAIL - No sensors found'' }} ' - service: logbook.log data: name: Error Test message: Testing template sensor error resilience - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Problem sensors: {{ states.sensor | selectattr(''state'', ''in'', [''unknown'', ''unavailable'']) | list | length }} ' - delay: 00:00:10 - service: input_boolean.turn_off target: entity_id: input_boolean.simulate_sensor_unavailable - service: logbook.log data: name: Error Test message: Sensor unavailable test completed - service: input_select.select_option target: entity_id: input_select.error_test_scenario data: option: None - if: - condition: template value_template: '{{ has_value(''input_text.error_test_results'') }}' then: - service: input_text.set_value target: entity_id: input_text.error_test_results data: value: '{{ states(''input_text.error_test_results'') }} | Error scenario testing completed at {{ now().strftime(''%H:%M:%S'') }} ' - service: input_boolean.turn_off target: entity_id: input_boolean.error_scenario_testing_active - service: logbook.log data: name: Error Test message: All error scenario tests completed - id: continuous_error_monitoring alias: 'Error Test: Continuous Error Monitoring' description: Monitors for error conditions during normal operation trigger: - platform: time_pattern minutes: /30 condition: - condition: state entity_id: input_boolean.error_scenario_testing_active state: 'off' action: - service: shell_command.check_error_log_health continue_on_error: true - service: logbook.log data: name: Error Monitor message: '{% set all_entities = states | rejectattr(''entity_id'', ''match'', ''sensor.test_device_connectivity_status|sensor.error_test_status'') | list %} Entity health check: {{ all_entities | selectattr(''state'', ''eq'', ''unavailable'') | list | length }} unavailable, {{ all_entities | selectattr(''state'', ''eq'', ''unknown'') | list | length }} unknown entities ' - id: test_error_recovery_validation alias: 'Error Test: Recovery Validation' description: Validates that systems recover properly from error states trigger: - platform: state entity_id: group.all_devices from: unavailable to: 'on' - platform: state entity_id: group.all_devices from: unknown to: 'on' action: - service: logbook.log data: name: Error Recovery message: 'Device recovery detected: {{ trigger.entity_id }}' - delay: 00:00:30 - service: logbook.log data: name: Error Recovery message: Recovery validation completed for {{ trigger.entity_id }} - id: front_door_auto_relock alias: Front Door - Auto Relock (30s) description: Automatically relocks the front door after 30 seconds if the door is closed and still unlocked mode: restart trigger: - platform: state entity_id: lock.front_door from: locked to: unlocked condition: - condition: state entity_id: input_boolean.front_door_auto_relock_enabled state: 'on' action: - delay: seconds: '{{ states(''input_number.front_door_auto_relock_delay'') | int }}' - condition: state entity_id: lock.front_door state: unlocked - condition: state entity_id: binary_sensor.front_door_sensor_window_door_is_open state: 'off' - service: lock.lock target: entity_id: lock.front_door - service: notify.mobile_app_pixel_9_pro_xl data: title: 🔒 Door Auto-Locked message: Front door automatically relocked after {{ states('input_number.front_door_auto_relock_delay') | int }} seconds data: tag: door_auto_lock priority: high ttl: 0 channel: Security notification_icon: mdi:lock - service: system_log.write data: level: info message: Front door auto-relocked after {{ states('input_number.front_door_auto_relock_delay') | int }} seconds (door was closed and still unlocked) - id: front_door_unlocked_alarm alias: Front Door - Unlocked Too Long Alarm (5 min) description: Triggers alarm if front door remains unlocked for more than 5 minutes mode: single trigger: - platform: state entity_id: lock.front_door from: locked to: unlocked for: minutes: '{{ states(''input_number.front_door_alarm_delay'') | int }}' condition: - condition: state entity_id: input_boolean.front_door_alarm_enabled state: 'on' action: - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ SECURITY ALERT message: Front door has been UNLOCKED for over 5 minutes! data: tag: door_security_alert priority: high ttl: 0 channel: Security notification_icon: mdi:alert color: red actions: - action: LOCK_DOOR title: Lock Now - action: DISMISS title: Dismiss - service: notify.mobile_app_iphone data: title: ⚠️ SECURITY ALERT message: Front door has been UNLOCKED for over 5 minutes! data: push: sound: name: default critical: 1 volume: 1.0 continue_on_error: true - service: notify.alexa_media data: target: - media_player.kitchen_echo_show - media_player.living_room_echo - media_player.master_bedroom_echo message: Attention! The front door has been unlocked for more than 5 minutes. Please check the door. data: type: announce method: all continue_on_error: true - service: persistent_notification.create data: title: 🚨 Security Alert message: 'The front door has been unlocked for more than 5 minutes. Time unlocked: {{ relative_time(states.lock.front_door.last_changed) }} Door status: {{ states(''binary_sensor.front_door_sensor_window_door_is_open'') }} [Lock Door](/lovelace/security) ' notification_id: door_unlocked_alert - service: system_log.write data: level: warning message: 'SECURITY ALERT: Front door has been unlocked for over 5 minutes' - repeat: while: - condition: state entity_id: lock.front_door state: unlocked sequence: - delay: minutes: 2 - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ DOOR STILL UNLOCKED message: Front door remains unlocked! {{ relative_time(states.lock.front_door.last_changed) }} data: tag: door_security_alert_repeat priority: high ttl: 0 channel: Security notification_icon: mdi:alert color: red - service: notify.alexa_media data: target: - media_player.kitchen_echo_show message: Warning! The front door is still unlocked. data: type: announce continue_on_error: true - id: front_door_mobile_action_handler alias: Front Door - Mobile Action Handler description: Handles mobile app action responses for door security mode: single trigger: - platform: event event_type: mobile_app_notification_action event_data: action: LOCK_DOOR condition: [] action: - service: lock.lock target: entity_id: lock.front_door - service: notify.mobile_app_pixel_9_pro_xl data: title: ✅ Door Locked message: Front door has been locked remotely data: tag: door_locked_confirm priority: high ttl: 0 channel: Security notification_icon: mdi:lock-check - id: front_door_update_unlock_counter alias: Front Door - Update Unlock Counter description: Increment unlock counter when door is unlocked mode: single trigger: - platform: state entity_id: lock.front_door from: locked to: unlocked condition: - condition: state entity_id: input_boolean.front_door_activity_logging state: 'on' action: - service: input_number.increment target: entity_id: input_number.front_door_unlock_count_today - service: input_datetime.set_datetime target: entity_id: input_datetime.front_door_last_unlocked data: datetime: '{{ now() }}' - id: front_door_update_autolock_counter alias: Front Door - Update Auto-Lock Counter description: Increment auto-lock counter when door is auto-locked mode: single trigger: - platform: state entity_id: lock.front_door from: unlocked to: locked for: seconds: 1 condition: - condition: state entity_id: input_boolean.front_door_activity_logging state: 'on' - condition: state entity_id: input_boolean.front_door_auto_relock_enabled state: 'on' - condition: template value_template: "{% set last_unlocked = states('input_datetime.front_door_last_unlocked')\ \ %} {% if last_unlocked not in ['unknown', 'unavailable'] %}\n {% set time_since_unlock\ \ = (now() - (as_datetime(last_unlocked) | as_local)).total_seconds() %}\n \ \ {{ time_since_unlock <= 120 }}\n{% else %}\n false\n{% endif %}\n" action: - service: input_number.increment target: entity_id: input_number.front_door_auto_lock_count_today - service: input_datetime.set_datetime target: entity_id: input_datetime.front_door_last_locked data: datetime: '{{ now() }}' - id: front_door_update_alarm_counter alias: Front Door - Update Alarm Counter description: Increment alarm counter when door remains unlocked for alarm delay period mode: single trigger: - platform: state entity_id: lock.front_door from: locked to: unlocked for: minutes: '{{ states(''input_number.front_door_alarm_delay'') | int }}' condition: - condition: state entity_id: input_boolean.front_door_activity_logging state: 'on' - condition: state entity_id: input_boolean.front_door_alarm_enabled state: 'on' action: - service: input_number.increment target: entity_id: input_number.front_door_alarm_count_today - id: front_door_reset_daily_counters alias: Front Door - Reset Daily Counters description: Reset all daily counters at midnight mode: single trigger: - platform: time at: 00:00:00 action: - service: input_number.set_value target: entity_id: - input_number.front_door_unlock_count_today - input_number.front_door_auto_lock_count_today - input_number.front_door_alarm_count_today data: value: 0 - id: front_door_security_mode_handler alias: Front Door - Security Mode Handler description: Update individual settings when security mode changes mode: single trigger: - platform: state entity_id: input_select.front_door_security_mode action: - choose: - conditions: - condition: state entity_id: input_select.front_door_security_mode state: Full Security sequence: - service: input_boolean.turn_on target: entity_id: - input_boolean.front_door_auto_relock_enabled - input_boolean.front_door_alarm_enabled - input_boolean.front_door_notifications_enabled - conditions: - condition: state entity_id: input_select.front_door_security_mode state: Auto-Lock Only sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.front_door_auto_relock_enabled - service: input_boolean.turn_off target: entity_id: - input_boolean.front_door_alarm_enabled - input_boolean.front_door_notifications_enabled - conditions: - condition: state entity_id: input_select.front_door_security_mode state: Notifications Only sequence: - service: input_boolean.turn_off target: entity_id: - input_boolean.front_door_auto_relock_enabled - input_boolean.front_door_alarm_enabled - service: input_boolean.turn_on target: entity_id: input_boolean.front_door_notifications_enabled - conditions: - condition: state entity_id: input_select.front_door_security_mode state: Disabled sequence: - service: input_boolean.turn_off target: entity_id: - input_boolean.front_door_auto_relock_enabled - input_boolean.front_door_alarm_enabled - input_boolean.front_door_notifications_enabled - id: globe_g1_storage_full_notification alias: Globe G1 Storage Full - Alexa Notification description: Announces when litter box storage is full and needs emptying trigger: - platform: state entity_id: binary_sensor.globe_g1_storage_full to: 'on' for: minutes: 2 condition: - condition: state entity_id: input_boolean.globe_g1_notifications_enabled state: 'on' - condition: state entity_id: binary_sensor.globe_g1_notification_allowed state: 'on' - condition: not conditions: - condition: state entity_id: binary_sensor.night_mode_active state: 'on' action: - service: notify.alexa_media data: message: 'Attention! The Globe G1 litter box storage is full and needs to be emptied. Please empty the waste drawer as soon as possible to prevent odors and maintain proper operation. ' target: - media_player.everywhere data: type: announce - service: notify.mobile_app_pixel_9_pro_xl data: title: 🚨 Globe G1 Alert message: Litter box storage is FULL! Please empty waste drawer. data: priority: high notification_icon: mdi:delete-variant - service: notify.mobile_app_iphone data: title: 🚨 Globe G1 Alert - KRISTY message: Litter box storage is FULL! Please empty waste drawer. data: priority: high notification_icon: mdi:delete-variant include_watch: true actions: - action: globe_g1_empty title: Mark as Emptied - service: persistent_notification.create data: title: Globe G1 Storage Full message: The litter box storage needs to be emptied immediately. notification_id: globe_g1_storage_full - service: input_datetime.set_datetime target: entity_id: input_datetime.globe_g1_last_notification data: datetime: '{{ now() }}' - service: logbook.log data: name: Globe G1 Alerts message: Storage full notification sent - id: globe_g1_litter_low_notification alias: Globe G1 Litter Low - Alexa Notification description: Announces when litter level is low and needs refilling trigger: - platform: state entity_id: binary_sensor.globe_g1_litter_low to: 'on' for: minutes: 5 condition: - condition: state entity_id: input_boolean.globe_g1_notifications_enabled state: 'on' - condition: state entity_id: binary_sensor.globe_g1_notification_allowed state: 'on' - condition: not conditions: - condition: state entity_id: binary_sensor.night_mode_active state: 'on' action: - service: notify.alexa_media data: message: 'The Globe G1 litter box is running low on litter. Please refill the litter reservoir to ensure proper cleaning cycles. ' target: - media_player.everywhere data: type: announce - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ Globe G1 Alert message: Litter level is LOW! Please refill litter reservoir. data: priority: normal notification_icon: mdi:cup-water - service: notify.mobile_app_iphone data: title: ⚠️ Globe G1 Alert - KRISTY message: Litter level is LOW! Please refill litter reservoir. data: priority: normal notification_icon: mdi:cup-water include_watch: true actions: - action: globe_g1_refill title: Mark as Refilled - service: input_datetime.set_datetime target: entity_id: input_datetime.globe_g1_last_notification data: datetime: '{{ now() }}' - service: logbook.log data: name: Globe G1 Alerts message: Litter low notification sent - id: globe_g1_error_state_notification alias: Globe G1 Error State - Critical Alexa Notification description: Immediate notification when device enters error state trigger: - platform: state entity_id: sensor.globe_g1_status_derived to: Error condition: - condition: state entity_id: input_boolean.globe_g1_notifications_enabled state: 'on' action: - service: notify.alexa_media data: message: 'Critical Alert! The Globe G1 litter box has encountered an error and requires immediate attention. Please check the device and refer to the troubleshooting guide. ' target: - media_player.everywhere data: type: announce - service: notify.mobile_app_pixel_9_pro_xl data: title: 🚨 Globe G1 CRITICAL ERROR message: Device in ERROR state! Check immediately. data: priority: high notification_icon: mdi:alert-circle actions: - action: globe_g1_dashboard title: View Dashboard - service: notify.mobile_app_iphone data: title: 🚨 Globe G1 CRITICAL ERROR - KRISTY message: Device in ERROR state! Check immediately. data: priority: high notification_icon: mdi:alert-circle include_watch: true actions: - action: globe_g1_dashboard title: View Dashboard - service: persistent_notification.create data: title: Globe G1 Critical Error message: The litter box is in an error state and requires immediate attention. notification_id: globe_g1_error_state - service: input_datetime.set_datetime target: entity_id: input_datetime.globe_g1_last_notification data: datetime: '{{ now() }}' - service: logbook.log data: name: Globe G1 Alerts message: Critical error notification sent - id: globe_g1_track_cat_visits alias: Globe G1 Track Cat Visits description: Increment visit counter when cat is detected trigger: - platform: state entity_id: sensor.globe_g1_status_derived to: Cat Inside action: - service: input_number.increment target: entity_id: input_number.globe_g1_visits_today - service: logbook.log data: name: Globe G1 Usage message: Cat visit detected - daily counter incremented - id: globe_g1_track_cleaning_cycles alias: Globe G1 Track Cleaning Cycles description: Increment cycle counter when cleaning starts trigger: - platform: state entity_id: sensor.globe_g1_status_derived to: Processing Waste action: - service: input_number.increment target: entity_id: input_number.globe_g1_cycles_today - service: logbook.log data: name: Globe G1 Usage message: Cleaning cycle started - daily counter incremented - id: globe_g1_cleaning_cycle_complete alias: Globe G1 Cleaning Cycle Complete description: Log when cleaning cycle completes successfully trigger: - platform: state entity_id: sensor.globe_g1_status_derived from: Processing Waste to: Standby action: - service: logbook.log data: name: Globe G1 Operation message: Cleaning cycle completed successfully - id: globe_g1_handle_empty_storage alias: Globe G1 Handle Storage Emptied description: Process storage emptied button press trigger: - platform: state entity_id: button.globe_g1_empty_storage attribute: last_triggered action: - service: script.globe_g1_mark_storage_emptied - service: persistent_notification.dismiss data: notification_id: globe_g1_storage_full - id: globe_g1_handle_refill_litter alias: Globe G1 Handle Litter Refilled description: Process litter refilled button press trigger: - platform: state entity_id: button.globe_g1_refill_litter attribute: last_triggered action: - service: script.globe_g1_mark_litter_refilled - id: globe_g1_daily_reset alias: Globe G1 Daily Counter Reset description: Reset daily usage counters at specified time trigger: - platform: template value_template: '{{ now().strftime(''%H:%M:%S'') == states(''input_datetime.globe_g1_daily_reset'') }} ' action: - service: script.globe_g1_daily_reset - id: globe_g1_mobile_action_empty alias: Globe G1 Mobile Action - Mark Emptied description: Handle mobile app notification action to mark storage as emptied trigger: - platform: event event_type: mobile_app_notification_action event_data: action: globe_g1_empty action: - service: script.globe_g1_mark_storage_emptied - service: notify.mobile_app_iphone data: title: ✅ Globe G1 Updated message: Storage marked as emptied. Thank you! data: tag: globe_g1_confirm - id: globe_g1_mobile_action_refill alias: Globe G1 Mobile Action - Mark Refilled description: Handle mobile app notification action to mark litter as refilled trigger: - platform: event event_type: mobile_app_notification_action event_data: action: globe_g1_refill action: - service: script.globe_g1_mark_litter_refilled - service: notify.mobile_app_iphone data: title: ✅ Globe G1 Updated message: Litter marked as refilled. Thank you! data: tag: globe_g1_confirm - id: globe_g1_connection_lost alias: Globe G1 Connection Lost description: Alert when device goes offline for extended period trigger: - platform: state entity_id: sensor.globe_g1_status_derived to: unavailable for: minutes: 30 condition: - condition: state entity_id: input_boolean.globe_g1_notifications_enabled state: 'on' action: - service: notify.mobile_app_pixel_9_pro_xl data: title: 📶 Globe G1 Offline message: Litter box has been offline for 30+ minutes. Check WiFi connection. data: priority: normal notification_icon: mdi:wifi-off - service: notify.mobile_app_iphone data: title: 📶 Globe G1 Offline - KRISTY message: Litter box has been offline for 30+ minutes. Check WiFi connection. data: priority: normal notification_icon: mdi:wifi-off include_watch: false - service: logbook.log data: name: Globe G1 Connection message: Device offline for 30+ minutes - notification sent - id: globe_g1_connection_restored alias: Globe G1 Connection Restored description: Confirm when device comes back online trigger: - platform: state entity_id: sensor.globe_g1_status_derived from: unavailable condition: - condition: template value_template: '{{ trigger.to_state and trigger.to_state.state is not none and trigger.to_state.state != ''unavailable'' }}' action: - service: logbook.log data: name: Globe G1 Connection message: 'Device connection restored - status: {{ trigger.to_state.state if trigger.to_state and trigger.to_state.state is not none else ''unknown'' }}' - id: globe_g1_maintenance_reminder alias: Globe G1 Maintenance Reminder description: Remind when scheduled maintenance is due trigger: - platform: time at: 09:00:00 condition: - condition: template value_template: "{% set next_maintenance = states('input_datetime.globe_g1_next_maintenance')\ \ %} {% if next_maintenance not in ['unknown', 'unavailable'] %}\n {{ as_timestamp(next_maintenance)\ \ <= as_timestamp(now()) }}\n{% else %}\n false\n{% endif %}\n" - condition: state entity_id: input_boolean.globe_g1_notifications_enabled state: 'on' action: - service: notify.alexa_media data: message: Scheduled maintenance is due for the Globe G1 litter box. Please perform routine cleaning and inspection. target: - media_player.everywhere data: type: announce - service: notify.mobile_app_pixel_9_pro_xl data: title: 🔧 Globe G1 Maintenance message: Scheduled maintenance is due. Perform routine cleaning. data: priority: normal notification_icon: mdi:wrench-clock - service: notify.mobile_app_iphone data: title: 🔧 Globe G1 Maintenance - KRISTY message: Scheduled maintenance is due. Perform routine cleaning. data: priority: normal notification_icon: mdi:wrench-clock include_watch: false - id: system_health_status_reporter alias: System Health - Status Reporter description: Report system health status every hour trigger: - platform: time_pattern minutes: 0 condition: - condition: time after: 08:00:00 before: '22:00:00' action: - service: logbook.log data: name: System Health Report message: 'System Status: {{ states(''sensor.appliance_system_status'') | default(''Unknown'') }} Integration Health: {{ states(''sensor.integration_health_status'') | default(''Unknown'') }} Health %: {{ states(''sensor.integration_health_percentage'') | default(''Unknown'') }}% Unavailable: {{ states(''sensor.unavailable_entities'') | default(''Unknown'') }} PitBoss: {{ states(''sensor.pitboss_grill_status'') | default(''Unknown'') }} Prusa Mini: {{ states(''sensor.prusa_mini_printer_status'') | default(''Unknown'') }} Bluetooth Sensors: {{ states(''sensor.bluetooth_sensor_status'') | default(''Unknown'') }} Alexa: {{ states(''media_player.everywhere'') | default(''Unknown'') }} ' - id: health_monitor_critical_integration_health_drop alias: Health Monitor - Critical Integration Health Drop description: Monitor for significant drops in integration health trigger: - platform: numeric_state entity_id: sensor.integration_health_percentage below: 90 for: minutes: 5 condition: - condition: time after: 08:00:00 before: '22:00:00' action: - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ Integration Health Drop message: 'System health dropped to {{ states(''sensor.integration_health_percentage'') }}%. Check {{ states(''sensor.unavailable_entities'') }} unavailable entities. ' data: priority: high - id: critical_system_failure_alert alias: System Health - Critical Failure Alert description: Alert when critical systems fail trigger: - platform: state entity_id: binary_sensor.system_health_ok to: 'off' for: minutes: 5 action: - service: notify.mobile_app_pixel_9_pro_xl data: title: 🚨 CRITICAL SYSTEM FAILURE message: 'Multiple critical integrations have failed. Check Settings > Devices & Services immediately. ' data: priority: high importance: max - service: logbook.log data: name: CRITICAL FAILURE message: Critical integration failures detected - id: tuya_connection_monitor alias: Monitor Tuya Connection Health description: Monitor Tuya device connectivity and log health status trigger: - platform: time_pattern minutes: /30 condition: - condition: template value_template: '{{ states.sensor | selectattr(''entity_id'', ''search'', ''tuya'') | list | length > 0 }}' action: - service: system_log.write data: message: 'Tuya devices: {{ states.sensor | selectattr(''entity_id'', ''search'', ''tuya'') | selectattr(''state'', ''ne'', ''unavailable'') | list | length }} online' level: info - id: environmental_schedule_controller alias: 'Environmental Systems: Schedule Controller' description: 'New grow fertigation schedule: 2 times daily (8 PM and 4 AM)' mode: single trigger: - platform: time at: 04:00:00 id: morning_fertigation - platform: time at: '20:00:00' id: evening_fertigation action: - service: input_boolean.turn_on target: entity_id: input_boolean.waste_pump_enabled - service: input_boolean.turn_on target: entity_id: input_boolean.hydroponics_active_period - event: hydroponics_fertigation event_data: type: '{{ ''morning_fertigation'' if trigger.id == ''morning_fertigation'' else ''evening_fertigation'' }}' - id: environmental_hydroponics_management alias: 'Environmental Systems: Hydroponics Management' description: Event-driven hydroponics management with performance optimization mode: queued max: 3 trigger: - platform: event event_type: hydroponics_fertigation id: fertigation_event - platform: state entity_id: input_boolean.waste_pump_enabled to: 'on' id: waste_pump_on - platform: state entity_id: input_boolean.waste_pump_enabled to: 'off' id: waste_pump_off - platform: numeric_state entity_id: sensor.wroommicrousb_reservoir_current_volume below: 5 for: 00:05:00 id: low_water - platform: numeric_state entity_id: sensor.wroommicrousb_reservoir_water_temp above: 30 for: 00:02:00 id: high_temp - platform: numeric_state entity_id: sensor.wroommicrousb_reservoir_water_temp below: 5 for: 00:02:00 id: low_temp condition: - condition: or conditions: - condition: template value_template: '{{ states(''switch.tp_link_smart_plug_c82e_feed_pump'') not in [''unavailable'', ''unknown'', ''''] }} ' - condition: trigger id: - low_water - high_temp - low_temp action: - variables: current_volume: '{{ states(''sensor.wroommicrousb_reservoir_current_volume'') | float(50) }}' current_temp: '{{ states(''sensor.wroommicrousb_reservoir_water_temp'') | float(20) }}' feed_pump_duration: '{{ states(''input_number.hydroponics_feed_pump_duration'') | int(15) }}' - choose: - conditions: - condition: trigger id: fertigation_event sequence: - service: script.environmental_run_fertigation_cycle data: duration: '{{ feed_pump_duration }}' cycle_type: '{{ trigger.event.data.type }}' - service: system_log.write data: message: 'New grow fertigation cycle completed: {{ trigger.event.data.type }}' level: info - conditions: - condition: trigger id: waste_pump_on sequence: - service: switch.turn_on target: entity_id: switch.tp_link_smart_plug_c82e_waste_pump - conditions: - condition: trigger id: waste_pump_off sequence: - service: switch.turn_off target: entity_id: switch.tp_link_smart_plug_c82e_waste_pump - service: input_boolean.turn_off target: entity_id: input_boolean.hydroponics_active_period - conditions: - condition: trigger id: low_water sequence: - service: script.turn_on target: entity_id: script.send_system_notification data: variables: system_name: Hydroponics status_type: warning status_message: 'Low water level detected: {{ current_volume }}L' - conditions: - condition: trigger id: - high_temp - low_temp sequence: - service: script.turn_on target: entity_id: script.send_system_notification data: variables: system_name: Hydroponics status_type: warning status_message: 'Temperature alert: {{ current_temp }}°C' - conditions: - condition: trigger id: schedule_trigger sequence: - if: - condition: state entity_id: input_boolean.hydroponics_active_period state: 'on' then: - event: hydroponics_fertigation_trigger event_data: cycle_type: '{{ [''morning'', ''midday'', ''afternoon'', ''evening'', ''final''][((now().hour - 9) / 3) | int] if now().hour >= 9 else ''morning'' }}' duration: '{{ feed_pump_duration }}' default: [] - id: environmental_fertigation_handler alias: Environmental Fertigation Handler description: Handle fertigation events from event-driven scheduler triggers: - trigger: event event_type: hydroponics_fertigation_trigger id: fertigation_event variables: volume_available: '{{ states(''sensor.wroommicrousb_reservoir_current_volume'') not in [''unavailable'', ''unknown'', ''''] }}' current_volume: '{{ states(''sensor.wroommicrousb_reservoir_current_volume'') | float(0) }}' temp_available: '{{ states(''sensor.wroommicrousb_reservoir_water_temp'') not in [''unavailable'', ''unknown'', ''''] }}' current_temp: '{{ states(''sensor.wroommicrousb_reservoir_water_temp'') | float(0) }}' feed_pump_duration: '{{ states(''input_number.feed_pump_duration'') | int(20) }}' action: - service: system_log.write data: message: 'Hydroponics: {{ trigger.event.data.cycle_type }} fertigation starting - Water: {% if volume_available %}{{ current_volume }}L{% else %}sensor unavailable (proceeding){% endif %}, Temp: {% if temp_available %}{{ current_temp }}°C{% else %}sensor unavailable{% endif %} ' level: info - if: - condition: template value_template: '{{ volume_available and current_volume < 10 }}' then: - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ Hydroponics Low Water message: 'Warning: Reservoir water level is low ({{ current_volume }}L). Fertigation will continue but please refill soon. ' data: channel: hydroponics_alerts tag: hydro_low_water - if: - condition: template value_template: '{{ not volume_available or not temp_available }}' then: - service: persistent_notification.create data: title: ⚠️ Hydroponics Sensor Warning message: 'Fertigation proceeding with sensor issues: {% if not volume_available %}• Water level sensor unavailable{% endif %} {% if not temp_available %}• Temperature sensor unavailable{% endif %} Check sensor connectivity. ' notification_id: hydro_sensor_warning - service: script.environmental_run_fertigation_cycle data: duration: '{{ trigger.event.data.duration }}' cycle_type: '{{ trigger.event.data.cycle_type }}' - service: counter.increment target: entity_id: counter.environmental_optimized_triggers mode: single - id: environmental_safety_alerts alias: Environmental Safety Alerts description: Handle critical safety alerts for environmental systems triggers: - trigger: numeric_state entity_id: sensor.wroommicrousb_reservoir_current_volume below: 5.0 for: 00:01:00 id: low_water - trigger: numeric_state entity_id: sensor.wroommicrousb_reservoir_water_temp above: 30 for: 00:02:00 id: high_temp - trigger: numeric_state entity_id: sensor.wroommicrousb_reservoir_water_temp below: 5 for: 00:02:00 id: low_temp action: - choose: - conditions: - condition: trigger id: low_water sequence: - service: notify.mobile_app_pixel_9_pro_xl data: message: 'WARNING: Reservoir water level is critically low ({{ states(''sensor.wroommicrousb_reservoir_current_volume'') }}L)! Add water immediately.' title: Hydroponics Low Water Alert data: priority: high channel: hydroponics_alerts tag: hydro_low_water - service: switch.turn_off target: entity_id: switch.tp_link_smart_plug_c82e_feed_pump - service: persistent_notification.create data: title: Hydroponics System Alert message: Low water level detected at {{ now().strftime('%Y-%m-%d %H:%M') }}. Fertigation pump disabled for safety. notification_id: hydro_low_water - conditions: - condition: trigger id: high_temp sequence: - service: notify.mobile_app_pixel_9_pro_xl data: message: 'WARNING: Reservoir water temperature is too high ({{ states(''sensor.wroommicrousb_reservoir_water_temp'') }}°C)! Check cooling system.' title: Hydroponics High Temp Alert data: priority: high channel: hydroponics_alerts tag: hydro_high_temp - conditions: - condition: trigger id: low_temp sequence: - service: notify.mobile_app_pixel_9_pro_xl data: message: 'WARNING: Reservoir water temperature is too low ({{ states(''sensor.wroommicrousb_reservoir_water_temp'') }}°C)! Check heating system.' title: Hydroponics Low Temp Alert data: priority: high channel: hydroponics_alerts tag: hydro_low_temp default: [] mode: single - id: environmental_grow_light_scheduler alias: Environmental Grow Light Scheduler description: Event-driven grow light control to replace time-based triggers triggers: - trigger: time at: 06:00:00 id: daily_schedule condition: - condition: state entity_id: input_boolean.environmental_systems_enabled state: 'on' action: - event: environmental_grow_lights_control event_data: action: 'on' schedule_time: 07:00:00 - event: environmental_grow_lights_control event_data: action: 'off' schedule_time: '19:00:00' mode: single - id: environmental_grow_light_handler alias: Environmental Grow Light Handler description: Handle grow light events from scheduler triggers: - trigger: event event_type: environmental_grow_lights_control id: grow_light_event action: - wait_template: '{{ now().strftime(''%H:%M:%S'') == trigger.event.data.schedule_time }}' timeout: 01:00:00 continue_on_timeout: false - choose: - conditions: - condition: template value_template: '{{ trigger.event.data.action == ''on'' }}' sequence: - service: switch.turn_on target: label_id: grow_lights - service: system_log.write data: message: 'Environmental: Grow lights turned on via event scheduler' level: info - conditions: - condition: template value_template: '{{ trigger.event.data.action == ''off'' }}' sequence: - service: switch.turn_off target: label_id: grow_lights - service: system_log.write data: message: 'Environmental: Grow lights turned off via event scheduler' level: info mode: queued max: 5 - id: integration_test_orchestrator alias: 'Integration Test: Main Orchestrator' description: Coordinates cross-domain integration testing trigger: - platform: state entity_id: input_boolean.integration_testing_active to: 'on' action: - service: input_text.set_value target: entity_id: input_text.integration_test_results data: value: Integration testing started at {{ now().strftime('%H:%M:%S') }} - service: logbook.log data: name: Integration Test message: Starting cross-domain integration tests - service: input_boolean.turn_on target: entity_id: input_boolean.test_appliance_lighting_coordination - id: test_appliance_lighting_coordination alias: 'Integration Test: Appliance-Lighting Coordination' description: Tests that appliance events properly trigger lighting responses trigger: - platform: state entity_id: input_boolean.test_appliance_lighting_coordination to: 'on' condition: - condition: state entity_id: input_boolean.integration_testing_active state: 'on' action: - service: logbook.log data: name: Integration Test message: Testing appliance-lighting coordination - service: logbook.log data: name: Integration Test message: Simulating dishwasher completion event - service: input_text.set_value target: entity_id: input_text.integration_test_results data: value: '{{ states(''input_text.integration_test_results'') }} | Pre-test Kitchen lights: {{ states(''light.kitchen_lights'') if states(''light.kitchen_lights'') != ''unknown'' else ''N/A'' }} ' - delay: 00:00:15 - service: input_text.set_value target: entity_id: input_text.integration_test_results data: value: '{{ states(''input_text.integration_test_results'') }} | Post-event Kitchen lights: {{ states(''light.kitchen_lights'') if states(''light.kitchen_lights'') != ''unknown'' else ''N/A'' }} ' - service: input_boolean.turn_off target: entity_id: input_boolean.test_appliance_lighting_coordination - service: logbook.log data: name: Integration Test message: Appliance-lighting coordination test completed - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.test_environmental_notification_flow - id: test_environmental_notification_flow alias: 'Integration Test: Environmental Notification Flow' description: Tests environmental automation notification delivery trigger: - platform: state entity_id: input_boolean.test_environmental_notification_flow to: 'on' condition: - condition: state entity_id: input_boolean.integration_testing_active state: 'on' action: - service: logbook.log data: name: Integration Test message: Testing environmental notification flow - service: input_text.set_value target: entity_id: input_text.integration_test_results data: value: "{{ states('input_text.integration_test_results') }} | Notification services\ \ available: {% if states.notify %}\n {{ states.notify | list | length }}\ \ services\n{% else %}\n 0 services\n{% endif %}\n" - service: logbook.log data: name: Integration Test message: Simulating environmental alert scenario - service: input_text.set_value target: entity_id: input_text.integration_test_results data: value: '{{ states(''input_text.integration_test_results'') }} | Mobile notification test: {{ ''Available'' if ''notify.mobile_app'' in states.notify else ''Not configured'' }} ' - delay: 00:00:10 - service: input_boolean.turn_off target: entity_id: input_boolean.test_environmental_notification_flow - service: logbook.log data: name: Integration Test message: Environmental notification flow test completed - service: input_text.set_value target: entity_id: input_text.integration_test_results data: value: '{{ states(''input_text.integration_test_results'') }} | Integration testing completed at {{ now().strftime(''%H:%M:%S'') }} ' - service: input_boolean.turn_off target: entity_id: input_boolean.integration_testing_active - service: logbook.log data: name: Integration Test message: All integration tests completed successfully - id: test_cross_domain_dependencies alias: 'Integration Test: Cross-Domain Dependencies' description: Validates that domain packages can communicate with each other trigger: - platform: time at: 03:30:00 condition: - condition: state entity_id: input_boolean.integration_testing_active state: 'off' action: - service: logbook.log data: name: Integration Test message: Running automated dependency validation - service: logbook.log data: name: Integration Test message: Cross-domain entity validation simulated - {{ states | length }} total entities validated - service: shell_command.validate_automation_conflicts - id: lighting_scheduler alias: Lighting Scheduler - Phase 3 Optimized description: Single daily scheduler that fires events to replace multiple time-based triggers triggers: - trigger: time at: 00:00:00 id: daily_schedule condition: - condition: state entity_id: input_boolean.lighting_scheduler_enabled state: 'on' action: - event: lighting_schedule_trigger event_data: task_type: morning_startup schedule_time: 07:00:00 - event: lighting_schedule_trigger event_data: task_type: evening_lighting schedule_time: '19:00:00' - event: lighting_schedule_trigger event_data: task_type: zwave_night_mode schedule_time: '22:00:00' - event: lighting_schedule_trigger event_data: task_type: night_lighting schedule_time: '23:00:00' - event: lighting_schedule_trigger event_data: task_type: zwave_day_mode schedule_time: 07:00:00 mode: single - id: lighting_manual_override_handler alias: 'Lighting: Manual Override Handler' description: Handle manual lighting changes and set override state trigger: - platform: state entity_id: - light.kitchen_led_strips - light.rgbcw_lightbulb1 - light.rgbcw_lightbulb2 - light.rgbcw_lightbulb3 - light.rgbcw_lightbulb4 - light.rgbcw_lightbulb5 - light.rgbcw_lightbulb6 - light.rgbcw_lightbulb7 - light.rgbcw_lightbulb8 - light.rgbcw_lightbulb9 - light.rgbcw_lightbulb10 - light.rgbcw_lightbulb11 attribute: brightness - platform: state entity_id: - light.kitchen_led_strips - light.rgbcw_lightbulb1 - light.rgbcw_lightbulb2 - light.rgbcw_lightbulb3 - light.rgbcw_lightbulb4 - light.rgbcw_lightbulb5 - light.rgbcw_lightbulb6 - light.rgbcw_lightbulb7 - light.rgbcw_lightbulb8 - light.rgbcw_lightbulb9 - light.rgbcw_lightbulb10 - light.rgbcw_lightbulb11 attribute: color_temp condition: - condition: template value_template: "{{ trigger.to_state.context.user_id is not none or\n trigger.to_state.context.parent_id\ \ is not none }}\n" action: - service: input_boolean.turn_on target: entity_id: input_boolean.manual_lighting_override - service: system_log.write data: message: 'Manual lighting override detected: {{ trigger.entity_id }}' level: info mode: parallel - id: scheduled_lights_control alias: 'Lighting: Scheduled Light Control' description: Controls all scheduled lights based on time with enhanced error handling trigger: - platform: event event_type: lighting_schedule_trigger event_data: task_type: morning_startup id: morning - platform: event event_type: lighting_schedule_trigger event_data: task_type: evening_lighting id: evening - platform: event event_type: lighting_schedule_trigger event_data: task_type: night_lighting id: night - event: sunset id: sunset platform: sun - event: sunrise id: sunrise offset: +00:15:00 platform: sun - platform: template value_template: '{{ now().strftime(''%H:%M'') == states(''input_datetime.grow_lights_winter_on_time'')[0:5] }}' id: winter_on - platform: template value_template: '{{ now().strftime(''%H:%M'') == states(''input_datetime.grow_lights_winter_off_time'')[0:5] }}' id: winter_off condition: - condition: template value_template: '{{ states(''sun.sun'') not in [''unavailable'', ''unknown'', ''''] }} ' action: - choose: - conditions: - condition: trigger id: morning sequence: - target: label_id: morning_lights_2 data: brightness_pct: 80 service: light.turn_on - service: script.led_strips_rf_power_on data: {} - service: persistent_notification.create data: title: Good Morning message: All morning lights and kitchen LED strips activated at {{ now().strftime('%H:%M') }}. notification_id: morning_lights - conditions: - condition: trigger id: evening sequence: [] - conditions: - condition: trigger id: night sequence: - target: label_id: night_lights_2 service: light.turn_off - service: script.led_strips_rf_power_off data: {} - service: persistent_notification.create data: title: Good Night message: Night lights and kitchen LED strips turned off at {{ now().strftime('%H:%M') }}. notification_id: night_lights - conditions: - condition: trigger id: sunset sequence: - target: entity_id: light.porch_light data: brightness_pct: 80 service: light.turn_on - target: entity_id: light.hall_light data: brightness_pct: 70 service: light.turn_on - target: entity_id: switch.tp_link_smart_plug_5e5b_walkway service: switch.turn_on - condition: state entity_id: input_boolean.grow_lights_winter_override state: 'off' - target: label_id: grow_lights service: switch.turn_off - conditions: - condition: trigger id: sunrise sequence: - target: entity_id: light.porch_light service: light.turn_off - target: entity_id: light.hall_light service: light.turn_off - target: entity_id: switch.tp_link_smart_plug_5e5b_walkway service: switch.turn_off - condition: state entity_id: input_boolean.grow_lights_winter_override state: 'off' - target: label_id: grow_lights service: switch.turn_on - conditions: - condition: trigger id: winter_on - condition: state entity_id: input_boolean.grow_lights_winter_override state: 'on' sequence: - target: label_id: grow_lights service: switch.turn_on - service: persistent_notification.create data: title: Winter Grow Lights message: Grow lights activated at {{ now().strftime('%H:%M') }} (Winter Schedule). notification_id: winter_grow_lights_on - conditions: - condition: trigger id: winter_off - condition: state entity_id: input_boolean.grow_lights_winter_override state: 'on' sequence: - target: label_id: grow_lights service: switch.turn_off - service: persistent_notification.create data: title: Winter Grow Lights message: Grow lights deactivated at {{ now().strftime('%H:%M') }} (Winter Schedule). notification_id: winter_grow_lights_off - service: system_log.write data: message: Light schedule triggered at {{ now().strftime('%Y-%m-%d %H:%M:%S') }} by {{ trigger.id }} level: info - if: - condition: trigger id: - morning - evening - night then: - service: counter.increment target: entity_id: counter.lighting_optimized_triggers mode: single - id: led_strips_button_power_on alias: LED Strips Button - Power On description: Activates LED strips via RF remote when power on button is pressed trigger: - platform: state entity_id: input_button.led_strips_power_on condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_power_on - id: led_strips_button_power_off alias: LED Strips Button - Power Off description: Deactivates LED strips via RF remote when power off button is pressed trigger: - platform: state entity_id: input_button.led_strips_power_off condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_power_off - id: led_strips_button_brightness_up alias: LED Strips Button - Brightness Up description: Increases LED strip brightness via RF remote and updates brightness tracking trigger: - platform: state entity_id: input_button.led_strips_brightness_up condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_brightness_up - id: led_strips_button_brightness_down alias: LED Strips Button - Brightness Down description: Decreases LED strip brightness via RF remote and updates brightness tracking trigger: - platform: state entity_id: input_button.led_strips_brightness_down condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_brightness_down - id: led_strips_button_warmer alias: LED Strips Button - Warmer description: Makes LED strips warmer color temperature via RF remote trigger: - platform: state entity_id: input_button.led_strips_warmer condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_warmer - id: led_strips_button_cooler alias: LED Strips Button - Cooler description: Makes LED strips cooler color temperature via RF remote trigger: - platform: state entity_id: input_button.led_strips_cooler condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_cooler - id: led_strips_button_warm_white alias: LED Strips Button - Warm White description: Sets LED strips to warm white preset color via RF remote trigger: - platform: state entity_id: input_button.led_strips_warm_white condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_warm_white - id: led_strips_button_neutral_white alias: LED Strips Button - Neutral White description: Sets LED strips to neutral white preset color via RF remote trigger: - platform: state entity_id: input_button.led_strips_neutral_white condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_neutral_white - id: led_strips_button_cool_white alias: LED Strips Button - Cool White description: Sets LED strips to cool white preset color via RF remote trigger: - platform: state entity_id: input_button.led_strips_cool_white condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_cool_white - id: led_strips_morning_startup alias: LED Strips - Morning Startup description: Automatically turn on LED strips every morning at 7 AM with adaptive lighting trigger: - platform: event event_type: lighting_schedule_trigger event_data: task_type: morning_startup condition: - condition: state entity_id: remote.rm4_pro state: 'on' action: - service: script.led_strips_rf_power_on - service: counter.increment target: entity_id: counter.lighting_optimized_triggers - id: led_strips_manual_override_detection alias: LED Strips - Manual Override Detection description: Detect when LED strips are manually controlled via RF remote and temporarily disable adaptive lighting trigger: - platform: state entity_id: - input_number.led_strips_brightness_level - input_number.led_strips_color_temp condition: - condition: template value_template: '{{ trigger.to_state.context.user_id is not none }}' - condition: state entity_id: input_boolean.led_strips_power_status state: 'on' action: - service: input_boolean.turn_on target: entity_id: input_boolean.manual_lighting_override - service: system_log.write data: message: LED strips manual override detected level: info mode: restart - id: zwave_led_night_mode_on alias: Z-Wave LEDs - Night Mode On description: Turns off selected Z-Wave switch LEDs at night (10 PM) trigger: - platform: event event_type: lighting_schedule_trigger event_data: task_type: zwave_night_mode action: - repeat: for_each: - light.hobby_light - light.gavin_light - light.pantry_light - light.master_light - light.nook_light - light.guest_light - light.porch_light - light.hall_light - light.linda_light sequence: - variables: light_entity: '{{ repeat.item }}' input_boolean_entity: input_boolean.zwave_led_darken_{{ repeat.item.split('.')[1] }} - if: - condition: template value_template: '{{ is_state(input_boolean_entity, ''on'') }}' - condition: template value_template: '{{ states(light_entity) not in [''unavailable'', ''unknown''] }}' then: - service: zwave_js.set_config_parameter target: entity_id: '{{ light_entity }}' data: parameter: 7 value: 0 continue_on_error: true - repeat: for_each: - fan.hobby_fan - fan.master_fan - fan.linda_fan - fan.guest_fan - fan.gavin_fan sequence: - variables: fan_entity: '{{ repeat.item }}' input_boolean_entity: input_boolean.zwave_led_darken_{{ repeat.item.split('.')[1] }} - if: - condition: template value_template: '{{ is_state(input_boolean_entity, ''on'') }}' - condition: template value_template: '{{ states(fan_entity) not in [''unavailable'', ''unknown''] }}' then: - service: zwave_js.set_config_parameter target: entity_id: '{{ fan_entity }}' data: parameter: 3 value: 0 continue_on_error: true - service: counter.increment target: entity_id: counter.lighting_optimized_triggers - id: zwave_led_day_mode_on alias: Z-Wave LEDs - Day Mode On description: Restores Z-Wave switch LEDs to normal operation (7 AM) trigger: - platform: event event_type: lighting_schedule_trigger event_data: task_type: zwave_day_mode action: - service: logbook.log data: name: Z-Wave LED Day Mode message: Starting LED restoration for available devices - repeat: for_each: - light.hobby_light - light.gavin_light - light.pantry_light - light.master_light - light.nook_light - light.guest_light - light.porch_light - light.hall_light - light.linda_light sequence: - variables: light_entity: '{{ repeat.item }}' - if: - condition: template value_template: '{{ states(light_entity) not in [''unavailable'', ''unknown''] }}' then: - service: zwave_js.set_config_parameter target: entity_id: '{{ light_entity }}' data: parameter: 7 value: 1 continue_on_error: true - service: logbook.log data: name: Z-Wave LED message: Restored LED for {{ light_entity }} else: - service: logbook.log data: name: Z-Wave LED message: 'Skipped unavailable device: {{ light_entity }}' - repeat: for_each: - fan.hobby_fan - fan.master_fan - fan.linda_fan - fan.guest_fan - fan.gavin_fan sequence: - variables: fan_entity: '{{ repeat.item }}' - if: - condition: template value_template: '{{ states(fan_entity) not in [''unavailable'', ''unknown''] }}' then: - service: zwave_js.set_config_parameter target: entity_id: '{{ fan_entity }}' data: parameter: 3 value: 1 continue_on_error: true - service: logbook.log data: name: Z-Wave LED message: Restored LED for {{ fan_entity }} else: - service: logbook.log data: name: Z-Wave LED message: 'Skipped unavailable device: {{ fan_entity }}' - service: counter.increment target: entity_id: counter.lighting_optimized_triggers - id: zwave_led_manual_control alias: Z-Wave LEDs - Manual Control description: Immediately applies LED changes when manual toggles are changed during night hours trigger: - platform: state entity_id: - input_boolean.zwave_led_darken_hobby_light - input_boolean.zwave_led_darken_gavin_light - input_boolean.zwave_led_darken_pantry_light - input_boolean.zwave_led_darken_master_light - input_boolean.zwave_led_darken_nook_light - input_boolean.zwave_led_darken_guest_light - input_boolean.zwave_led_darken_porch_light - input_boolean.zwave_led_darken_hall_light - input_boolean.zwave_led_darken_dining_light - input_boolean.zwave_led_darken_linda_light - input_boolean.zwave_led_darken_hobby_fan - input_boolean.zwave_led_darken_master_fan - input_boolean.zwave_led_darken_linda_fan - input_boolean.zwave_led_darken_guest_fan - input_boolean.zwave_led_darken_gavin_fan condition: - condition: time after: '22:00:00' before: 07:00:00 action: - service: script.zwave_led_apply_setting data: input_boolean: '{{ trigger.entity_id }}' new_state: '{{ trigger.to_state.state if trigger.to_state else ''unknown'' }}' mode: parallel max: 20 - id: lighting_zwave_led_preset_handler alias: Z-Wave LED - Preset Handler description: Applies LED presets when input_select changes trigger: - platform: state entity_id: input_select.zwave_led_night_mode_preset action: - service: script.zwave_led_apply_preset data: preset: '{{ trigger.to_state.state if trigger.to_state else ''unknown'' }}' mode: single - id: zwave_led_night_mode_coordination alias: 'Lighting: Z-Wave LED Night Mode Coordination' description: Coordinate Z-Wave LED night mode with adaptive lighting trigger: - platform: state entity_id: binary_sensor.night_mode_active condition: - condition: template value_template: '{{ trigger.from_state.state != trigger.to_state.state }}' action: - choose: - conditions: - condition: state entity_id: binary_sensor.night_mode_active state: 'on' sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.sleep_mode - service: persistent_notification.create data: title: Night Mode Active message: Night mode is now active. LED indicators dimmed and adaptive lighting in sleep mode. notification_id: zwave_led_night_mode - conditions: - condition: state entity_id: binary_sensor.night_mode_active state: 'off' sequence: - service: input_boolean.turn_off target: entity_id: input_boolean.sleep_mode - service: persistent_notification.create data: title: Day Mode Active message: Day mode is now active. Normal lighting restored. notification_id: zwave_led_day_mode - delay: 00:05:00 - service: persistent_notification.dismiss data: notification_id: zwave_led_day_mode - id: lighting_zwave_led_night_mode_notifications alias: Z-Wave LED - Night Mode Notifications description: Provides notifications when night mode begins/ends trigger: - platform: state entity_id: binary_sensor.night_mode_active condition: - condition: template value_template: '{{ trigger.from_state.state != trigger.to_state.state }}' action: - choose: - conditions: - condition: state entity_id: binary_sensor.night_mode_active state: 'on' sequence: - service: persistent_notification.create data: title: Z-Wave LED Night Mode message: Night mode is now active (10 PM - 7 AM). Selected LED indicators will be turned off. notification_id: zwave_led_night_mode - conditions: - condition: state entity_id: binary_sensor.night_mode_active state: 'off' sequence: - service: persistent_notification.create data: title: Z-Wave LED Day Mode message: Day mode is now active. All LED indicators have been restored to normal operation. notification_id: zwave_led_day_mode - delay: 00:05:00 - service: persistent_notification.dismiss data: notification_id: zwave_led_day_mode mode: single - id: '1736869556746' alias: Lights Sunset Sunrise description: Automation based on sunrise/sun set triggers: - event: sunset id: Sunset trigger: sun - event: sunrise id: Sunrise offset: +00:15:00 trigger: sun actions: - target: entity_id: light.porch_light action: light.turn_{{ 'on' if trigger.id == 'Sunset' else 'off' }} - choose: - conditions: - condition: trigger id: - Sunset sequence: - target: entity_id: light.hall_light data: brightness_pct: 100 action: light.turn_on - action: switch.turn_on metadata: {} data: {} target: entity_id: switch.tp_link_smart_plug_5e5b_walkway - conditions: - condition: trigger id: - Sunrise sequence: - target: entity_id: light.hall_light action: light.turn_off data: {} - action: switch.turn_off metadata: {} data: {} target: entity_id: switch.tp_link_smart_plug_5e5b_walkway default: - data: message: 'No Sunrise/Sunset actions (trigger: {{ trigger.id }})' name: Lights Sunset Sunrise Automation entity_id: sun.sun action: logbook.log - id: '1747693281652' alias: KitchenAndLivingRoomDimmers description: Kitchen and Living Room Dimmers - updated for actual device topology triggers: - platform: mqtt topic: zigbee2mqtt/Kitchen_Dimmer/action id: kitchen_dimmer - platform: mqtt topic: zigbee2mqtt/LivingRoom_Dimmer/action id: living_room_dimmer conditions: [] actions: - action: logbook.log data: name: Dimmer Debug message: 'Device: {{ trigger.id }}, Payload: {{ trigger.payload }}' - choose: - conditions: - condition: template value_template: '{{ trigger.id == ''kitchen_dimmer'' and trigger.payload == ''on_press_release'' }}' sequence: - action: logbook.log data: name: Kitchen Dimmer Action message: Turning on kitchen lights - action: light.turn_on target: entity_id: light.kitchen_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''kitchen_dimmer'' and trigger.payload == ''off_press_release'' }}' sequence: - action: logbook.log data: name: Kitchen Dimmer Action message: Turning off kitchen lights - action: light.turn_off target: entity_id: light.kitchen_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''living_room_dimmer'' and trigger.payload == ''on_press_release'' }}' sequence: - action: logbook.log data: name: Living Room Dimmer Action message: Turning on living room lights - action: light.turn_on target: entity_id: light.livingroom_lights continue_on_error: true - action: light.turn_on target: entity_id: - light.rgbcw_lightbulb1 - light.rgbcw_lightbulb2 - light.rgbcw_lightbulb3 - light.rgbcw_lightbulb4 - light.rgbcw_lightbulb5 continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''living_room_dimmer'' and trigger.payload == ''off_press_release'' }}' sequence: - action: logbook.log data: name: Living Room Dimmer Action message: Turning off living room lights - action: light.turn_off target: entity_id: light.livingroom_lights continue_on_error: true - action: light.turn_off target: entity_id: - light.rgbcw_lightbulb1 - light.rgbcw_lightbulb2 - light.rgbcw_lightbulb3 - light.rgbcw_lightbulb4 - light.rgbcw_lightbulb5 continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''kitchen_dimmer'' and trigger.payload == ''up_press_release'' }}' sequence: - action: logbook.log data: name: Kitchen Dimmer Action message: Increasing kitchen brightness (press) - action: light.turn_on data: brightness_step_pct: 10 target: entity_id: light.kitchen_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''kitchen_dimmer'' and trigger.payload == ''up_hold_release'' }}' sequence: - action: logbook.log data: name: Kitchen Dimmer Action message: Increasing kitchen brightness (hold) - action: light.turn_on data: brightness_step_pct: 30 target: entity_id: light.kitchen_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''kitchen_dimmer'' and trigger.payload == ''down_press_release'' }}' sequence: - action: logbook.log data: name: Kitchen Dimmer Action message: Decreasing kitchen brightness (press) - action: light.turn_on data: brightness_step_pct: -10 target: entity_id: light.kitchen_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''kitchen_dimmer'' and trigger.payload == ''down_hold_release'' }}' sequence: - action: logbook.log data: name: Kitchen Dimmer Action message: Decreasing kitchen brightness (hold) - action: light.turn_on data: brightness_step_pct: -30 target: entity_id: light.kitchen_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''living_room_dimmer'' and trigger.payload == ''up_press_release'' }}' sequence: - action: logbook.log data: name: Living Room Dimmer Action message: Increasing living room brightness (press) - action: light.turn_on data: brightness_step_pct: 10 target: entity_id: light.livingroom_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''living_room_dimmer'' and trigger.payload == ''up_hold_release'' }}' sequence: - action: logbook.log data: name: Living Room Dimmer Action message: Increasing living room brightness (hold) - action: light.turn_on data: brightness_step_pct: 30 target: entity_id: light.livingroom_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''living_room_dimmer'' and trigger.payload == ''down_press_release'' }}' sequence: - action: logbook.log data: name: Living Room Dimmer Action message: Decreasing living room brightness (press) - action: light.turn_on data: brightness_step_pct: -10 target: entity_id: light.livingroom_lights continue_on_error: true - conditions: - condition: template value_template: '{{ trigger.id == ''living_room_dimmer'' and trigger.payload == ''down_hold_release'' }}' sequence: - action: logbook.log data: name: Living Room Dimmer Action message: Decreasing living room brightness (hold) - action: light.turn_on data: brightness_step_pct: -30 target: entity_id: light.livingroom_lights continue_on_error: true default: [] mode: queued max: 10 - alias: AI Suggestions - New Entity Detection description: Generates automation suggestions whenever new entities are registered in Home Assistant trigger: - platform: event event_type: entity_registry_updated event_data: action: create - platform: event event_type: entity_registry_updated event_data: action: update condition: - condition: template value_template: "{% set automation = states.automation.ai_suggestions_new_entity_detection\ \ %} {% if automation and automation.attributes.last_triggered %}\n {% set\ \ hours_since = ((now() - as_datetime(automation.attributes.last_triggered)).total_seconds()\ \ / 3600) | float %}\n {{ hours_since > 1.0 }}\n{% else %}\n true\n{% endif\ \ %}" action: - service: ai_automation_suggester.generate_suggestions target: {} data: {} - id: notification_deduplication_cleanup_v2 alias: Notification - Deduplication Cleanup description: Clean up old deduplication hashes periodically trigger: - platform: time at: 03:00:00 condition: - condition: state entity_id: input_boolean.notification_deduplication_enabled state: 'on' action: - service: input_text.set_value target: entity_id: input_text.unified_notification_last_hash data: value: '' - service: input_text.set_value target: entity_id: input_text.unified_notification_context data: value: '' - service: input_text.set_value target: entity_id: input_text.notification_system_status data: value: Deduplication cleaned at {{ now().strftime('%H:%M') }} - id: notification_rate_limit_reset_v2 alias: Notification - Rate Limit Reset description: Reset notification rate limit hourly trigger: - platform: time_pattern minutes: 0 action: - service: input_datetime.set_datetime entity_id: input_datetime.notification_rate_limit_reset data: datetime: '{{ (now() + timedelta(hours=1)) }}' - service: input_text.set_value target: entity_id: input_text.notification_system_status data: value: Rate limit reset at {{ now().strftime('%H:%M') }} - id: notification_test_mode_reminder_v2 alias: Notification - Test Mode Reminder description: Remind when test mode has been on for too long trigger: - platform: state entity_id: input_boolean.notification_test_mode to: 'on' for: hours: 1 action: - service: notify.mobile_app_pixel_9_pro_xl data: title: ⚠️ Notification Test Mode message: Notification test mode has been active for 1 hour. Consider disabling it. data: tag: notification_test_reminder - id: postgresql_health_check alias: PostgreSQL - Daily Health Check description: Check PostgreSQL database health and connection status daily trigger: - platform: time at: 03:00:00 action: - service: shell_command.postgresql_health - delay: 00:00:30 - if: - condition: template value_template: '{{ states(''sensor.postgresql_health_status'') == ''error'' }}' then: - service: script.send_deduplicated_notification data: appliance: postgresql priority: critical title: 🚨 POSTGRESQL HEALTH ISSUE message: 'PostgreSQL database health check failed! Status: {{ states(''sensor.postgresql_health_status'') }} Connection: {{ state_attr(''sensor.postgresql_health_status'', ''connection'') }} Last Check: {{ state_attr(''sensor.postgresql_health_status'', ''last_check'') }} Action required: Database investigation needed. ' tag: postgresql_health channel: System Alerts ttl: 0 - id: postgresql_weekly_maintenance alias: PostgreSQL - Weekly Maintenance description: Perform weekly PostgreSQL maintenance and statistics update trigger: - platform: time at: 02:00:00 condition: - condition: time weekday: - sun - condition: template value_template: '{{ states(''sensor.postgresql_database_size_mb'') | int(0) > 100 }}' action: - service: shell_command.postgresql_maintenance - delay: 00:02:00 - service: script.send_deduplicated_notification data: appliance: postgresql priority: normal title: ✅ PostgreSQL Maintenance Complete message: 'Weekly PostgreSQL maintenance completed. Database Size: {{ states(''sensor.postgresql_database_size_mb'') }} MB Status: {{ states(''sensor.postgresql_health_status'') }} Tables Analyzed: All core tables ' tag: postgresql_maintenance channel: System Status - id: postgresql_hourly_backup_peak alias: PostgreSQL - Hourly Backup (Peak Hours) - Phase 3 Optimized description: Create hourly PostgreSQL backups during peak usage hours - Event driven mode: queued max: 3 trigger: - platform: event event_type: postgresql_schedule_trigger event_data: task_type: hourly_backup condition: - condition: state entity_id: input_boolean.postgresql_scheduler_enabled state: 'on' - condition: template value_template: '{{ trigger.event.data.backup_type == ''peak_hours'' }}' action: - service: shell_command.postgresql_backup - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - id: postgresql_backup_performance_alert alias: PostgreSQL - Backup Performance Alert description: Alert when PostgreSQL backup performance degrades trigger: - platform: state entity_id: binary_sensor.postgresql_backup_performance_issue to: 'on' for: minutes: 2 action: - service: script.send_deduplicated_notification data: appliance: postgresql priority: high title: ⚠️ PostgreSQL Backup Performance Issue message: 'PostgreSQL backup performance has degraded: Status: {{ states(''sensor.postgresql_backup_performance'') }} Duration: {{ state_attr(''sensor.postgresql_backup_performance'', ''backup_duration'') }} Size: {{ state_attr(''sensor.postgresql_backup_performance'', ''backup_size'') }} Time: {{ state_attr(''sensor.postgresql_backup_performance'', ''last_backup_time'') }} {% if states(''sensor.postgresql_backup_duration_seconds'') | int(0) > 5 %} Backup is taking longer than expected (>5 seconds). {% endif %} {% if states(''sensor.postgresql_backup_performance'') != ''success'' %} Backup is failing - check PostgreSQL connectivity. {% endif %} ' tag: postgresql_backup_performance channel: System Alerts - id: postgresql_backup_retention_management alias: PostgreSQL - Backup Retention Management - Phase 3 Optimized description: Manage PostgreSQL backup retention schedules - Event driven mode: single trigger: - platform: event event_type: postgresql_schedule_trigger event_data: task_type: retention_management condition: - condition: state entity_id: input_boolean.postgresql_scheduler_enabled state: 'on' - condition: template value_template: '{{ trigger.event.data.schedule_time == ''04:00:00'' }}' action: - service: shell_command.postgresql_retention - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - id: postgresql_scheduler alias: PostgreSQL Scheduler - Phase 3 Optimized description: Event-driven scheduler replacing time-based triggers mode: single trigger: - platform: time at: 00:00:00 condition: - condition: state entity_id: input_boolean.postgresql_scheduler_enabled state: 'on' action: - service: input_datetime.set_datetime target: entity_id: input_datetime.postgresql_scheduler_last_run data: datetime: '{{ now() }}' - delay: 04:00:00 - event: postgresql_schedule_trigger event_data: task_type: retention_management schedule_time: 04:00:00 - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - delay: 03:00:00 - event: postgresql_schedule_trigger event_data: task_type: hourly_backup schedule_time: 07:00:00 backup_type: peak_hours - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - delay: 04:00:00 - event: postgresql_schedule_trigger event_data: task_type: hourly_backup schedule_time: '11:00:00' backup_type: peak_hours - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - delay: 04:00:00 - event: postgresql_schedule_trigger event_data: task_type: hourly_backup schedule_time: '15:00:00' backup_type: peak_hours - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - delay: 04:00:00 - event: postgresql_schedule_trigger event_data: task_type: hourly_backup schedule_time: '19:00:00' backup_type: peak_hours - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - delay: 04:00:00 - event: postgresql_schedule_trigger event_data: task_type: hourly_backup schedule_time: '23:00:00' backup_type: peak_hours - service: counter.increment target: entity_id: counter.postgresql_phase3_triggers - id: memory_pressure_notification alias: 'System Monitor: Memory Pressure Alert' description: Notifies when system memory is under pressure trigger: - platform: state entity_id: binary_sensor.memory_pressure_alert to: 'on' for: 00:02:00 condition: - condition: template value_template: '{{ states(''sensor.glances_ram_used_percent'') | float(0) > 75 }} ' action: - service: persistent_notification.create data: title: 🔴 Memory Pressure Detected message: 'System memory usage is high: {{ states(''sensor.glances_ram_used_percent'') | float(0) | round(1) }}% Free memory: {{ (states(''sensor.glances_ram_free'') | float(0) / 1024 / 1024 / 1024) | round(2) }}GB Swap usage: {{ states(''sensor.glances_swap_used_percent'') | float(0) | round(1) }}% Consider restarting Home Assistant or investigating memory-intensive processes. ' notification_id: memory_pressure_alert - id: memory_pressure_recovery alias: 'System Monitor: Memory Pressure Recovered' description: Notifies when memory pressure has been resolved trigger: - platform: state entity_id: binary_sensor.memory_pressure_alert to: 'off' for: 00:01:00 condition: - condition: template value_template: '{{ states(''sensor.glances_ram_used_percent'') | float(0) < 70 }} ' action: - service: persistent_notification.dismiss data: notification_id: memory_pressure_alert - service: persistent_notification.create data: title: ✅ Memory Pressure Resolved message: 'System memory usage has returned to normal: {{ states(''sensor.glances_ram_used_percent'') | float(0) | round(1) }}% System Health Score: {{ states(''sensor.system_health_score'') | float(0) | round(1) }}% ' notification_id: memory_recovery - id: daily_system_health_report alias: 'System Monitor: Daily Health Report' description: Daily system resource utilization report trigger: - platform: time at: 06:00:00 action: - service: logbook.log data: name: System Health message: 'Daily Health Report: Memory: {{ states(''sensor.glances_ram_used_percent'') | float(0) | round(1) }}% CPU Load: {{ states(''sensor.glances_cpu_load'') | float(0) | round(1) }}% Disk: {{ states(''sensor.glances_disk_used_percent'') | float(0) | round(1) }}% Health Score: {{ states(''sensor.system_health_score'') | float(0) | round(1) }}% Status: {{ states(''sensor.memory_status'') }} ' - id: '1742000000001' alias: Update Map Entities Sensor description: Forces the map entities sensor to refresh when presence changes trigger: - platform: state entity_id: binary_sensor.hide_home_icon action: - delay: seconds: 1 - service: homeassistant.update_entity target: entity_id: sensor.map_entities - service: persistent_notification.create data: title: Map Entities Update message: 'Map entities sensor refreshed: {{ states(''sensor.map_entities'') }}' notification_id: map_entities_update - id: test_framework_orchestrator alias: 'Test Framework: Main Orchestrator' description: Coordinates execution of all domain test suites trigger: - platform: state entity_id: input_boolean.system_testing_mode to: 'on' action: - service: input_text.set_value target: entity_id: input_text.test_results_summary data: value: Test execution started at {{ now().strftime('%H:%M:%S') }} - service: input_select.select_option target: entity_id: input_select.current_test_domain data: option: Appliance - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.run_appliance_tests - id: test_appliance_domain_comprehensive alias: 'Test Framework: Appliance Domain Suite' description: Comprehensive testing of appliance management functionality trigger: - platform: state entity_id: input_boolean.run_appliance_tests to: 'on' condition: - condition: state entity_id: input_boolean.system_testing_mode state: 'on' action: - service: logbook.log data: name: Test Framework message: Starting appliance domain tests entity_id: input_boolean.run_appliance_tests - service: shell_command.validate_appliance_package - delay: 00:00:05 - service: input_boolean.turn_on target: entity_id: input_boolean.appliance_test_simulation - service: input_number.set_value target: entity_id: input_number.test_appliance_power_simulation data: value: 1200 - delay: 00:00:10 - service: input_number.set_value target: entity_id: input_number.test_appliance_power_simulation data: value: 5 - delay: 00:00:05 - service: input_boolean.turn_off target: entity_id: input_boolean.appliance_test_simulation - service: logbook.log data: name: Test Framework message: Appliance domain tests completed entity_id: input_boolean.run_appliance_tests - service: input_boolean.turn_off target: entity_id: input_boolean.run_appliance_tests - service: input_select.select_option target: entity_id: input_select.current_test_domain data: option: Lighting - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.run_lighting_tests - id: test_lighting_domain_comprehensive alias: 'Test Framework: Lighting Domain Suite' description: Comprehensive testing of lighting control functionality trigger: - platform: state entity_id: input_boolean.run_lighting_tests to: 'on' condition: - condition: state entity_id: input_boolean.system_testing_mode state: 'on' action: - service: logbook.log data: name: Test Framework message: Starting lighting domain tests entity_id: input_boolean.run_lighting_tests - service: shell_command.validate_lighting_package - delay: 00:00:05 - service: logbook.log data: name: Test Framework message: Testing LED RF command structure (simulation) entity_id: input_boolean.run_lighting_tests - delay: 00:00:10 - service: logbook.log data: name: Test Framework message: Lighting domain tests completed entity_id: input_boolean.run_lighting_tests - service: input_boolean.turn_off target: entity_id: input_boolean.run_lighting_tests - service: input_select.select_option target: entity_id: input_select.current_test_domain data: option: Environmental - delay: 00:00:02 - service: input_boolean.turn_on target: entity_id: input_boolean.run_environmental_tests - id: test_environmental_domain_comprehensive alias: 'Test Framework: Environmental Domain Suite' description: Comprehensive testing of environmental systems functionality trigger: - platform: state entity_id: input_boolean.run_environmental_tests to: 'on' condition: - condition: state entity_id: input_boolean.system_testing_mode state: 'on' action: - service: logbook.log data: name: Test Framework message: Starting environmental domain tests entity_id: input_boolean.run_environmental_tests - service: shell_command.validate_environmental_package - delay: 00:00:05 - service: logbook.log data: name: Test Framework message: Validating hydroponics automation structure entity_id: input_boolean.run_environmental_tests - delay: 00:00:10 - service: logbook.log data: name: Test Framework message: Environmental domain tests completed entity_id: input_boolean.run_environmental_tests - service: input_boolean.turn_off target: entity_id: input_boolean.run_environmental_tests - service: input_select.select_option target: entity_id: input_select.current_test_domain data: option: None - service: input_text.set_value target: entity_id: input_text.test_results_summary data: value: All tests completed at {{ now().strftime('%H:%M:%S') }} - service: input_boolean.turn_off target: entity_id: input_boolean.system_testing_mode - service: logbook.log data: name: Test Framework message: Complete test suite execution finished - id: test_performance_monitoring alias: 'Test Framework: Performance Monitoring' description: Monitors system performance during testing trigger: - platform: time_pattern seconds: /30 condition: - condition: state entity_id: input_boolean.performance_testing_active state: 'on' action: - service: shell_command.capture_performance_metrics - id: test_timeout_safety alias: 'Test Framework: Timeout Safety' description: Prevents tests from running indefinitely trigger: - platform: state entity_id: input_boolean.system_testing_mode to: 'on' for: minutes: '{{ states(''input_number.test_timeout_minutes'') | int }}' action: - service: logbook.log data: name: Test Framework message: Test timeout reached - forcing shutdown - service: input_boolean.turn_off target: entity_id: - input_boolean.run_appliance_tests - input_boolean.run_lighting_tests - input_boolean.run_environmental_tests - input_boolean.system_testing_mode - service: input_text.set_value target: entity_id: input_text.test_results_summary data: value: Tests TIMED OUT after {{ states('input_number.test_timeout_minutes') }} minutes - id: test_dimmer_lights alias: Test Dimmer Lights description: Test if the light entities are working trigger: - platform: time_pattern minutes: /1 condition: [] action: - action: logbook.log data: name: Test Dimmer Lights message: Testing light entities... entity_id: automation.test_dimmer_lights - action: light.turn_on target: entity_id: light.livingroom_lights data: brightness_pct: 50 continue_on_error: true - delay: 5 - action: light.turn_on target: entity_id: - light.rgbcw_lightbulb1 - light.rgbcw_lightbulb2 data: brightness_pct: 50 continue_on_error: true - delay: 5 - action: light.turn_off target: entity_id: - light.livingroom_lights - light.rgbcw_lightbulb1 - light.rgbcw_lightbulb2 continue_on_error: true - alias: Dishwasher - Cycle Start Detection description: Detect dishwasher cycle start with proper state tracking to prevent duplicate announcements mode: single trigger: - platform: numeric_state entity_id: sensor.dishwasher_electric_consumption_w above: 50 for: minutes: 2 condition: - condition: and conditions: - condition: state entity_id: input_boolean.dishwasher_cycle_announced state: 'off' - condition: or conditions: - condition: state entity_id: input_boolean.appliance_quiet_hours_enabled state: 'off' - condition: time after: 07:30:00 before: '22:30:00' action: - action: input_boolean.turn_on entity_id: input_boolean.dishwasher_cycle_announced - service: notify.alexa_media_everywhere continue_on_error: true data: message: The dishwasher cycle has started. data: type: announce - condition: template value_template: '{{ states(''media_player.everywhere'') == ''unavailable'' }}' - service: notify.mobile_app_pixel_9_pro_xl data: title: Dishwasher Started message: Cycle started at {{ now().strftime('%I:%M %p') }} - service: input_text.set_value data: entity_id: input_text.appliance_last_announcement value: Dishwasher cycle started - alias: Dishwasher Cycle Monitoring description: Enhanced dishwasher cycle monitoring with completion detection and Alexa announcements (respects quiet hours) mode: restart trigger: - platform: numeric_state entity_id: sensor.dishwasher_electric_consumption_w below: 5 for: minutes: 5 condition: - condition: numeric_state entity_id: sensor.dishwasher_electric_consumption_w below: 5 action: - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: Dishwasher cycle is complete! Don't forget to open the door to let dishes air dry. data: type: announce - action: input_boolean.turn_off entity_id: input_boolean.dishwasher_cycle_announced - delay: minutes: 30 - condition: template value_template: '{{ states(''binary_sensor.dishwasher_door_window_door_is_open'') not in [''unknown'', ''unavailable''] }}' - condition: state entity_id: binary_sensor.dishwasher_door_window_door_is_open state: 'off' - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Reminder: The dishwasher door is still closed. Opening it will help dishes dry faster.' data: type: announce - alias: Dishwasher - Cycle Completion Announcement description: Announce when dishwasher cycle is complete trigger: - platform: state entity_id: input_boolean.dishwasher_cycle_announced from: 'on' to: 'off' condition: - condition: time after: 07:00:00 before: '22:30:00' action: - service: notify.alexa_media_everywhere data: message: The dishwasher cycle is complete and ready to be unloaded. data: type: announce - service: input_text.set_value target: entity_id: input_text.appliance_last_announcement data: value: Dishwasher complete - {{ now().strftime('%H:%M') }} - alias: Dishwasher - Door Left Open Alert description: Alerts if dishwasher door is left open too long (respects quiet hours) trigger: - platform: state entity_id: binary_sensor.dishwasher_door_window_door_is_open to: 'on' for: hours: 4 condition: - condition: template value_template: '{{ states(''binary_sensor.dishwasher_door_window_door_is_open'') not in [''unknown'', ''unavailable''] }}' - condition: time after: 07:30:00 before: '22:30:00' action: - service: notify.alexa_media_everywhere continue_on_error: true data: message: The dishwasher door has been open for 4 hours. You may want to close it now. data: type: announce - alias: Washing Machine - Cycle Start Detection description: Detects when washing machine starts and announces via Alexa (respects quiet hours) trigger: - platform: numeric_state entity_id: sensor.washing_machine_electric_consumption_w above: 100 for: minutes: 2 condition: - condition: time after: 07:30:00 before: '22:30:00' action: - service: notify.alexa_media_everywhere continue_on_error: true data: message: Washing machine cycle has started. I'll let you know when it's finished. data: type: announce - service: logbook.log data: name: Washing Machine Monitoring message: 'Washing machine cycle started - power consumption: {{ states(''sensor.washing_machine_electric_consumption_w'') }}W' - alias: Washing Machine Cycle Monitoring description: Enhanced washing machine cycle monitoring with completion detection and progressive reminders (respects quiet hours) mode: restart trigger: - platform: numeric_state entity_id: sensor.washing_machine_electric_consumption_w below: 5 for: minutes: 3 condition: - condition: numeric_state entity_id: sensor.washing_machine_electric_consumption_w below: 5 action: - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: Washing machine cycle is complete! Time to move your clothes to the dryer. data: type: announce - delay: minutes: 15 - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Reminder: Your laundry is still waiting in the washing machine.' data: type: announce - delay: minutes: 30 - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Final reminder: Please don''t forget about your laundry in the washing machine.' data: type: announce - alias: Washing Machine - Cycle Completion Announcement description: Announce when washing machine cycle is complete trigger: - platform: state entity_id: input_boolean.washing_machine_cycle_announced from: 'on' to: 'off' condition: - condition: time after: 07:00:00 before: '22:30:00' action: - service: notify.alexa_media_everywhere data: message: The washing machine cycle is complete. Please move clothes to the dryer. data: type: announce - service: input_text.set_value target: entity_id: input_text.appliance_last_announcement data: value: Washer complete - {{ now().strftime('%H:%M') }} - alias: Dryer - Cycle Start Detection description: Detects when dryer starts using SmartThings integration (respects quiet hours) trigger: - platform: state entity_id: sensor.dryer_machine_state to: run - platform: state entity_id: sensor.dryer_job_state to: drying condition: - condition: template value_template: '{{ states(''sensor.dryer_machine_state'') not in [''unknown'', ''unavailable''] }}' - condition: state entity_id: sensor.dryer_machine_state state: run - condition: time after: 07:30:00 before: '22:30:00' action: - service: notify.alexa_media_everywhere continue_on_error: true data: message: "Dryer cycle has started. {% set completion_time = states('sensor.dryer_completion_time')\ \ %} {% if completion_time not in ['unknown', 'unavailable'] and completion_time\ \ != None %}\n Expected completion time is {{ as_timestamp(completion_time)\ \ | timestamp_custom('%I:%M %p', true) }}.\n{% else %}\n I'll let you know\ \ when it's finished.\n{% endif %}\n" data: type: announce - service: logbook.log data: name: Dryer Monitoring message: 'Dryer cycle started - Job state: {{ states(''sensor.dryer_job_state'') }}' - alias: Dryer - Cycle Completion Announcement description: Announce when dryer cycle is complete trigger: - platform: state entity_id: input_boolean.dryer_cycle_announced from: 'on' to: 'off' condition: - condition: time after: 07:00:00 before: '22:30:00' action: - service: notify.alexa_media_everywhere data: message: The dryer cycle is complete. Please remove clothes to prevent wrinkles. data: type: announce - service: input_text.set_value target: entity_id: input_text.appliance_last_announcement data: value: Dryer complete - {{ now().strftime('%H:%M') }} - alias: Appliance - Error Monitoring description: Monitor for appliance errors and announce trigger: - platform: state entity_id: - sensor.dishwasher_door_status - sensor.washing_machine_status - sensor.dryer_status to: error action: - service: notify.alexa_media_everywhere data: message: 'Attention: {{ trigger.to_state.attributes.friendly_name }} is reporting an error. Please check the appliance.' data: type: announce - service: persistent_notification.create data: title: 🚨 Appliance Error message: '{{ trigger.to_state.attributes.friendly_name }} error at {{ now().strftime(''%H:%M'') }}' notification_id: appliance_error_{{ trigger.entity_id.split('.')[1] }} - alias: Appliance - Monthly Maintenance Reminder description: Monthly maintenance reminders for appliances trigger: - platform: time at: 09:00:00 condition: - condition: template value_template: '{{ now().day == 1 }}' action: - service: notify.alexa_media_everywhere data: message: 'Monthly appliance maintenance reminder: Please clean the dishwasher filter, check washing machine hoses, and clean the dryer lint trap.' data: type: announce - service: persistent_notification.create data: title: 🔧 Monthly Appliance Maintenance message: 'Time for monthly appliance maintenance: - Clean dishwasher filter - Check washing machine hoses - Clean dryer lint trap - Wipe down appliance exteriors ' notification_id: monthly_maintenance - alias: Appliance - Off-Peak Energy Reminder description: Remind to run appliances during off-peak hours trigger: - platform: time at: '21:00:00' condition: - condition: time weekday: - mon - tue - wed - thu - fri action: - service: notify.alexa_media_everywhere data: message: 'Reminder: Off-peak energy hours start at 10 PM. Consider running the dishwasher or washing machine after 10 PM to save on energy costs.' data: type: announce - alias: Appliance - Maintenance Tracking description: Track when maintenance tasks are completed trigger: - platform: state entity_id: - input_datetime.dishwasher_last_filter_clean - input_datetime.washing_machine_last_hose_check to: null action: - service: notify.alexa_media_everywhere data: message: Thank you for completing the {{ trigger.to_state.attributes.friendly_name.replace('Last ', '').lower() }}. Maintenance has been logged. data: type: announce - service: input_text.set_value target: entity_id: input_text.appliance_last_announcement data: value: Maintenance logged - {{ now().strftime('%H:%M') }} - alias: Dishwasher - Cycle Start Detection Enhanced description: Enhanced dishwasher cycle start detection with hysteresis to prevent false triggers mode: single trigger: - platform: numeric_state entity_id: sensor.dishwasher_electric_consumption_w above: 50 for: minutes: 3 condition: - condition: and conditions: - condition: state entity_id: input_boolean.dishwasher_cycle_announced state: 'off' - condition: numeric_state entity_id: sensor.dishwasher_electric_consumption_w above: 30 - condition: or conditions: - condition: state entity_id: input_boolean.appliance_quiet_hours_enabled state: 'off' - condition: time after: 07:30:00 before: '22:30:00' action: - action: input_boolean.turn_on entity_id: input_boolean.dishwasher_cycle_announced - service: input_datetime.set_datetime target: entity_id: input_datetime.dishwasher_cycle_start data: timestamp: '{{ now().timestamp() }}' - service: notify.alexa_media_everywhere continue_on_error: true data: message: The dishwasher cycle has started. Current power consumption is {{ states('sensor.dishwasher_electric_consumption_w') | round(0) }} watts. data: type: announce - condition: template value_template: '{{ states(''media_player.everywhere'') == ''unavailable'' }}' - service: notify.mobile_app_pixel_9_pro_xl data: title: Dishwasher Started message: Cycle started at {{ now().strftime('%I:%M %p') }} - {{ states('sensor.dishwasher_electric_consumption_w') | round(0) }}W - service: input_text.set_value data: entity_id: input_text.appliance_last_announcement value: Dishwasher cycle started - {{ states('sensor.dishwasher_electric_consumption_w') | round(0) }}W - alias: Dishwasher - Cycle Running Monitor description: Monitor dishwasher during cycle to handle power fluctuations mode: restart trigger: - platform: numeric_state entity_id: sensor.dishwasher_electric_consumption_w below: 15 for: minutes: 2 condition: - condition: state entity_id: input_boolean.dishwasher_cycle_announced state: 'on' - condition: template value_template: "{% set start_time = states('input_datetime.dishwasher_cycle_start')\ \ %} {% if start_time not in ['unknown', 'unavailable'] %}\n {% set elapsed\ \ = (now().timestamp() - as_timestamp(start_time)) / 60 %}\n {{ elapsed > 10\ \ }} {# Only trigger if cycle has been running for at least 10 minutes #}\n\ {% else %}\n false\n{% endif %}\n" action: - delay: minutes: 8 - condition: numeric_state entity_id: sensor.dishwasher_electric_consumption_w below: 10 - condition: time after: 07:30:00 before: '22:30:00' - variables: cycle_duration: "{% set start_time = states('input_datetime.dishwasher_cycle_start')\ \ %} {% if start_time not in ['unknown', 'unavailable'] %}\n {% set elapsed_minutes\ \ = ((now().timestamp() - as_timestamp(start_time)) / 60) | round(0) %}\n\ \ {{ elapsed_minutes }}\n{% else %}\n 0\n{% endif %}\n" - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Dishwasher cycle is complete after {{ cycle_duration }} minutes! Don''t forget to open the door to let dishes air dry. ' data: type: announce - action: input_boolean.turn_off entity_id: input_boolean.dishwasher_cycle_announced - delay: minutes: 30 - condition: template value_template: '{{ states(''binary_sensor.dishwasher_door_window_door_is_open'') not in [''unknown'', ''unavailable''] }}' - condition: state entity_id: binary_sensor.dishwasher_door_window_door_is_open state: 'off' - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Reminder: The dishwasher door is still closed. Opening it will help dishes dry faster.' data: type: announce - alias: Washing Machine - Cycle Start Detection Enhanced description: Enhanced washing machine cycle start detection with power confirmation mode: single trigger: - platform: numeric_state entity_id: sensor.washing_machine_electric_consumption_w above: 100 for: minutes: 3 condition: - condition: and conditions: - condition: state entity_id: input_boolean.washing_machine_cycle_announced state: 'off' - condition: numeric_state entity_id: sensor.washing_machine_electric_consumption_w above: 50 - condition: time after: 07:30:00 before: '22:30:00' action: - action: input_boolean.turn_on entity_id: input_boolean.washing_machine_cycle_announced - service: input_datetime.set_datetime target: entity_id: input_datetime.washing_machine_cycle_start data: timestamp: '{{ now().timestamp() }}' - service: notify.alexa_media_everywhere continue_on_error: true data: message: Washing machine cycle has started at {{ states('sensor.washing_machine_electric_consumption_w') | round(0) }} watts. I'll let you know when it's finished. data: type: announce - service: logbook.log data: name: Washing Machine Monitoring message: 'Washing machine cycle started - power consumption: {{ states(''sensor.washing_machine_electric_consumption_w'') }}W' - alias: Washing Machine - Cycle Completion Enhanced description: Enhanced washing machine completion detection with progressive reminders mode: restart trigger: - platform: numeric_state entity_id: sensor.washing_machine_electric_consumption_w below: 10 for: minutes: 5 condition: - condition: state entity_id: input_boolean.washing_machine_cycle_announced state: 'on' - condition: template value_template: "{% set start_time = states('input_datetime.washing_machine_cycle_start')\ \ %} {% if start_time not in ['unknown', 'unavailable'] %}\n {% set elapsed\ \ = (now().timestamp() - as_timestamp(start_time)) / 60 %}\n {{ elapsed > 15\ \ }} {# Minimum 15 minutes for a valid cycle #}\n{% else %}\n false\n{% endif\ \ %}\n" action: - delay: minutes: 10 - condition: numeric_state entity_id: sensor.washing_machine_electric_consumption_w below: 15 - condition: time after: 07:30:00 before: '22:30:00' - variables: cycle_duration: "{% set start_time = states('input_datetime.washing_machine_cycle_start')\ \ %} {% if start_time not in ['unknown', 'unavailable'] %}\n {% set elapsed_minutes\ \ = ((now().timestamp() - as_timestamp(start_time)) / 60) | round(0) %}\n\ \ {{ elapsed_minutes }}\n{% else %}\n 0\n{% endif %}\n" - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Washing machine cycle is complete after {{ cycle_duration }} minutes! Time to move your clothes to the dryer. ' data: type: announce - action: input_boolean.turn_off entity_id: input_boolean.washing_machine_cycle_announced - delay: minutes: 20 - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Reminder: Your laundry is still waiting in the washing machine.' data: type: announce - delay: minutes: 40 - condition: time after: 07:30:00 before: '22:30:00' - service: notify.alexa_media_everywhere continue_on_error: true data: message: 'Final reminder: Please don''t forget about your laundry in the washing machine.' data: type: announce - alias: Dryer - Cycle Start Detection Enhanced description: Enhanced dryer start detection using SmartThings with confirmation mode: single trigger: - platform: state entity_id: sensor.dryer_machine_state to: run - platform: state entity_id: sensor.dryer_job_state to: drying condition: - condition: and conditions: - condition: template value_template: '{{ states(''sensor.dryer_machine_state'') not in [''unknown'', ''unavailable''] }}' - condition: state entity_id: sensor.dryer_machine_state state: run - condition: state entity_id: input_boolean.dryer_cycle_announced state: 'off' - condition: time after: 07:30:00 before: '22:30:00' action: - action: input_boolean.turn_on entity_id: input_boolean.dryer_cycle_announced - service: input_datetime.set_datetime target: entity_id: input_datetime.dryer_cycle_start data: timestamp: '{{ now().timestamp() }}' - service: notify.alexa_media_everywhere continue_on_error: true data: message: "Dryer cycle has started. {% set completion_time = states('sensor.dryer_completion_time')\ \ %} {% if completion_time not in ['unknown', 'unavailable'] and completion_time\ \ != None %}\n Expected completion time is {{ as_timestamp(completion_time)\ \ | timestamp_custom('%I:%M %p', true) }}.\n{% else %}\n I'll monitor the\ \ cycle and let you know when it's finished.\n{% endif %}\n" data: type: announce - service: logbook.log data: name: Dryer Monitoring message: 'Dryer cycle started - Job state: {{ states(''sensor.dryer_job_state'') }}' - alias: Dryer - Cycle Completion Enhanced description: Enhanced dryer completion detection using SmartThings states mode: single trigger: - platform: state entity_id: sensor.dryer_machine_state from: run to: stop - platform: state entity_id: sensor.dryer_job_state from: drying to: none condition: - condition: and conditions: - condition: state entity_id: input_boolean.dryer_cycle_announced state: 'on' - condition: template value_template: '{{ states(''sensor.dryer_machine_state'') in [''stop'', ''pause''] }}' - condition: time after: 07:00:00 before: '22:30:00' action: - delay: minutes: 2 - condition: template value_template: '{{ states(''sensor.dryer_machine_state'') in [''stop'', ''pause''] }}' - variables: cycle_duration: "{% set start_time = states('input_datetime.dryer_cycle_start')\ \ %} {% if start_time not in ['unknown', 'unavailable'] %}\n {% set elapsed_minutes\ \ = ((now().timestamp() - as_timestamp(start_time)) / 60) | round(0) %}\n\ \ {{ elapsed_minutes }}\n{% else %}\n 0\n{% endif %}\n" - service: notify.alexa_media_everywhere data: message: 'The dryer cycle is complete after {{ cycle_duration }} minutes. Please remove clothes promptly to prevent wrinkles. ' data: type: announce - action: input_boolean.turn_off entity_id: input_boolean.dryer_cycle_announced - service: input_text.set_value target: entity_id: input_text.appliance_last_announcement data: value: Dryer complete - {{ cycle_duration }}min - {{ now().strftime('%H:%M') }} - alias: Appliance - Power Anomaly Detection description: Detect unusual power consumption patterns that might indicate issues mode: parallel trigger: - platform: numeric_state entity_id: sensor.dishwasher_electric_consumption_w above: 2000 - platform: numeric_state entity_id: sensor.washing_machine_electric_consumption_w above: 2500 action: - service: notify.alexa_media_everywhere data: message: 'Attention: {{ trigger.to_state.attributes.friendly_name if trigger.to_state else ''Unknown device'' }} is consuming {{ trigger.to_state.state if trigger.to_state else ''0'' }} watts, which is unusually high. Please check the appliance. ' data: type: announce - service: persistent_notification.create data: title: ⚠️ High Power Consumption Alert message: '{{ trigger.to_state.attributes.friendly_name if trigger.to_state else ''Unknown device'' }} consuming {{ trigger.to_state.state if trigger.to_state else ''0'' }}W at {{ now().strftime(''%H:%M'') }} ' notification_id: power_anomaly_{{ trigger.entity_id.split('.')[1] }} - alias: Appliance - Stuck Cycle Detection description: Detect cycles that run too long (possible malfunction) trigger: - platform: state entity_id: input_boolean.dishwasher_cycle_announced to: 'on' for: hours: 4 - platform: state entity_id: input_boolean.washing_machine_cycle_announced to: 'on' for: hours: 3 action: - service: notify.alexa_media_everywhere data: message: 'Attention: The {{ trigger.entity_id.split(''.'')[1].replace(''_cycle_announced'', '''').replace(''_'', '' '') }} has been running for an unusually long time. Please check if everything is okay. ' data: type: announce - service: persistent_notification.create data: title: 🕐 Long Cycle Alert message: '{{ trigger.entity_id.split(''.'')[1].replace(''_cycle_announced'', '''').replace(''_'', '' '').title() }} running for {{ (trigger.for.total_seconds() / 3600) | round(1) }} hours ' notification_id: long_cycle_{{ trigger.entity_id.split('.')[1] }} - alias: Appliance - Smart Energy Optimization description: Suggest optimal times to run appliances based on usage patterns trigger: - platform: time at: '20:30:00' condition: - condition: time weekday: - mon - tue - wed - thu - fri - condition: template value_template: "{{ states('input_boolean.dishwasher_cycle_announced') == 'off'\ \ and\n states('input_boolean.washing_machine_cycle_announced') == 'off' }}\n" action: - service: notify.alexa_media_everywhere data: message: "Energy optimization tip: Off-peak hours start at 10 PM. {% if states('sensor.dishwasher_electric_consumption_w')\ \ | float > 2 %}\n The dishwasher appears to be in standby and ready to run.\n\ {% endif %} {% if states('sensor.washing_machine_electric_consumption_w')\ \ | float > 2 %}\n The washing machine appears to be in standby and ready\ \ to run.\n{% endif %} Running appliances after 10 PM can save on energy costs.\n" data: type: announce - alias: Appliance - Error Monitoring description: Monitor for appliance errors and announce trigger: - platform: state entity_id: - sensor.dishwasher_door_status - sensor.washing_machine_status - sensor.dryer_status to: error action: - service: notify.alexa_media_everywhere data: message: 'Attention: {{ trigger.to_state.attributes.friendly_name }} is reporting an error. Please check the appliance.' data: type: announce - service: persistent_notification.create data: title: 🚨 Appliance Error message: '{{ trigger.to_state.attributes.friendly_name }} error at {{ now().strftime(''%H:%M'') }}' notification_id: appliance_error_{{ trigger.entity_id.split('.')[1] }} - alias: Appliance - Monthly Maintenance Reminder description: Monthly maintenance reminders for appliances trigger: - platform: time at: 09:00:00 condition: - condition: template value_template: '{{ now().day == 1 }}' action: - service: notify.alexa_media_everywhere data: message: 'Monthly appliance maintenance reminder: Please clean the dishwasher filter, check washing machine hoses, and clean the dryer lint trap.' data: type: announce - service: persistent_notification.create data: title: 🔧 Monthly Appliance Maintenance message: 'Time for monthly appliance maintenance: - Clean dishwasher filter - Check washing machine hoses - Clean dryer lint trap - Wipe down appliance exteriors ' notification_id: monthly_maintenance - alias: Appliance - Maintenance Tracking description: Track when maintenance tasks are completed trigger: - platform: state entity_id: - input_datetime.dishwasher_last_filter_clean - input_datetime.washing_machine_last_hose_check to: null action: - service: notify.alexa_media_everywhere data: message: Thank you for completing the {{ trigger.to_state.attributes.friendly_name.replace('Last ', '').lower() }}. Maintenance has been logged. data: type: announce - service: input_text.set_value target: entity_id: input_text.appliance_last_announcement data: value: Maintenance logged - {{ now().strftime('%H:%M') }} - id: washing_machine_started_detection_v2 alias: Washing Machine - Detect Cycle Start description: Detect when washing_machine starts a cycle trigger: - platform: state entity_id: sensor.washing_machine_status to: Running from: - Idle - Standby condition: - condition: state entity_id: input_boolean.washing_machine_running state: 'off' action: - service: input_boolean.turn_on entity_id: input_boolean.washing_machine_running - service: input_datetime.set_datetime entity_id: input_datetime.washing_machine_last_started data: datetime: '{{ now() }}' - service: input_text.set_value entity_id: input_text.washing_machine_state_reason data: value: Cycle started at {{ now().strftime('%H:%M') }} - service: input_boolean.turn_off entity_id: input_boolean.washing_machine_reminders_stopped - id: washing_machine_finished_detection_v2 alias: Washing Machine - Detect Cycle Complete description: Detect when washing_machine finishes a cycle trigger: - platform: state entity_id: sensor.washing_machine_status to: Idle for: minutes: 2 condition: - condition: state entity_id: input_boolean.washing_machine_running state: 'on' action: - service: input_boolean.turn_off entity_id: input_boolean.washing_machine_running - service: input_datetime.set_datetime entity_id: input_datetime.washing_machine_last_finished data: datetime: '{{ now() }}' - service: input_text.set_value entity_id: input_text.washing_machine_state_reason data: value: Cycle completed at {{ now().strftime('%H:%M') }} - service: script.washing_machine_notify_complete - id: washing_machine_reminder_automation_v2 alias: Washing Machine - Completion Reminders description: Send periodic reminders when cycle is complete trigger: - platform: state entity_id: binary_sensor.washing_machine_cycle_complete to: 'on' for: minutes: 5 - platform: state entity_id: binary_sensor.washing_machine_cycle_complete to: 'on' for: minutes: 15 - platform: state entity_id: binary_sensor.washing_machine_cycle_complete to: 'on' for: minutes: 30 condition: - condition: state entity_id: input_boolean.washing_machine_reminders_stopped state: 'off' - condition: state entity_id: binary_sensor.washing_machine_cycle_complete state: 'on' action: - service: script.washing_machine_send_reminder - id: washing_machine_sync_state_machine_v2 alias: Washing Machine - Sync State Machine with Power Monitoring description: Keep input_select states synchronized with power monitoring sensor trigger: - platform: state entity_id: sensor.washing_machine_status - platform: state entity_id: input_boolean.washing_machine_running action: - choose: - conditions: - condition: state entity_id: sensor.washing_machine_status state: Running sequence: - service: input_select.select_option target: entity_id: input_select.washing_machine_state data: option: Running - service: input_select.select_option target: entity_id: input_select.washing_machine_state_detailed data: option: Washing - conditions: - condition: state entity_id: sensor.washing_machine_status state: Idle - condition: state entity_id: input_boolean.washing_machine_running state: 'off' - condition: template value_template: '{{ trigger.from_state.state in [''Running'', ''Standby''] }}' sequence: - service: input_select.select_option target: entity_id: input_select.washing_machine_state data: option: Complete - service: input_select.select_option target: entity_id: input_select.washing_machine_state_detailed data: option: Complete - conditions: - condition: state entity_id: sensor.washing_machine_status state: Idle - condition: state entity_id: input_boolean.washing_machine_running state: 'off' sequence: - service: input_select.select_option target: entity_id: input_select.washing_machine_state data: option: Idle - service: input_select.select_option target: entity_id: input_select.washing_machine_state_detailed data: option: Idle - alias: AI Suggestions - Weekly Review description: Performs a weekly scan of all entities to suggest new automation opportunities trigger: - platform: time at: 03:00:00 condition: - condition: time weekday: - sun action: - service: ai_automation_suggester.generate_suggestions data: all_entities: true - service: persistent_notification.create data: title: Weekly Automation Review message: The AI Automation Suggester has completed its weekly review. Check the suggestions sensor for new automation ideas! notification_id: weekly_automation_review - id: morning_blinds_schedule alias: Morning Blinds Schedule description: Automatically open blinds in the morning trigger: - platform: time at: 07:30:00 condition: - condition: state entity_id: input_boolean.vacation_mode state: 'off' action: - service: script.morning_routine_windows - id: evening_blinds_schedule alias: Evening Blinds Schedule description: Automatically close blinds in the evening trigger: - platform: sun event: sunset offset: +00:30:00 condition: - condition: state entity_id: input_boolean.vacation_mode state: 'off' action: - service: script.evening_routine_windows - id: blinds_battery_monitor alias: Window Covering Battery Monitor description: Alert when SwitchBot devices need battery replacement trigger: - platform: numeric_state entity_id: - sensor.curtain_3_584c_battery - sensor.curtain_3_a3bd_battery - sensor.curtain_3_c019_battery - sensor.curtain_3_fb63_battery below: 20 for: hours: 1 action: - service: notify.persistent_notification data: title: Low Battery Warning message: '{{ trigger.to_state.attributes.friendly_name if trigger.to_state else ''Device'' }} battery is at {{ trigger.to_state.state if trigger.to_state else ''unknown'' }}%' notification_id: battery_{{ trigger.entity_id }}