[ { "id": "als_auto_error_cleanup", "automation": "- id: als_auto_error_cleanup\n alias: ALS - Auto Error Cleanup\n description: Automatically clears resolved errors after 1 hour\n mode: restart\n trigger:\n - trigger: time_pattern\n hours: /1\n condition:\n - condition: state\n entity_id: binary_sensor.als_system_error_detected\n state: 'on'\n action:\n - repeat:\n for_each:\n - bedroom\n - kitchen\n - bathroom\n - hallway\n - laundry\n - livingroom\n sequence:\n - variables:\n room: '{{ repeat.item }}'\n error_entity: input_text.als_error_{{ room }}\n - if:\n - condition: template\n value_template: '{{ states(error_entity) not in ['''', ''unknown'', ''unavailable'']\n }}'\n - condition: template\n value_template: '{% set room_name = room | replace(''livingroom'', ''living_room'')\n %} {% if room == ''laundry'' %}{% set room_name = ''laundry_room'' %}{%\n endif %} {% set target_sensor = ''sensor.'' ~ room_name ~ ''_target_brightness''\n %} {{ states(target_sensor) not in [''unknown'', ''unavailable''] }}'\n then:\n - action: input_text.set_value\n target:\n entity_id: '{{ error_entity }}'\n data:\n value: ''", "config": [ { "name": "ALS system error detected", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.als_system_error_detected", "device_id": null } } ] }, { "id": "als_teach_button_bridge", "automation": "- id: als_teach_button_bridge\n alias: ALS - Teach Button Bridge\n mode: single\n trigger:\n - trigger: state\n entity_id: input_button.als_teach_now\n action:\n - variables:\n sel: '{{ states(''input_select.als_teaching_room'') }}'\n room_key: \"{% set map = {\\n 'Bedroom':'bedroom',\\n 'Kitchen':'kitchen',\\n\\\n \\ 'Living Room':'livingroom',\\n 'Hallway':'hallway',\\n 'Bathroom':'bathroom',\\n\\\n \\ 'Laundry':'laundry'\\n} %} {{ map.get(sel, 'kitchen') }}\"\n brightness: '{{ states(''input_number.als_teaching_brightness'') | int(50) }}'\n - action: pyscript.als_teach_room\n data:\n room: '{{ room_key }}'\n brightness: '{{ brightness }}'\n - action: input_text.set_value\n target:\n entity_id: input_text.als_last_teach_status\n data:\n value: Taught {{ room_key }} → {{ brightness }}% at {{ now().strftime('%H:%M:%S')\n }}", "config": [ { "name": "ALS teach now button", "room": "system", "type": "input_button", "id": { "entity_id": "input_button.als_teach_now", "device_id": null } }, { "name": "ALS teaching room select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.als_teaching_room", "device_id": null } }, { "name": "ALS teaching brightness", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.als_teaching_brightness", "device_id": null } }, { "name": "ALS last teach status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_last_teach_status", "device_id": null } } ] }, { "id": "als_reload_pyscript_button", "automation": "- id: als_reload_pyscript_button\n alias: ALS - Reload Pyscript Button\n mode: single\n trigger:\n - trigger: state\n entity_id: input_button.als_reload_pyscript\n action:\n - action: pyscript.reload\n - action: input_text.set_value\n target:\n entity_id: input_text.als_last_teach_status\n data:\n value: Pyscript reloaded at {{ now().strftime('%H:%M:%S') }}", "config": [ { "name": "ALS last teach status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_last_teach_status", "device_id": null } }, { "name": "ALS reload pyscript button", "room": "system", "type": "input_button", "id": { "entity_id": "input_button.als_reload_pyscript", "device_id": null } } ] }, { "id": "als_run_test_engine_button", "automation": "- id: als_run_test_engine_button\n alias: ALS - Run Test Engine Now\n mode: single\n trigger:\n - trigger: state\n entity_id: input_button.als_run_test_engine\n action:\n - action: pyscript.parallel_test_run_now\n - action: input_text.set_value\n target:\n entity_id: input_text.als_last_teach_status\n data:\n value: Test engine wrote values at {{ now().strftime('%H:%M:%S') }}", "config": [ { "name": "ALS last teach status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_last_teach_status", "device_id": null } }, { "name": "ALS run test engine button", "room": "system", "type": "input_button", "id": { "entity_id": "input_button.als_run_test_engine", "device_id": null } } ] }, { "id": "home_state_evaluation", "automation": "- id: home_state_evaluation\n alias: Home State Evaluation\n triggers:\n - trigger: time_pattern\n minutes: /5\n - trigger: state\n entity_id:\n - binary_sensor.working_today\n - device_tracker.iphone15\n - device_tracker.work_iphone\n conditions:\n - condition: template\n value_template: '{{ not is_state(''input_select.home_state'',''Night'') }}'\n - condition: template\n value_template: '{{ not is_state(''input_boolean.manual_home_state_override'',''on'')\n }}'\n - condition: template\n value_template: '{{ states(''sensor.calculated_home_mode'') not in [''unknown'',''unavailable'']\n }}'\n actions:\n - action: script.evaluate_home_mode", "config": [ { "name": "working today sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.working_today", "device_id": null } }, { "name": "iPhone 15 tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.iphone15", "device_id": null } }, { "name": "work iPhone tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.work_iphone", "device_id": null } }, { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "manual home state override", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.manual_home_state_override", "device_id": null } }, { "name": "calculated home mode sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.calculated_home_mode", "device_id": null } } ] }, { "id": "apple_tv_night_mode_trigger", "automation": "- id: apple_tv_night_mode_trigger\n alias: Apple TV → Night Mode (20:00–23:00 Only)\n triggers:\n - trigger: state\n entity_id: media_player.bedroom\n to:\n - playing\n - paused\n - idle\n from:\n - 'off'\n - unknown\n - unavailable\n - standby\n for:\n seconds: 8\n conditions:\n - condition: time\n after: '20:00:00'\n before: '23:00:00'\n - condition: state\n entity_id: binary_sensor.both_phones_home\n state: 'on'\n - condition: state\n entity_id: input_boolean.apple_tv_bedroom_night_control\n state: 'on'\n - condition: template\n value_template: '{{ not is_state(''input_select.home_state'',''Night'') }}'\n actions:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Night", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "bedroom media player", "room": "bedroom", "type": "media_player", "id": { "entity_id": "media_player.bedroom", "device_id": null } }, { "name": "both phones home sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.both_phones_home", "device_id": null } }, { "name": "apple tv bedroom night control", "room": "bedroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.apple_tv_bedroom_night_control", "device_id": null } } ] }, { "id": "night_mode_11pm_failsafe", "automation": "- id: night_mode_11pm_failsafe\n alias: Night Mode 11 PM Failsafe\n triggers:\n - trigger: time\n at: '23:00:00'\n conditions:\n - condition: state\n entity_id: binary_sensor.both_phones_home\n state: 'on'\n - condition: template\n value_template: '{{ not is_state(''input_select.home_state'',''Night'') }}'\n actions:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Night", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "both phones home sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.both_phones_home", "device_id": null } } ] }, { "id": "learn_evening_transition_time", "automation": "- id: learn_evening_transition_time\n alias: Learn Evening Transition Time\n triggers:\n - trigger: state\n entity_id: input_boolean.evening_mode_override\n to: 'on'\n actions:\n - action: input_number.set_value\n target:\n entity_id: input_number.manual_evening_elevation_setting\n data:\n value: '{{ state_attr(''sun.sun'',''elevation'') }}'", "config": [ { "name": "evening mode override", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.evening_mode_override", "device_id": null } }, { "name": "manual evening elevation setting", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.manual_evening_elevation_setting", "device_id": null } }, { "name": "sun sun", "room": "system", "type": "sun", "id": { "entity_id": "sun.sun", "device_id": null } } ] }, { "id": "reset_evening_override_at_night", "automation": "- id: reset_evening_override_at_night\n alias: Reset Evening Override at Night\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n to: Night\n conditions:\n - condition: state\n entity_id: input_boolean.evening_mode_override\n state: 'on'\n actions:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.evening_mode_override", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "evening mode override", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.evening_mode_override", "device_id": null } } ] }, { "id": "als_end_early_morning_mode", "automation": "- id: als_end_early_morning_mode\n alias: ALS - Transition from Early Morning to Day\n triggers:\n - trigger: state\n entity_id: binary_sensor.als_morning_transition_ready\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Early Morning\n actions:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Day", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "ALS morning transition ready", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.als_morning_transition_ready", "device_id": null } } ] }, { "id": "sun_elevation_history_tracker", "automation": "- id: sun_elevation_history_tracker\n alias: Sun Elevation History Tracker\n description: Updates sun elevation history every 15 minutes for rate calculation\n triggers:\n - trigger: time_pattern\n minutes: /15\n actions:\n - action: input_number.set_value\n target:\n entity_id: input_number.sun_elevation_history\n data:\n value: '{{ state_attr(''sun.sun'',''elevation'') | float(0) }}'", "config": [ { "name": "sun elevation history", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.sun_elevation_history", "device_id": null } }, { "name": "sun sun", "room": "system", "type": "sun", "id": { "entity_id": "sun.sun", "device_id": null } } ] }, { "id": "enhanced_8am_failsafe", "automation": "- id: enhanced_8am_failsafe\n alias: Enhanced 8 AM Failsafe\n description: Force Day mode at 8 AM if not already in Day or Away mode\n triggers:\n - trigger: time\n at: 08:00:00\n conditions:\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state:\n - Day\n - Away\n - condition: state\n entity_id: binary_sensor.both_phones_home\n state: 'on'\n actions:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Day\n - action: logbook.log\n data:\n name: 8 AM Failsafe\n message: 'WARNING: Forced Day mode - system was stuck in {{ trigger.from_state.state\n }} mode'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "both phones home sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.both_phones_home", "device_id": null } } ] }, { "id": "sleep_in_ramp_start", "automation": "- id: sleep_in_ramp_start\n alias: Sleep-In Ramp - Start\n description: Starts the sleep-in ramp with calculate-once smart duration\n mode: single\n triggers:\n - trigger: state\n entity_id: input_boolean.sleep_in_ramp_active\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.sleep_in_ramp_system_enable\n state: 'on'\n - condition: state\n entity_id: input_select.home_state\n state: Night\n actions:\n - variables:\n current_sun: '{{ state_attr(''sun.sun'', ''elevation'') | float(0) }}'\n sun_rate: '{{ states(''sensor.sun_elevation_rate'') | float(0.03) }}'\n target_el: '{{ states(''input_number.current_day_threshold'') | float(10) }}'\n rate_based_minutes: '{{ ((target_el - current_sun) / sun_rate) | round(0) if\n sun_rate > 0.005 and sun_rate < 0.2 else 999 }}'\n elevation_based_minutes: '{{ states(''sensor.minutes_to_day_mode_elevation'')\n | int(999) }}'\n motion_time: '{{ now() }}'\n motion_hour: '{{ motion_time.hour }}'\n motion_minute: '{{ motion_time.minute }}'\n is_work_window: '{{ (motion_hour == 4 and motion_minute >= 50) or (motion_hour\n == 5 and motion_minute == 0) }}'\n work_base: '{{ states(''input_number.workday_ramp_base_duration'') | int(50)\n }}'\n off_base: '{{ states(''input_number.offday_ramp_base_duration'') | int(75) }}'\n base_duration: '{{ work_base if is_work_window else off_base }}'\n calculated_duration: \"{% if 10 <= rate_based_minutes <= 180 %}\\n {{ rate_based_minutes\\\n \\ }}\\n{% elif 10 <= elevation_based_minutes <= 240 %}\\n {{ elevation_based_minutes\\\n \\ }}\\n{% else %}\\n {% set season = states('sensor.current_season') %}\\n \\\n \\ {{ 60 if season == 'Winter' else 45 if season in ['Spring', 'Fall'] else\\\n \\ 30 }}\\n{% endif %}\"\n final_duration: \"{% if calculated_duration < 30 %}\\n {{ [calculated_duration\\\n \\ * 0.8, 15] | max }}\\n{% elif calculated_duration < 60 %}\\n {{ [calculated_duration\\\n \\ * 0.9, 25] | max }}\\n{% else %}\\n {% set season = states('sensor.current_season')\\\n \\ %}\\n {% set multiplier = 1.3 if season == 'Winter' else 0.8 if season ==\\\n \\ 'Summer' else 1.0 %}\\n {{ [base_duration * multiplier, 120] | min }}\\n\\\n {% endif %}\"\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.ramp_start_time\n data:\n datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'\n - action: input_number.set_value\n target:\n entity_id: input_number.calculated_ramp_duration\n data:\n value: '{{ final_duration | round(0) }}'\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.ramp_calculated_end_time\n data:\n datetime: '{{ (now() + timedelta(minutes=final_duration|int)).strftime(''%Y-%m-%d\n %H:%M:%S'') }}'\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.first_kitchen_motion_today\n data:\n datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'\n - action: input_boolean.turn_on\n target:\n entity_id: input_boolean.daily_motion_lock\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Early Morning", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "sleep in ramp active", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_active", "device_id": null } }, { "name": "sleep in ramp system enable", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_system_enable", "device_id": null } }, { "name": "sun elevation rate sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.sun_elevation_rate", "device_id": null } }, { "name": "current day threshold", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.current_day_threshold", "device_id": null } }, { "name": "minutes to day mode elevation", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.minutes_to_day_mode_elevation", "device_id": null } }, { "name": "workday ramp base duration", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.workday_ramp_base_duration", "device_id": null } }, { "name": "offday ramp base duration", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.offday_ramp_base_duration", "device_id": null } }, { "name": "current season sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.current_season", "device_id": null } }, { "name": "ramp start time", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.ramp_start_time", "device_id": null } }, { "name": "calculated ramp duration", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.calculated_ramp_duration", "device_id": null } }, { "name": "ramp calculated end time", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.ramp_calculated_end_time", "device_id": null } }, { "name": "first kitchen motion today", "room": "kitchen", "type": "input_datetime", "id": { "entity_id": "input_datetime.first_kitchen_motion_today", "device_id": null } }, { "name": "daily motion lock", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.daily_motion_lock", "device_id": null } }, { "name": "sun sun", "room": "system", "type": "sun", "id": { "entity_id": "sun.sun", "device_id": null } } ] }, { "id": "sleep_in_ramp_complete", "automation": "- id: sleep_in_ramp_complete\n alias: Sleep-In Ramp - Complete\n description: Completes the ramp when 100% progress is reached OR Day mode begins\n mode: single\n triggers:\n - trigger: template\n value_template: \"{{ is_state('input_boolean.sleep_in_ramp_active', 'on') and\\n\\\n \\ states('sensor.sleep_in_ramp_progress') | float(0) >= 100 }}\\n\"\n for:\n seconds: 5\n - trigger: state\n entity_id: sensor.calculated_home_mode\n to: Day\n conditions:\n - condition: state\n entity_id: input_boolean.sleep_in_ramp_active\n state: 'on'\n actions:\n - variables:\n motion_time_str: '{{ states(''input_datetime.first_kitchen_motion_today'') }}'\n is_non_work_day: \"{% if motion_time_str not in ['unknown', 'unavailable', '']\\\n \\ %}\\n {% set motion_time = as_datetime(motion_time_str) %}\\n {% set motion_hour\\\n \\ = motion_time.hour %}\\n {% set motion_minute = motion_time.minute %}\\n\\\n \\ {% set is_work_window = (motion_hour == 4 and motion_minute >= 50) or (motion_hour\\\n \\ == 5 and motion_minute == 0) %}\\n {{ not is_work_window }}\\n{% else %}\\n\\\n \\ {{ not is_state('binary_sensor.working_today', 'on') }}\\n{% endif %}\"\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.sleep_in_ramp_active\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Day\n - if:\n - condition: template\n value_template: '{{ is_non_work_day }}'\n - condition: state\n entity_id: input_boolean.kitchen_wled_enable\n state: 'on'\n then:\n - action: light.turn_off\n target:\n entity_id:\n - light.sink_wled\n - light.frig_strip\n - action: logbook.log\n data:\n name: WLED Control\n message: Kitchen WLED turned off at end of non-work day ramp\n - action: logbook.log\n data:\n name: Sleep-In Ramp\n message: 'Ramp complete - Triggered by: {{ trigger.platform }} | Non-work day:\n {{ is_non_work_day }}'", "config": [ { "name": "working today sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.working_today", "device_id": null } }, { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "calculated home mode sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.calculated_home_mode", "device_id": null } }, { "name": "sleep in ramp active", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_active", "device_id": null } }, { "name": "first kitchen motion today", "room": "kitchen", "type": "input_datetime", "id": { "entity_id": "input_datetime.first_kitchen_motion_today", "device_id": null } }, { "name": "sleep in ramp progress", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.sleep_in_ramp_progress", "device_id": null } }, { "name": "kitchen WLED enable", "room": "kitchen", "type": "input_boolean", "id": { "entity_id": "input_boolean.kitchen_wled_enable", "device_id": null } }, { "name": "sink WLED light", "room": "kitchen", "type": "light", "id": { "entity_id": "light.sink_wled", "device_id": null } }, { "name": "fridge strip light", "room": "kitchen", "type": "light", "id": { "entity_id": "light.frig_strip", "device_id": null } } ] }, { "id": "daily_motion_reset", "automation": "- id: daily_motion_reset\n alias: Daily Motion Reset\n description: Resets daily motion lock and tracking at midnight\n triggers:\n - trigger: time\n at: 00:00:00\n actions:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.daily_motion_lock\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.first_kitchen_motion_today\n data:\n datetime: ''", "config": [ { "name": "first kitchen motion today", "room": "kitchen", "type": "input_datetime", "id": { "entity_id": "input_datetime.first_kitchen_motion_today", "device_id": null } }, { "name": "daily motion lock", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.daily_motion_lock", "device_id": null } } ] }, { "id": "evening_temperature_ramp_start", "automation": "- id: evening_temperature_ramp_start\n alias: ALS - Evening Temperature Ramp Start\n description: Starts the evening temperature ramp when Evening mode begins\n mode: single\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n to: Evening\n conditions:\n - condition: state\n entity_id: input_boolean.enable_evening_temperature_ramp\n state: 'on'\n - condition: state\n entity_id: input_select.home_state\n state: Evening\n actions:\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.evening_ramp_started\n data:\n datetime: '{{ now() }}'\n - action: input_number.set_value\n target:\n entity_id: input_number.evening_ramp_start_temp\n data:\n value: '{{ states(''sensor.intelligent_temperature_master'') | int(4000) }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "enable evening temperature ramp", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.enable_evening_temperature_ramp", "device_id": null } }, { "name": "evening ramp started", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.evening_ramp_started", "device_id": null } }, { "name": "evening ramp start temp", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.evening_ramp_start_temp", "device_id": null } }, { "name": "intelligent temperature master", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.intelligent_temperature_master", "device_id": null } } ] }, { "id": "evening_temperature_ramp_apply_existing", "automation": "- id: evening_temperature_ramp_apply_existing\n alias: ALS - Apply Ramp to Already-On Lights\n description: Updates lights that are already on when Evening mode starts\n mode: single\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n to: Evening\n conditions:\n - condition: state\n entity_id: input_boolean.enable_evening_temperature_ramp\n state: 'on'\n actions:\n - delay:\n seconds: 2\n - if:\n - condition: or\n conditions:\n - condition: state\n entity_id: light.lamp_1\n state: 'on'\n - condition: state\n entity_id: light.lamp_2\n state: 'on'\n then:\n - action: light.turn_on\n target:\n entity_id:\n - light.lamp_1\n - light.lamp_2\n data:\n color_temp_kelvin: '{{ states(''sensor.evening_temperature_ramp'') | int(4000)\n }}'\n transition: 10\n - if:\n - condition: state\n entity_id: light.closet\n state: 'on'\n then:\n - action: light.turn_on\n target:\n entity_id: light.closet\n data:\n color_temp_kelvin: '{{ states(''sensor.evening_temperature_ramp'') | int(4000)\n }}'\n transition: 10", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "enable evening temperature ramp", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.enable_evening_temperature_ramp", "device_id": null } }, { "name": "lamp 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_1", "device_id": null } }, { "name": "lamp 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_2", "device_id": null } }, { "name": "closet light", "room": "bedroom", "type": "light", "id": { "entity_id": "light.closet", "device_id": null } }, { "name": "evening temperature ramp sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.evening_temperature_ramp", "device_id": null } } ] }, { "id": "evening_temperature_ramp_cleanup", "automation": "- id: evening_temperature_ramp_cleanup\n alias: ALS - Evening Temperature Ramp Cleanup\n description: Cleans up ramp data when Evening ends or at midnight reset\n mode: restart\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n from: Evening\n id: mode_change\n - trigger: time\n at: 00:00:00\n id: midnight_reset\n conditions:\n - condition: state\n entity_id: input_boolean.enable_evening_temperature_ramp\n state: 'on'\n actions:\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.evening_ramp_started\n data:\n datetime: ''\n - action: input_number.set_value\n target:\n entity_id: input_number.evening_ramp_start_temp\n data:\n value: 4000", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "enable evening temperature ramp", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.enable_evening_temperature_ramp", "device_id": null } }, { "name": "evening ramp started", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.evening_ramp_started", "device_id": null } }, { "name": "evening ramp start temp", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.evening_ramp_start_temp", "device_id": null } } ] }, { "id": "evening_smooth_temperature_ramp_start", "automation": "- id: evening_smooth_temperature_ramp_start\n alias: Evening - Start Smooth Temperature Ramp\n description: Starts smooth temperature ramping for all evening lights\n mode: single\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n to: Evening\n - trigger: state\n entity_id: sensor.evening_temperature_ramp\n id: sensor_change\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Evening\n - condition: state\n entity_id: input_boolean.enable_evening_temperature_ramp\n state: 'on'\n - condition: or\n conditions:\n - condition: state\n entity_id: light.lamp_1\n state: 'on'\n - condition: state\n entity_id: light.lamp_2\n state: 'on'\n - condition: state\n entity_id: light.closet\n state: 'on'\n actions:\n - action: script.turn_on\n target:\n entity_id: script.evening_smooth_temperature_ramp", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "enable evening temperature ramp", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.enable_evening_temperature_ramp", "device_id": null } }, { "name": "lamp 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_1", "device_id": null } }, { "name": "lamp 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_2", "device_id": null } }, { "name": "closet light", "room": "bedroom", "type": "light", "id": { "entity_id": "light.closet", "device_id": null } }, { "name": "evening temperature ramp sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.evening_temperature_ramp", "device_id": null } }, { "name": "Evening Smooth Temperature Ramp", "room": null, "type": "script", "id": { "entity_id": "script.evening_smooth_temperature_ramp", "device_id": null } } ] }, { "id": "evening_smooth_temperature_ramp_stop", "automation": "- id: evening_smooth_temperature_ramp_stop\n alias: Evening - Stop Smooth Temperature Ramp\n description: Stops smooth temperature ramping when Evening ends\n mode: restart\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n from: Evening\n actions:\n - action: script.turn_off\n target:\n entity_id: script.evening_smooth_temperature_ramp\n - action: logbook.log\n data:\n name: Evening Automation\n message: ✅ Evening smooth temperature ramp stopped - home state changed from\n Evening", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "Evening Smooth Temperature Ramp", "room": null, "type": "script", "id": { "entity_id": "script.evening_smooth_temperature_ramp", "device_id": null } } ] }, { "id": "kitchen_pyscript_morning_ramp_trigger", "automation": "- id: kitchen_pyscript_morning_ramp_trigger\n alias: Kitchen - Morning Ramp PyScript Trigger (motion)\n mode: single\n trigger:\n - trigger: state\n entity_id:\n - binary_sensor.aqara_motion_sensor_p1_occupancy\n - binary_sensor.kitchen_iris_frig_occupancy\n to: 'on'\n condition:\n - condition: state\n entity_id: input_boolean.sleep_in_ramp_system_enable\n state: 'on'\n - condition: state\n entity_id: input_select.home_state\n state: Night\n action:\n - action: pyscript.morning_ramp_first_motion\n data:\n sensor: '{{ trigger.entity_id }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "sleep in ramp system enable", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_system_enable", "device_id": null } }, { "name": "kitchen motion sensor P1", "room": "kitchen", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.aqara_motion_sensor_p1_occupancy", "device_id": null } }, { "name": "kitchen iris fridge occupancy", "room": "kitchen", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.kitchen_iris_frig_occupancy", "device_id": null } } ] }, { "id": "livingroom_auto_lights_main", "automation": "- id: livingroom_auto_lights_main\n alias: Living Room - Auto Control\n description: Controls living room lighting based on home state and weather\n mode: restart\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n - trigger: state\n entity_id: sensor.living_room_target_brightness\n conditions:\n - condition: state\n entity_id: input_boolean.livingroom_auto_lights_enable\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n actions:\n - variables:\n target_brightness: '{{ states(''sensor.living_room_target_brightness'') | int(0)\n }}'\n target_temperature: '{{ states(''sensor.evening_temperature_ramp'') | int(3000)\n }}'\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ target_brightness > 0 }}'\n sequence:\n - action: light.turn_on\n target:\n entity_id:\n - light.lamp_1\n - light.lamp_2\n data:\n brightness_pct: '{{ target_brightness }}'\n color_temp_kelvin: '{{ target_temperature }}'\n - conditions:\n - condition: template\n value_template: '{{ target_brightness == 0 }}'\n sequence:\n - action: light.turn_off\n target:\n entity_id:\n - light.lamp_1\n - light.lamp_2\n data:\n transition: 5", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "lamp 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_1", "device_id": null } }, { "name": "lamp 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_2", "device_id": null } }, { "name": "evening temperature ramp sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.evening_temperature_ramp", "device_id": null } }, { "name": "living room auto lights enable", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.livingroom_auto_lights_enable", "device_id": null } }, { "name": "living room target brightness", "room": "living_room", "type": "sensor", "id": { "entity_id": "sensor.living_room_target_brightness", "device_id": null } } ] }, { "id": "living_room_weather_transition", "automation": "- id: living_room_weather_transition\n alias: Living Room - Smooth Weather Transition\n description: Slowly adjusts brightness when weather conditions change and lights\n are already on.\n mode: restart\n triggers:\n - trigger: state\n entity_id: sensor.living_room_target_brightness\n conditions:\n - condition: state\n entity_id: input_boolean.enable_weather_transitions\n state: 'on'\n - condition: or\n conditions:\n - condition: state\n entity_id: light.lamp_1\n state: 'on'\n - condition: state\n entity_id: light.lamp_2\n state: 'on'\n - condition: state\n entity_id: input_select.home_state\n state: Day\n - condition: template\n value_template: '{{ (trigger.to_state.state | int(0) - trigger.from_state.state\n | int(0)) | abs > 10 }}'\n actions:\n - variables:\n transition_seconds: '{{ states(''input_number.weather_transition_duration_minutes'')\n | int(5) * 60 }}'\n - action: light.turn_on\n target:\n entity_id:\n - light.lamp_1\n - light.lamp_2\n data:\n brightness_pct: '{{ trigger.to_state.state | int(0) }}'\n transition: '{{ transition_seconds }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "lamp 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_1", "device_id": null } }, { "name": "lamp 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_2", "device_id": null } }, { "name": "living room target brightness", "room": "living_room", "type": "sensor", "id": { "entity_id": "sensor.living_room_target_brightness", "device_id": null } }, { "name": "enable weather transitions", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.enable_weather_transitions", "device_id": null } }, { "name": "weather transition duration minutes", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.weather_transition_duration_minutes", "device_id": null } } ] }, { "id": "living_room_evening_ramp_control", "automation": "- id: living_room_evening_ramp_control\n alias: Living Room - Evening Ramp Control\n description: Starts or stops the evening lighting ramp based on home state.\n mode: single\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n to: Evening\n id: start\n - trigger: state\n entity_id: input_select.home_state\n from: Evening\n id: stop\n conditions:\n - condition: state\n entity_id: input_boolean.living_room_evening_ramp_enabled\n state: 'on'\n actions:\n - choose:\n - conditions:\n - condition: trigger\n id: start\n sequence:\n - action: script.turn_on\n target:\n entity_id: script.als_living_room_evening_ramp\n - conditions:\n - condition: trigger\n id: stop\n sequence:\n - action: script.turn_off\n target:\n entity_id: script.als_living_room_evening_ramp", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "living room evening ramp enabled", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.living_room_evening_ramp_enabled", "device_id": null } }, { "name": "ALS Living Room Evening Ramp", "room": "Living Room", "type": "script", "id": { "entity_id": "script.als_living_room_evening_ramp", "device_id": null } } ] }, { "id": "laundry_motion_lights", "automation": "- id: laundry_motion_lights\n alias: Laundry Room - Motion Lights\n description: Motion-triggered lighting with adaptive/intelligent brightness control\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.laundry_iris_occupancy\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.laundry_motion_automation\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n - condition: template\n value_template: \"{{ trigger.from_state is not none and\\n trigger.from_state.state\\\n \\ not in ['unknown', 'unavailable'] }}\\n\"\n actions:\n - action: light.turn_on\n target:\n entity_id: light.laundry_room\n data:\n brightness_pct: '{{ states(''sensor.laundry_room_target_brightness'') | int\n }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "laundry iris occupancy", "room": "laundry_room", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.laundry_iris_occupancy", "device_id": null } }, { "name": "laundry motion automation", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.laundry_motion_automation", "device_id": null } }, { "name": "laundry room light", "room": "laundry_room", "type": "light", "id": { "entity_id": "light.laundry_room", "device_id": null } }, { "name": "laundry room target brightness", "room": "laundry_room", "type": "sensor", "id": { "entity_id": "sensor.laundry_room_target_brightness", "device_id": null } } ] }, { "id": "laundry_motion_off", "automation": "- id: laundry_motion_off\n alias: Laundry Room - Motion Off\n description: Turns off laundry lights after motion timeout\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.laundry_iris_occupancy\n to: 'off'\n for:\n seconds: '{{ states(''input_number.laundry_motion_timeout'') | int(30) }}'\n conditions:\n - condition: state\n entity_id: input_boolean.laundry_motion_automation\n state: 'on'\n - condition: state\n entity_id: light.laundry_room\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n actions:\n - action: light.turn_off\n target:\n entity_id: light.laundry_room\n data:\n transition: 3", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "laundry iris occupancy", "room": "laundry_room", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.laundry_iris_occupancy", "device_id": null } }, { "name": "laundry motion automation", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.laundry_motion_automation", "device_id": null } }, { "name": "laundry room light", "room": "laundry_room", "type": "light", "id": { "entity_id": "light.laundry_room", "device_id": null } }, { "name": "laundry motion timeout", "room": "laundry_room", "type": "input_number", "id": { "entity_id": "input_number.laundry_motion_timeout", "device_id": null } } ] }, { "id": "laundry_mode_transitions", "automation": "- id: laundry_mode_transitions\n alias: Laundry Room - Mode Transitions\n description: Handles lighting changes when home mode changes\n mode: restart\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n actions:\n - choose:\n - conditions: '{{ trigger.to_state.state == ''Away'' }}'\n sequence:\n - action: light.turn_off\n target:\n entity_id: light.laundry_room\n - conditions: '{{ trigger.to_state.state == ''Night'' and is_state(''light.laundry_room'',\n ''on'') }}'\n sequence:\n - action: light.turn_on\n target:\n entity_id: light.laundry_room\n data:\n brightness_pct: '{{ states(''sensor.laundry_room_target_brightness'') |\n int }}'\n transition: 5", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "laundry room light", "room": "laundry_room", "type": "light", "id": { "entity_id": "light.laundry_room", "device_id": null } }, { "name": "laundry room target brightness", "room": "laundry_room", "type": "sensor", "id": { "entity_id": "sensor.laundry_room_target_brightness", "device_id": null } } ] }, { "id": "hallway_motion_lights", "automation": "- id: hallway_motion_lights\n alias: Hallway - Motion Lights\n description: Motion-triggered lighting with adaptive/intelligent brightness control\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.hallway_iris_occupancy\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.hallway_motion_automation\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n - condition: template\n value_template: \"{{ trigger.from_state is not none and\\n trigger.from_state.state\\\n \\ not in ['unknown', 'unavailable'] }}\\n\"\n actions:\n - action: light.turn_on\n target:\n entity_id: light.hallway\n data:\n brightness_pct: '{{ states(''sensor.hallway_target_brightness'') | int }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "hallway iris occupancy", "room": "hallway", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.hallway_iris_occupancy", "device_id": null } }, { "name": "hallway motion automation", "room": "hallway", "type": "input_boolean", "id": { "entity_id": "input_boolean.hallway_motion_automation", "device_id": null } }, { "name": "hallway light", "room": "hallway", "type": "light", "id": { "entity_id": "light.hallway", "device_id": null } }, { "name": "hallway target brightness", "room": "hallway", "type": "sensor", "id": { "entity_id": "sensor.hallway_target_brightness", "device_id": null } } ] }, { "id": "hallway_motion_off", "automation": "- id: hallway_motion_off\n alias: Hallway - Motion Off\n description: Turns off hallway lights after motion timeout\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.hallway_iris_occupancy\n to: 'off'\n for:\n seconds: '{{ states(''input_number.hallway_motion_timeout'') | int(30) }}'\n conditions:\n - condition: state\n entity_id: input_boolean.hallway_motion_automation\n state: 'on'\n - condition: state\n entity_id: light.hallway\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n actions:\n - action: light.turn_off\n target:\n entity_id: light.hallway\n data:\n transition: 3", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "hallway iris occupancy", "room": "hallway", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.hallway_iris_occupancy", "device_id": null } }, { "name": "hallway motion automation", "room": "hallway", "type": "input_boolean", "id": { "entity_id": "input_boolean.hallway_motion_automation", "device_id": null } }, { "name": "hallway light", "room": "hallway", "type": "light", "id": { "entity_id": "light.hallway", "device_id": null } }, { "name": "hallway motion timeout", "room": "hallway", "type": "input_number", "id": { "entity_id": "input_number.hallway_motion_timeout", "device_id": null } } ] }, { "id": "bedroom_motion_lights", "automation": "- id: bedroom_motion_lights\n alias: Bedroom - Motion Lights\n description: 'Primary automation: Turns on the closet light when motion is detected.'\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.bedroom_x_occupancy\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.bedroom_motion_automation\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n - condition: template\n value_template: \"{{ trigger.from_state is not none and\\n trigger.from_state.state\\\n \\ not in ['unknown', 'unavailable'] }}\\n\"\n actions:\n - action: light.turn_on\n target:\n entity_id: light.closet\n data:\n brightness_pct: '{{ states(''sensor.bedroom_target_brightness'') | int }}'\n color_temp_kelvin: '{{ state_attr(''sensor.bedroom_target_brightness'', ''temperature'')\n | int(3000) }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "closet light", "room": "bedroom", "type": "light", "id": { "entity_id": "light.closet", "device_id": null } }, { "name": "bedroom X occupancy", "room": "bedroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bedroom_x_occupancy", "device_id": null } }, { "name": "bedroom motion automation", "room": "bedroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bedroom_motion_automation", "device_id": null } }, { "name": "bedroom target brightness", "room": "bedroom", "type": "sensor", "id": { "entity_id": "sensor.bedroom_target_brightness", "device_id": null } } ] }, { "id": "bedroom_motion_off", "automation": "- id: bedroom_motion_off\n alias: Bedroom - Motion Off\n description: Turns off closet light after motion timeout.\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.bedroom_x_occupancy\n to: 'off'\n for:\n seconds: '{{ states(''input_number.bedroom_motion_timeout'') | int(30) }}'\n conditions:\n - condition: state\n entity_id: input_boolean.bedroom_motion_automation\n state: 'on'\n - condition: state\n entity_id: light.closet\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n actions:\n - action: light.turn_off\n target:\n entity_id: light.closet\n data:\n transition: 2", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "closet light", "room": "bedroom", "type": "light", "id": { "entity_id": "light.closet", "device_id": null } }, { "name": "bedroom X occupancy", "room": "bedroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bedroom_x_occupancy", "device_id": null } }, { "name": "bedroom motion automation", "room": "bedroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bedroom_motion_automation", "device_id": null } }, { "name": "bedroom motion timeout", "room": "bedroom", "type": "input_number", "id": { "entity_id": "input_number.bedroom_motion_timeout", "device_id": null } } ] }, { "id": "bedroom_mode_transitions", "automation": "- id: bedroom_mode_transitions\n alias: Bedroom - Mode Transitions\n description: Handles lighting changes when home mode changes (e.g., to Away or Night).\n mode: restart\n triggers:\n - trigger: state\n entity_id: input_select.home_state\n actions:\n - choose:\n - conditions: '{{ trigger.to_state.state == ''Away'' }}'\n sequence:\n - action: light.turn_off\n target:\n entity_id: light.closet\n - conditions: '{{ trigger.to_state.state == ''Night'' and is_state(''light.closet'',\n ''on'') }}'\n sequence:\n - action: light.turn_on\n target:\n entity_id: light.closet\n data:\n brightness_pct: '{{ states(''sensor.bedroom_target_brightness'') | int }}'\n color_temp_kelvin: '{{ state_attr(''sensor.bedroom_target_brightness'',\n ''temperature'') | int(3000) }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "closet light", "room": "bedroom", "type": "light", "id": { "entity_id": "light.closet", "device_id": null } }, { "name": "bedroom target brightness", "room": "bedroom", "type": "sensor", "id": { "entity_id": "sensor.bedroom_target_brightness", "device_id": null } } ] }, { "id": "bathroom_motion_on", "automation": "- id: bathroom_motion_on\n alias: Bathroom - Motion Detected\n mode: single\n triggers:\n - trigger: state\n entity_id: binary_sensor.bathroom_motion_combined\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.bathroom_motion_automation\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n - condition: template\n value_template: \"{{ trigger.from_state is not none and\\n trigger.from_state.state\\\n \\ not in ['unknown', 'unavailable'] }}\\n\"\n actions:\n - action: light.turn_on\n target:\n entity_id: light.bathroom_2_main_lights\n data:\n brightness_pct: '{{ states(''sensor.bathroom_target_brightness'') | int }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "bathroom motion combined", "room": "bathroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bathroom_motion_combined", "device_id": null } }, { "name": "bathroom motion automation", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_motion_automation", "device_id": null } }, { "name": "bathroom 2 main lights", "room": "bathroom", "type": "light", "id": { "entity_id": "light.bathroom_2_main_lights", "device_id": null } }, { "name": "bathroom target brightness", "room": "bathroom", "type": "sensor", "id": { "entity_id": "sensor.bathroom_target_brightness", "device_id": null } } ] }, { "id": "bathroom_door_closes", "automation": "- id: bathroom_door_closes\n alias: Bathroom - Door Closes\n description: When door closes, set lights to 100% and enable hold mode\n mode: single\n triggers:\n - trigger: state\n entity_id: binary_sensor.bathroom_contact_contact\n to: 'off'\n for:\n seconds: 2\n conditions:\n - condition: state\n entity_id: input_boolean.bathroom_motion_automation\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n actions:\n - action: input_boolean.turn_on\n target:\n entity_id: input_boolean.bathroom_100_percent_hold\n - action: light.turn_on\n target:\n entity_id: light.bathroom_2_main_lights\n data:\n brightness_pct: 100", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "bathroom motion automation", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_motion_automation", "device_id": null } }, { "name": "bathroom 2 main lights", "room": "bathroom", "type": "light", "id": { "entity_id": "light.bathroom_2_main_lights", "device_id": null } }, { "name": "bathroom contact sensor", "room": "bathroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bathroom_contact_contact", "device_id": null } }, { "name": "bathroom 100 percent hold", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_100_percent_hold", "device_id": null } } ] }, { "id": "bathroom_door_opens", "automation": "- id: bathroom_door_opens\n alias: Bathroom - Door Opens\n description: When door opens, disable hold mode and transition lights back to smart\n brightness\n mode: single\n triggers:\n - trigger: state\n entity_id: binary_sensor.bathroom_contact_contact\n to: 'on'\n for:\n seconds: 2\n conditions:\n - condition: state\n entity_id: input_boolean.bathroom_motion_automation\n state: 'on'\n - condition: state\n entity_id: light.bathroom_2_main_lights\n state: 'on'\n - condition: not\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Away\n actions:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.bathroom_100_percent_hold\n - action: light.turn_on\n target:\n entity_id: light.bathroom_2_main_lights\n data:\n brightness_pct: '{{ states(''sensor.bathroom_target_brightness'') | int }}'\n transition: 5", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "bathroom motion automation", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_motion_automation", "device_id": null } }, { "name": "bathroom 2 main lights", "room": "bathroom", "type": "light", "id": { "entity_id": "light.bathroom_2_main_lights", "device_id": null } }, { "name": "bathroom target brightness", "room": "bathroom", "type": "sensor", "id": { "entity_id": "sensor.bathroom_target_brightness", "device_id": null } }, { "name": "bathroom contact sensor", "room": "bathroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bathroom_contact_contact", "device_id": null } }, { "name": "bathroom 100 percent hold", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_100_percent_hold", "device_id": null } } ] }, { "id": "bathroom_motion_clear", "automation": "- id: bathroom_motion_clear\n alias: Bathroom - Motion Clears\n description: Turn off lights after 30s of no motion, but ONLY if door is open\n mode: restart\n triggers:\n - trigger: state\n entity_id: binary_sensor.bathroom_motion_combined\n to: 'off'\n for:\n seconds: 30\n conditions:\n - condition: state\n entity_id: input_boolean.bathroom_motion_automation\n state: 'on'\n - condition: state\n entity_id: light.bathroom_2_main_lights\n state: 'on'\n - condition: state\n entity_id: binary_sensor.bathroom_contact_contact\n state: 'on'\n actions:\n - action: light.turn_off\n target:\n entity_id: light.bathroom_2_main_lights\n data:\n transition: 3", "config": [ { "name": "bathroom motion combined", "room": "bathroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bathroom_motion_combined", "device_id": null } }, { "name": "bathroom motion automation", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_motion_automation", "device_id": null } }, { "name": "bathroom 2 main lights", "room": "bathroom", "type": "light", "id": { "entity_id": "light.bathroom_2_main_lights", "device_id": null } }, { "name": "bathroom contact sensor", "room": "bathroom", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.bathroom_contact_contact", "device_id": null } } ] }, { "id": "bathroom_hold_mode_timeout", "automation": "- id: bathroom_hold_mode_timeout\n alias: Bathroom - Hold Mode Timeout Failsafe\n description: Turns off 100% hold mode after a set duration to prevent it getting\n stuck\n mode: single\n triggers:\n - trigger: state\n entity_id: input_boolean.bathroom_100_percent_hold\n to: 'on'\n for:\n minutes: '{{ states(''input_number.bathroom_hold_timeout'') | int(30) }}'\n conditions:\n - condition: state\n entity_id: input_boolean.bathroom_100_percent_hold\n state: 'on'\n actions:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.bathroom_100_percent_hold\n - action: logbook.log\n data:\n name: Bathroom Hold Mode\n message: ⏰ Hold mode timed out and was automatically disabled.", "config": [ { "name": "bathroom 100 percent hold", "room": "bathroom", "type": "input_boolean", "id": { "entity_id": "input_boolean.bathroom_100_percent_hold", "device_id": null } }, { "name": "bathroom hold timeout", "room": "bathroom", "type": "input_number", "id": { "entity_id": "input_number.bathroom_hold_timeout", "device_id": null } } ] }, { "id": "als_system_error_capture", "automation": "- id: als_system_error_capture\n alias: ALS - System Error Capture\n description: Captures system log errors and classifies them by room/system\n mode: queued\n max_exceeded: silent\n triggers:\n - trigger: event\n event_type: system_log_event\n event_data:\n level: ERROR\n - trigger: event\n event_type: system_log_event\n event_data:\n level: CRITICAL\n - trigger: event\n event_type: system_log_event\n event_data:\n level: WARNING\n conditions:\n - condition: state\n entity_id: input_boolean.als_diagnostics_enabled\n state: 'on'\n actions:\n - action: pyscript.process_als_error\n data:\n message: '{{ trigger.event.data.message }}'\n level: '{{ trigger.event.data.level }}'\n source: '{{ trigger.event.data.name | default(''Unknown'') }}'", "config": [ { "name": "ALS diagnostics enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.als_diagnostics_enabled", "device_id": null } } ] }, { "id": "routine_timing_capture", "automation": "- id: routine_timing_capture\n alias: Routine Timing - Completion Detection\n description: Detects routine completion when living room lights are turned off during\n Early Morning mode\n mode: single\n triggers:\n - trigger: state\n entity_id:\n - light.lamp_1\n - light.lamp_2\n to: 'off'\n for:\n seconds: 5\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Early Morning\n - condition: state\n entity_id: light.lamp_1\n state: 'off'\n - condition: state\n entity_id: light.lamp_2\n state: 'off'\n - condition: template\n value_template: \"{{ (now() - states.light.lamp_1.last_changed).total_seconds()\\\n \\ > 30 and\\n (now() - states.light.lamp_2.last_changed).total_seconds() >\\\n \\ 30 }}\\n\"\n actions:\n - variables:\n completion_time: '{{ now().strftime(''%H:%M:%S'') }}'\n day_type: '{{ ''work'' if is_state(''binary_sensor.workday_sensor'', ''on'')\n else ''weekend'' }}\n\n '\n - action: pyscript.store_routine_timing\n data:\n completion_time_str: '{{ completion_time }}'\n confidence_pct: 90.0\n - action: logbook.log\n data:\n name: Routine Learning\n message: 📊 Captured routine completion at {{ completion_time }} ({{ day_type\n }} day)\n - if:\n - condition: state\n entity_id: input_boolean.als_verbose_logging\n state: 'on'\n then:\n - action: notify.persistent_notification\n data:\n title: 🎯 Routine Learning\n message: Learned routine completion at {{ completion_time }} on {{ day_type\n }} day\n data:\n tag: routine_learning", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "lamp 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_1", "device_id": null } }, { "name": "lamp 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.lamp_2", "device_id": null } }, { "name": "ALS verbose logging", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.als_verbose_logging", "device_id": null } }, { "name": "workday sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.workday_sensor", "device_id": null } } ] }, { "id": "manual_routine_completion", "automation": "- id: manual_routine_completion\n alias: Routine Timing - Manual Completion\n description: Manually trigger routine completion capture\n triggers:\n - trigger: state\n entity_id: input_boolean.manual_routine_capture\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_select.home_state\n state: Early Morning\n actions:\n - variables:\n completion_time: '{{ now().strftime(''%H:%M:%S'') }}'\n - action: pyscript.store_routine_timing\n data:\n completion_time_str: '{{ completion_time }}'\n confidence_pct: 75.0\n - action: logbook.log\n data:\n name: Routine Learning\n message: 📊 Manual routine completion captured at {{ completion_time }}\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.manual_routine_capture", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "manual routine capture", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.manual_routine_capture", "device_id": null } } ] }, { "id": "health_pills_auto_refresh", "automation": "- id: health_pills_auto_refresh\n alias: Health Pills Auto Refresh\n description: Automatically refresh health pills when error feeds are updated\n mode: queued\n max_exceeded: silent\n triggers:\n - trigger: state\n entity_id:\n - input_text.als_error_feed_kitchen\n - input_text.als_error_feed_bedroom\n - input_text.als_error_feed_livingroom\n - input_text.als_error_feed_bathroom\n - input_text.als_error_feed_hallway\n - input_text.als_error_feed_laundry\n - trigger: state\n entity_id:\n - input_text.als_error_kitchen\n - input_text.als_error_bedroom\n - input_text.als_error_livingroom\n - input_text.als_error_bathroom\n - input_text.als_error_hallway\n - input_text.als_error_laundry\n conditions:\n - condition: template\n value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'\n actions:\n - delay: 00:00:01\n - action: pyscript.refresh_all_health_calculations\n data: {}", "config": [ { "name": "ALS Error Bathroom", "room": "Bathroom", "type": "input_text", "id": { "entity_id": "input_text.als_error_bathroom", "device_id": null } }, { "name": "ALS Error Bedroom", "room": "Bedroom", "type": "input_text", "id": { "entity_id": "input_text.als_error_bedroom", "device_id": null } }, { "name": "ALS Error Feed Bathroom", "room": "Bathroom", "type": "input_text", "id": { "entity_id": "input_text.als_error_feed_bathroom", "device_id": null } }, { "name": "ALS Error Feed Bedroom", "room": "Bedroom", "type": "input_text", "id": { "entity_id": "input_text.als_error_feed_bedroom", "device_id": null } }, { "name": "ALS Error Feed Hallway", "room": "Hallway", "type": "input_text", "id": { "entity_id": "input_text.als_error_feed_hallway", "device_id": null } }, { "name": "ALS Error Feed Kitchen", "room": "Kitchen", "type": "input_text", "id": { "entity_id": "input_text.als_error_feed_kitchen", "device_id": null } }, { "name": "ALS Error Feed Laundry", "room": "Laundry", "type": "input_text", "id": { "entity_id": "input_text.als_error_feed_laundry", "device_id": null } }, { "name": "ALS Error Feed Living Room", "room": "Living Room", "type": "input_text", "id": { "entity_id": "input_text.als_error_feed_livingroom", "device_id": null } }, { "name": "ALS Error Hallway", "room": "Hallway", "type": "input_text", "id": { "entity_id": "input_text.als_error_hallway", "device_id": null } }, { "name": "ALS Error Kitchen", "room": "Kitchen", "type": "input_text", "id": { "entity_id": "input_text.als_error_kitchen", "device_id": null } }, { "name": "ALS Error Laundry", "room": "Laundry", "type": "input_text", "id": { "entity_id": "input_text.als_error_laundry", "device_id": null } }, { "name": "ALS Error Living Room", "room": "Living Room", "type": "input_text", "id": { "entity_id": "input_text.als_error_livingroom", "device_id": null } } ] }, { "id": "periodic_health_validation", "automation": "- id: periodic_health_validation\n alias: Periodic Health System Validation\n description: Run health system tests every 6 hours\n triggers:\n - trigger: time_pattern\n hours: /6\n conditions:\n - condition: state\n entity_id: input_boolean.health_monitoring_auto_test\n state: 'on'\n actions:\n - action: script.verify_health_system_accuracy\n data: {}", "config": [ { "name": "Health Monitoring Auto Test", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.health_monitoring_auto_test", "device_id": null } } ] }, { "id": "smart_health_status_notifications", "automation": "- id: smart_health_status_notifications\n alias: Smart Health Status Notifications\n description: Context-aware notifications for health status changes with cooldown\n management\n mode: single\n max_exceeded: silent\n triggers:\n - trigger: state\n entity_id: sensor.global_health_status\n for:\n seconds: 30\n conditions:\n - condition: state\n entity_id: input_boolean.smart_notifications_enabled\n state: 'on'\n - condition: template\n value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'\n - condition: template\n value_template: '{{ trigger.from_state.state not in [''unknown'', ''unavailable'']\n }}'\n actions:\n - action: pyscript.handle_health_status_notification\n data:\n current_status: '{{ trigger.to_state.state }}'\n previous_status: '{{ trigger.from_state.state }}'\n status_attributes: \"{{\\n {\\n 'status_text': state_attr('sensor.global_health_status',\\\n \\ 'status_text'),\\n 'affected_rooms': state_attr('sensor.global_health_status',\\\n \\ 'affected_rooms'),\\n 'total_error_count': state_attr('sensor.global_health_status',\\\n \\ 'total_error_count'),\\n 'summary': state_attr('sensor.global_health_status',\\\n \\ 'summary')\\n } | to_json\\n}}\"", "config": [ { "name": "smart notifications enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_notifications_enabled", "device_id": null } }, { "name": "global health status", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.global_health_status", "device_id": null } } ] }, { "id": "test_smart_notifications", "automation": "- id: test_smart_notifications\n alias: Test Smart Notifications\n description: Manual trigger to test notification system\n mode: single\n triggers:\n - trigger: state\n entity_id: input_boolean.notification_debug_mode\n from: 'off'\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.smart_notifications_enabled\n state: 'on'\n actions:\n - action: pyscript.test_notification_system\n data: {}\n - delay: 00:00:05\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.notification_debug_mode", "config": [ { "name": "smart notifications enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_notifications_enabled", "device_id": null } }, { "name": "notification debug mode", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.notification_debug_mode", "device_id": null } } ] }, { "id": "update_quiet_hours_status", "automation": "- id: update_quiet_hours_status\n alias: Update Quiet Hours Status\n description: Track whether we're currently in quiet hours\n mode: single\n triggers:\n - trigger: time_pattern\n minutes: '*'\n - trigger: state\n entity_id:\n - input_datetime.quiet_hours_start\n - input_datetime.quiet_hours_end\n - input_boolean.quiet_hours_enabled\n actions:\n - action: pyscript.update_quiet_hours_status\n data: {}", "config": [ { "name": "quiet hours start", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.quiet_hours_start", "device_id": null } }, { "name": "quiet hours end", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.quiet_hours_end", "device_id": null } }, { "name": "quiet hours enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.quiet_hours_enabled", "device_id": null } } ] }, { "id": "diagnostic_dashboard_auto_refresh", "automation": "- id: diagnostic_dashboard_auto_refresh\n alias: Diagnostic Dashboard Auto Refresh\n description: Automatically refresh dashboard when key data changes\n mode: queued\n max_exceeded: silent\n triggers:\n - trigger: state\n entity_id:\n - sensor.global_health_status\n - input_text.als_learning_status\n - input_text.learning_performance_metrics\n - trigger: time_pattern\n minutes: /5\n conditions:\n - condition: state\n entity_id: input_boolean.diagnostic_dashboard_enabled\n state: 'on'\n actions:\n - delay: 00:00:01\n - action: script.refresh_dashboard_data\n data: {}", "config": [ { "name": "global health status", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.global_health_status", "device_id": null } }, { "name": "diagnostic dashboard enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.diagnostic_dashboard_enabled", "device_id": null } }, { "name": "ALS learning status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_learning_status", "device_id": null } }, { "name": "learning performance metrics", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.learning_performance_metrics", "device_id": null } } ] }, { "id": "learning_status_monitor", "automation": "- id: learning_status_monitor\n alias: Learning Status Monitor\n description: Monitor and update ALS learning system status\n mode: restart\n triggers:\n - trigger: time_pattern\n minutes: /2\n conditions:\n - condition: state\n entity_id: input_boolean.als_diagnostics_enabled\n state: 'on'\n actions:\n - action: pyscript.update_learning_system_status\n data: {}\n - action: pyscript.update_learning_performance_metrics\n data: {}", "config": [ { "name": "ALS diagnostics enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.als_diagnostics_enabled", "device_id": null } } ] }, { "id": "health_status_change_handler", "automation": "- id: health_status_change_handler\n alias: Health Status Change Handler\n description: Handle health status changes with smart notifications\n mode: queued\n triggers:\n - trigger: state\n entity_id: sensor.global_health_status\n from:\n - 🟩\n - 🟨\n - 🟥\n to:\n - 🟩\n - 🟨\n - 🟥\n conditions:\n - condition: template\n value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'\n - condition: state\n entity_id: input_boolean.smart_notifications_enabled\n state: 'on'\n actions:\n - delay: 00:00:30\n - action: pyscript.handle_health_status_notification\n data:\n current_status: '{{ trigger.to_state.state }}'\n previous_status: '{{ trigger.from_state.state }}'\n status_attributes: '{{ trigger.to_state.attributes | to_json }}'", "config": [ { "name": "smart notifications enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_notifications_enabled", "device_id": null } }, { "name": "global health status", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.global_health_status", "device_id": null } } ] }, { "id": "quiet_hours_status_updater", "automation": "- id: quiet_hours_status_updater\n alias: Quiet Hours Status Updater\n description: Update quiet hours suppression status\n mode: restart\n triggers:\n - trigger: time_pattern\n minutes: /5\n - trigger: state\n entity_id:\n - input_boolean.quiet_hours_enabled\n - input_datetime.quiet_hours_start\n - input_datetime.quiet_hours_end\n actions:\n - action: pyscript.update_quiet_hours_status\n data: {}", "config": [ { "name": "quiet hours start", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.quiet_hours_start", "device_id": null } }, { "name": "quiet hours end", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.quiet_hours_end", "device_id": null } }, { "name": "quiet hours enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.quiet_hours_enabled", "device_id": null } } ] }, { "id": "diagnostic_system_maintenance", "automation": "- id: diagnostic_system_maintenance\n alias: Diagnostic System Maintenance\n description: Periodic maintenance and cleanup for diagnostic system\n triggers:\n - trigger: time_pattern\n hours: /4\n conditions:\n - condition: state\n entity_id: input_boolean.als_diagnostics_enabled\n state: 'on'\n actions:\n - action: pyscript.perform_diagnostic_maintenance\n data: {}\n - action: script.refresh_dashboard_data\n data: {}", "config": [ { "name": "ALS diagnostics enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.als_diagnostics_enabled", "device_id": null } } ] }, { "id": "diagnostic_config_change_handler", "automation": "- id: diagnostic_config_change_handler\n alias: Diagnostic Configuration Change Handler\n description: Handle configuration changes and refresh system\n mode: restart\n triggers:\n - trigger: state\n entity_id:\n - input_number.error_retention_days\n - input_number.max_errors_per_room\n - input_number.health_check_interval\n - input_number.error_threshold_warning\n - input_number.error_threshold_critical\n actions:\n - delay: 00:00:02\n - action: script.refresh_dashboard_data\n data: {}\n - action: logbook.log\n data:\n name: ALS Diagnostics\n message: ⚙️ Configuration updated - dashboard refreshed", "config": [ { "name": "error retention days", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.error_retention_days", "device_id": null } }, { "name": "max errors per room", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.max_errors_per_room", "device_id": null } }, { "name": "health check interval", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.health_check_interval", "device_id": null } }, { "name": "error threshold warning", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.error_threshold_warning", "device_id": null } }, { "name": "error threshold critical", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.error_threshold_critical", "device_id": null } } ] }, { "id": "maintenance_periodic_health_check", "automation": "- id: maintenance_periodic_health_check\n alias: 'Maintenance: Periodic Health Check'\n description: Run health validation every 15 minutes\n trigger:\n - platform: time_pattern\n minutes: /15\n condition:\n - condition: state\n entity_id: input_boolean.maintenance_auto_cleanup_enabled\n state: 'on'\n action:\n - service: pyscript.maintenance_health_check\n data:\n debug_mode: '{{ is_state(''input_boolean.maintenance_debug_mode'', ''on'') }}'\n - service: logbook.log\n data:\n name: ALS Maintenance\n message: Periodic health check completed", "config": [ { "name": "maintenance auto cleanup enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_auto_cleanup_enabled", "device_id": null } }, { "name": "maintenance debug mode", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_debug_mode", "device_id": null } } ] }, { "id": "maintenance_periodic_cleanup", "automation": "- id: maintenance_periodic_cleanup\n alias: 'Maintenance: Automated Cleanup'\n description: Run automated cleanup based on configured interval\n trigger:\n - platform: time_pattern\n hours: /1\n condition:\n - condition: state\n entity_id: input_boolean.maintenance_auto_cleanup_enabled\n state: 'on'\n - condition: template\n value_template: \"{% set last_cleanup = states('input_datetime.maintenance_last_cleanup_time')\\\n \\ %} {% set interval_hours = states('input_number.maintenance_cleanup_interval_hours')\\\n \\ | int %} {% if last_cleanup == 'unknown' %}\\n true\\n{% else %}\\n {% set\\\n \\ last_time = strptime(last_cleanup, '%Y-%m-%d %H:%M:%S') %}\\n {% set now =\\\n \\ now() %}\\n {% set hours_since = (now - last_time).total_seconds() / 3600\\\n \\ %}\\n {{ hours_since >= interval_hours }}\\n{% endif %}\\n\"\n action:\n - service: pyscript.maintenance_automated_cleanup\n data:\n retention_days: '{{ states(''input_number.maintenance_error_retention_days'')\n | int }}'\n max_entries: '{{ states(''input_number.maintenance_max_error_entries'') | int\n }}'\n debug_mode: '{{ is_state(''input_boolean.maintenance_debug_mode'', ''on'') }}'\n - service: input_datetime.set_datetime\n target:\n entity_id: input_datetime.maintenance_last_cleanup_time\n data:\n datetime: '{{ now() }}'\n - service: counter.increment\n target:\n entity_id: counter.maintenance_cleanup_runs\n - service: logbook.log\n data:\n name: ALS Maintenance\n message: Automated cleanup completed", "config": [ { "name": "maintenance auto cleanup enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_auto_cleanup_enabled", "device_id": null } }, { "name": "maintenance debug mode", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_debug_mode", "device_id": null } }, { "name": "maintenance last cleanup time", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.maintenance_last_cleanup_time", "device_id": null } }, { "name": "maintenance cleanup interval hours", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.maintenance_cleanup_interval_hours", "device_id": null } }, { "name": "maintenance error retention days", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.maintenance_error_retention_days", "device_id": null } }, { "name": "maintenance max error entries", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.maintenance_max_error_entries", "device_id": null } }, { "name": "Maintenance Cleanup Runs", "room": null, "type": "counter", "id": { "entity_id": "counter.maintenance_cleanup_runs", "device_id": null } } ] }, { "id": "maintenance_performance_alert", "automation": "- id: maintenance_performance_alert\n alias: 'Maintenance: Performance Alert'\n description: Alert when system performance is degraded\n trigger:\n - platform: numeric_state\n entity_id: sensor.maintenance_system_health\n below: 50\n for:\n minutes: 5\n condition:\n - condition: state\n entity_id: input_boolean.maintenance_performance_monitoring\n state: 'on'\n action:\n - service: persistent_notification.create\n data:\n title: ALS System Performance Warning\n message: 'System health is at {{ states(''sensor.maintenance_system_health'')\n }}%. Consider running manual cleanup or adjusting retention settings.\n\n '\n notification_id: als_performance_warning\n - service: logbook.log\n data:\n name: ALS Maintenance\n message: 'Performance alert triggered - Health: {{ states(''sensor.maintenance_system_health'')\n }}%'\n entity_id: sensor.maintenance_system_health", "config": [ { "name": "maintenance performance monitoring", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_performance_monitoring", "device_id": null } }, { "name": "maintenance system health", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.maintenance_system_health", "device_id": null } } ] }, { "id": "maintenance_data_buildup_prevention", "automation": "- id: maintenance_data_buildup_prevention\n alias: 'Maintenance: Data Buildup Prevention'\n description: Prevent excessive data buildup\n trigger:\n - platform: numeric_state\n entity_id: sensor.als_total_error_count\n above: '{{ states(''input_number.maintenance_max_error_entries'') | int }}'\n condition:\n - condition: state\n entity_id: input_boolean.maintenance_auto_cleanup_enabled\n state: 'on'\n action:\n - service: pyscript.maintenance_emergency_cleanup\n data:\n target_count: '{{ (states(''input_number.maintenance_max_error_entries'') |\n int * 0.8) | int }}'\n debug_mode: '{{ is_state(''input_boolean.maintenance_debug_mode'', ''on'') }}'\n - service: persistent_notification.create\n data:\n title: ALS Emergency Cleanup Triggered\n message: 'Error count exceeded limit. Emergency cleanup performed. Reduced to\n {{ (states(''input_number.maintenance_max_error_entries'') | int * 0.8) |\n int }} entries.\n\n '\n notification_id: als_emergency_cleanup\n - service: logbook.log\n data:\n name: ALS Maintenance\n message: Emergency cleanup triggered - Error count exceeded limit", "config": [ { "name": "maintenance auto cleanup enabled", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_auto_cleanup_enabled", "device_id": null } }, { "name": "maintenance debug mode", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.maintenance_debug_mode", "device_id": null } }, { "name": "maintenance max error entries", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.maintenance_max_error_entries", "device_id": null } }, { "name": "ALS total error count", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.als_total_error_count", "device_id": null } } ] }, { "id": "unlock_door_on_arrival", "automation": "- id: unlock_door_on_arrival\n alias: Unlock door when either iPhone arrives home\n description: Auto unlock front door when either phone enters home zone\n triggers:\n - trigger: zone\n entity_id: device_tracker.iphone15\n zone: zone.home\n event: enter\n - trigger: zone\n entity_id: device_tracker.work_iphone\n zone: zone.home\n event: enter\n conditions:\n - condition: state\n entity_id: input_boolean.smart_lock_auto_unlock\n state: 'on'\n actions:\n - action: lock.unlock\n target:\n entity_id: lock.aqara_smart_lock_u100_lock\n - action: notify.mobile_app_iphone15\n data:\n message: The front door was unlocked.\n - action: notify.mobile_app_rrvqklh23h_iphone\n data:\n message: The front door was unlocked.\n mode: single", "config": [ { "name": "iPhone 15 tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.iphone15", "device_id": null } }, { "name": "work iPhone tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.work_iphone", "device_id": null } }, { "name": "smart lock auto unlock", "room": "entryway", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_lock_auto_unlock", "device_id": null } }, { "name": "Aqara smart lock U100", "room": "entryway", "type": "lock", "id": { "entity_id": "lock.aqara_smart_lock_u100_lock", "device_id": null } } ] }, { "id": "smart_switch_1_manual_amber_activate", "automation": "- id: smart_switch_1_manual_amber_activate\n alias: Smart Switch 1 - Manual Amber Activate\n triggers:\n - trigger: state\n entity_id: input_boolean.smart_switch_1_manual_amber_trigger\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.smart_switch_1_amber_mode_enable\n state: 'on'\n actions:\n - action: script.smart_switch_1_amber_sequence\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.smart_switch_1_manual_amber_trigger\n - action: logbook.log\n data:\n name: Smart Switch 1 Amber\n message: Manual amber mode activated\n entity_id: light.smart_switch_1", "config": [ { "name": "smart switch 1 manual amber trigger", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_1_manual_amber_trigger", "device_id": null } }, { "name": "smart switch 1 amber mode enable", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_1_amber_mode_enable", "device_id": null } }, { "name": "smart switch 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_1", "device_id": null } } ] }, { "id": "smart_switch_2_manual_amber_activate", "automation": "- id: smart_switch_2_manual_amber_activate\n alias: Smart Switch 2 - Manual Amber Activate\n triggers:\n - trigger: state\n entity_id: input_boolean.smart_switch_2_manual_amber_trigger\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.smart_switch_2_amber_mode_enable\n state: 'on'\n actions:\n - action: script.smart_switch_2_amber_sequence\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.smart_switch_2_manual_amber_trigger\n - action: logbook.log\n data:\n name: Smart Switch 2 Amber\n message: Manual amber mode activated\n entity_id: light.smart_switch_2", "config": [ { "name": "smart switch 2 manual amber trigger", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_2_manual_amber_trigger", "device_id": null } }, { "name": "smart switch 2 amber mode enable", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_2_amber_mode_enable", "device_id": null } }, { "name": "smart switch 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_2", "device_id": null } } ] }, { "id": "smart_switch_1_amber_button", "automation": "- id: smart_switch_1_amber_button\n alias: Smart Switch 1 - Amber Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_1_activate_amber\n actions:\n - action: script.smart_switch_1_amber_sequence", "config": [ { "name": "smart switch 1 activate amber button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_1_activate_amber", "device_id": null } } ] }, { "id": "smart_switch_1_normal_button", "automation": "- id: smart_switch_1_normal_button\n alias: Smart Switch 1 - Normal Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_1_normal_mode\n actions:\n - action: light.turn_on\n target:\n entity_id: light.smart_switch_1\n data:\n brightness_pct: 80\n color_temp_kelvin: 4000", "config": [ { "name": "smart switch 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_1", "device_id": null } }, { "name": "smart switch 1 normal mode button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_1_normal_mode", "device_id": null } } ] }, { "id": "smart_switch_2_amber_button", "automation": "- id: smart_switch_2_amber_button\n alias: Smart Switch 2 - Amber Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_2_activate_amber\n actions:\n - action: script.smart_switch_2_amber_sequence", "config": [ { "name": "smart switch 2 activate amber button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_2_activate_amber", "device_id": null } } ] }, { "id": "smart_switch_2_normal_button", "automation": "- id: smart_switch_2_normal_button\n alias: Smart Switch 2 - Normal Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_2_normal_mode\n actions:\n - action: light.turn_on\n target:\n entity_id: light.smart_switch_2\n data:\n brightness_pct: 80\n color_temp_kelvin: 4000", "config": [ { "name": "smart switch 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_2", "device_id": null } }, { "name": "smart switch 2 normal mode button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_2_normal_mode", "device_id": null } } ] }, { "id": "both_switches_amber_button", "automation": "- id: both_switches_amber_button\n alias: Both Switches - Amber Button\n triggers:\n - trigger: state\n entity_id: input_button.both_switches_amber\n actions:\n - action: script.both_switches_amber_mode", "config": [ { "name": "both switches amber button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.both_switches_amber", "device_id": null } } ] }, { "id": "both_switches_normal_button", "automation": "- id: both_switches_normal_button\n alias: Both Switches - Normal Button\n triggers:\n - trigger: state\n entity_id: input_button.both_switches_normal\n actions:\n - action: light.turn_on\n target:\n entity_id:\n - light.smart_switch_1\n - light.smart_switch_2\n data:\n brightness_pct: 80\n color_temp_kelvin: 4000", "config": [ { "name": "smart switch 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_1", "device_id": null } }, { "name": "smart switch 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_2", "device_id": null } }, { "name": "both switches normal button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.both_switches_normal", "device_id": null } } ] }, { "id": "als_auto_error_cleanup", "automation": "- id: als_auto_error_cleanup\n alias: ALS - Auto Error Cleanup\n description: Automatically clears resolved errors after 1 hour\n mode: restart\n trigger:\n - trigger: time_pattern\n hours: /1\n condition:\n - condition: state\n entity_id: binary_sensor.als_system_error_detected\n state: 'on'\n action:\n - repeat:\n for_each:\n - bedroom\n - kitchen\n - bathroom\n - hallway\n - laundry\n - livingroom\n sequence:\n - variables:\n room: '{{ repeat.item }}'\n error_entity: input_text.als_error_{{ room }}\n - if:\n - condition: template\n value_template: '{{ states(error_entity) not in ['''', ''unknown'', ''unavailable'']\n }}'\n - condition: template\n value_template: '{% set room_name = room | replace(''livingroom'', ''living_room'')\n %} {% if room == ''laundry'' %}{% set room_name = ''laundry_room'' %}{%\n endif %} {% set target_sensor = ''sensor.'' ~ room_name ~ ''_target_brightness''\n %} {{ states(target_sensor) not in [''unknown'', ''unavailable''] }}'\n then:\n - action: input_text.set_value\n target:\n entity_id: '{{ error_entity }}'\n data:\n value: ''", "config": [ { "name": "ALS system error detected", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.als_system_error_detected", "device_id": null } } ] }, { "id": "als_teach_button_bridge", "automation": "- id: als_teach_button_bridge\n alias: ALS - Teach Button Bridge\n mode: single\n trigger:\n - trigger: state\n entity_id: input_button.als_teach_now\n action:\n - variables:\n sel: '{{ states(''input_select.als_teaching_room'') }}'\n room_key: \"{% set map = {\\n 'Bedroom':'bedroom',\\n 'Kitchen':'kitchen',\\n\\\n \\ 'Living Room':'livingroom',\\n 'Hallway':'hallway',\\n 'Bathroom':'bathroom',\\n\\\n \\ 'Laundry':'laundry'\\n} %} {{ map.get(sel, 'kitchen') }}\"\n brightness: '{{ states(''input_number.als_teaching_brightness'') | int(50) }}'\n - action: pyscript.als_teach_room\n data:\n room: '{{ room_key }}'\n brightness: '{{ brightness }}'\n - action: input_text.set_value\n target:\n entity_id: input_text.als_last_teach_status\n data:\n value: Taught {{ room_key }} → {{ brightness }}% at {{ now().strftime('%H:%M:%S')\n }}", "config": [ { "name": "ALS teach now button", "room": "system", "type": "input_button", "id": { "entity_id": "input_button.als_teach_now", "device_id": null } }, { "name": "ALS teaching room select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.als_teaching_room", "device_id": null } }, { "name": "ALS teaching brightness", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.als_teaching_brightness", "device_id": null } }, { "name": "ALS last teach status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_last_teach_status", "device_id": null } } ] }, { "id": "als_reload_pyscript_button", "automation": "- id: als_reload_pyscript_button\n alias: ALS - Reload Pyscript Button\n mode: single\n trigger:\n - trigger: state\n entity_id: input_button.als_reload_pyscript\n action:\n - action: pyscript.reload\n - action: input_text.set_value\n target:\n entity_id: input_text.als_last_teach_status\n data:\n value: Pyscript reloaded at {{ now().strftime('%H:%M:%S') }}", "config": [ { "name": "ALS last teach status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_last_teach_status", "device_id": null } }, { "name": "ALS reload pyscript button", "room": "system", "type": "input_button", "id": { "entity_id": "input_button.als_reload_pyscript", "device_id": null } } ] }, { "id": "als_run_test_engine_button", "automation": "- id: als_run_test_engine_button\n alias: ALS - Run Test Engine Now\n mode: single\n trigger:\n - trigger: state\n entity_id: input_button.als_run_test_engine\n action:\n - action: pyscript.parallel_test_run_now\n - action: input_text.set_value\n target:\n entity_id: input_text.als_last_teach_status\n data:\n value: Test engine wrote values at {{ now().strftime('%H:%M:%S') }}", "config": [ { "name": "ALS last teach status", "room": "system", "type": "input_text", "id": { "entity_id": "input_text.als_last_teach_status", "device_id": null } }, { "name": "ALS run test engine button", "room": "system", "type": "input_button", "id": { "entity_id": "input_button.als_run_test_engine", "device_id": null } } ] }, { "id": "pyscript_to_home_state_ui_authoritative", "automation": "- id: pyscript_to_home_state_ui_authoritative\n alias: 'Home State (Authoritative): Controller → UI'\n mode: restart\n trigger:\n - trigger: state\n entity_id: pyscript.home_state\n condition:\n - condition: template\n value_template: '{{ states(''pyscript.home_state'') != states(''input_select.home_state'')\n }}'\n action:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: '{{ states(''pyscript.home_state'') }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "pyscript home state", "room": "system", "type": "pyscript", "id": { "entity_id": "pyscript.home_state", "device_id": null } } ] }, { "id": "home_state_ui_to_pyscript_override_only", "automation": "- id: home_state_ui_to_pyscript_override_only\n alias: 'Home State (Override Only): UI → Controller'\n mode: single\n trigger:\n - trigger: state\n entity_id: input_select.home_state\n condition:\n - condition: state\n entity_id: input_boolean.manual_home_state_override\n state: 'on'\n - condition: template\n value_template: '{{ states(''input_select.home_state'') != states(''pyscript.home_state'')\n }}'\n action:\n - action: pyscript.set_home_mode\n data:\n mode: '{{ states(''input_select.home_state'') }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "manual home state override", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.manual_home_state_override", "device_id": null } }, { "name": "pyscript home state", "room": "system", "type": "pyscript", "id": { "entity_id": "pyscript.home_state", "device_id": null } } ] }, { "id": "home_state_ui_guard_override_off_strict", "automation": "- id: home_state_ui_guard_override_off_strict\n alias: 'Home State Guard: Snap UI Back (Override OFF)'\n mode: restart\n trigger:\n - trigger: state\n entity_id: input_select.home_state\n condition:\n - condition: state\n entity_id: input_boolean.manual_home_state_override\n state: 'off'\n - condition: template\n value_template: '{{ states(''input_select.home_state'') != states(''pyscript.home_state'')\n }}'\n action:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: '{{ states(''pyscript.home_state'') }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "manual home state override", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.manual_home_state_override", "device_id": null } }, { "name": "pyscript home state", "room": "system", "type": "pyscript", "id": { "entity_id": "pyscript.home_state", "device_id": null } } ] }, { "id": "home_state_reconciler_authoritative", "automation": "- id: home_state_reconciler_authoritative\n alias: Home State Reconciler (Controller Wins)\n mode: restart\n trigger:\n - trigger: state\n entity_id: binary_sensor.home_state_diverged\n to: 'on'\n condition:\n - condition: state\n entity_id: input_boolean.manual_home_state_override\n state: 'off'\n action:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: '{{ states(''pyscript.home_state'') }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "manual home state override", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.manual_home_state_override", "device_id": null } }, { "name": "pyscript home state", "room": "system", "type": "pyscript", "id": { "entity_id": "pyscript.home_state", "device_id": null } }, { "name": "home state diverged", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.home_state_diverged", "device_id": null } } ] }, { "id": "home_state_startup_sync", "automation": "- id: home_state_startup_sync\n alias: 'Home State Startup Sync: Controller → UI'\n mode: single\n trigger:\n - trigger: homeassistant\n event: start\n - trigger: event\n event_type: pyscript_reload\n action:\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ states(''pyscript.home_state'') not in [''unknown'',''unavailable'','''']\n }}'\n sequence:\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: '{{ states(''pyscript.home_state'') }}'", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "pyscript home state", "room": "system", "type": "pyscript", "id": { "entity_id": "pyscript.home_state", "device_id": null } } ] }, { "id": "sleep_in_ramp_start", "automation": "- id: sleep_in_ramp_start\n alias: Sleep-In Ramp - Start\n description: Starts the sleep-in ramp with calculate-once smart duration\n mode: single\n triggers:\n - trigger: state\n entity_id: input_boolean.sleep_in_ramp_active\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.sleep_in_ramp_system_enable\n state: 'on'\n - condition: state\n entity_id: input_select.home_state\n state: Night\n actions:\n - variables:\n current_sun: '{{ state_attr(''sun.sun'', ''elevation'') | float(0) }}'\n sun_rate: '{{ states(''sensor.sun_elevation_rate'') | float(0.03) }}'\n target_el: '{{ states(''input_number.current_day_threshold'') | float(10) }}'\n rate_based_minutes: '{{ ((target_el - current_sun) / sun_rate) | round(0) if\n sun_rate > 0.005 and sun_rate < 0.2 else 999 }}'\n elevation_based_minutes: '{{ states(''sensor.minutes_to_day_mode_elevation'')\n | int(999) }}'\n motion_time: '{{ now() }}'\n motion_hour: '{{ motion_time.hour }}'\n motion_minute: '{{ motion_time.minute }}'\n is_work_window: '{{ (motion_hour == 4 and motion_minute >= 50) or (motion_hour\n == 5 and motion_minute == 0) }}'\n work_base: '{{ states(''input_number.workday_ramp_base_duration'') | int(50)\n }}'\n off_base: '{{ states(''input_number.offday_ramp_base_duration'') | int(75) }}'\n base_duration: '{{ work_base if is_work_window else off_base }}'\n calculated_duration: \"{% if 10 <= rate_based_minutes <= 180 %}\\n {{ rate_based_minutes\\\n \\ }}\\n{% elif 10 <= elevation_based_minutes <= 240 %}\\n {{ elevation_based_minutes\\\n \\ }}\\n{% else %}\\n {% set season = states('sensor.current_season') %}\\n \\\n \\ {{ 60 if season == 'Winter' else 45 if season in ['Spring', 'Fall'] else\\\n \\ 30 }}\\n{% endif %}\"\n final_duration: \"{% if calculated_duration < 30 %}\\n {{ [calculated_duration\\\n \\ * 0.8, 15] | max }}\\n{% elif calculated_duration < 60 %}\\n {{ [calculated_duration\\\n \\ * 0.9, 25] | max }}\\n{% else %}\\n {% set season = states('sensor.current_season')\\\n \\ %}\\n {% set multiplier = 1.3 if season == 'Winter' else 0.8 if season ==\\\n \\ 'Summer' else 1.0 %}\\n {{ [base_duration * multiplier, 120] | min }}\\n\\\n {% endif %}\"\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.ramp_start_time\n data:\n datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'\n - action: input_number.set_value\n target:\n entity_id: input_number.calculated_ramp_duration\n data:\n value: '{{ final_duration | round(0) }}'\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.ramp_calculated_end_time\n data:\n datetime: '{{ (now() + timedelta(minutes=final_duration|int)).strftime(''%Y-%m-%d\n %H:%M:%S'') }}'\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.first_kitchen_motion_today\n data:\n datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'\n - action: input_boolean.turn_on\n target:\n entity_id: input_boolean.daily_motion_lock\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Early Morning", "config": [ { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "sleep in ramp active", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_active", "device_id": null } }, { "name": "sleep in ramp system enable", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_system_enable", "device_id": null } }, { "name": "sun elevation rate sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.sun_elevation_rate", "device_id": null } }, { "name": "current day threshold", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.current_day_threshold", "device_id": null } }, { "name": "minutes to day mode elevation", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.minutes_to_day_mode_elevation", "device_id": null } }, { "name": "workday ramp base duration", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.workday_ramp_base_duration", "device_id": null } }, { "name": "offday ramp base duration", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.offday_ramp_base_duration", "device_id": null } }, { "name": "current season sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.current_season", "device_id": null } }, { "name": "ramp start time", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.ramp_start_time", "device_id": null } }, { "name": "calculated ramp duration", "room": "system", "type": "input_number", "id": { "entity_id": "input_number.calculated_ramp_duration", "device_id": null } }, { "name": "ramp calculated end time", "room": "system", "type": "input_datetime", "id": { "entity_id": "input_datetime.ramp_calculated_end_time", "device_id": null } }, { "name": "first kitchen motion today", "room": "kitchen", "type": "input_datetime", "id": { "entity_id": "input_datetime.first_kitchen_motion_today", "device_id": null } }, { "name": "daily motion lock", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.daily_motion_lock", "device_id": null } }, { "name": "sun sun", "room": "system", "type": "sun", "id": { "entity_id": "sun.sun", "device_id": null } } ] }, { "id": "sleep_in_ramp_complete", "automation": "- id: sleep_in_ramp_complete\n alias: Sleep-In Ramp - Complete\n description: Completes the ramp when 100% progress is reached OR Day mode begins\n mode: single\n triggers:\n - trigger: template\n value_template: \"{{ is_state('input_boolean.sleep_in_ramp_active', 'on') and\\n\\\n \\ states('sensor.sleep_in_ramp_progress') | float(0) >= 100 }}\\n\"\n for:\n seconds: 5\n - trigger: state\n entity_id: sensor.calculated_home_mode\n to: Day\n conditions:\n - condition: state\n entity_id: input_boolean.sleep_in_ramp_active\n state: 'on'\n actions:\n - variables:\n motion_time_str: '{{ states(''input_datetime.first_kitchen_motion_today'') }}'\n is_non_work_day: \"{% if motion_time_str not in ['unknown', 'unavailable', '']\\\n \\ %}\\n {% set motion_time = as_datetime(motion_time_str) %}\\n {% set motion_hour\\\n \\ = motion_time.hour %}\\n {% set motion_minute = motion_time.minute %}\\n\\\n \\ {% set is_work_window = (motion_hour == 4 and motion_minute >= 50) or (motion_hour\\\n \\ == 5 and motion_minute == 0) %}\\n {{ not is_work_window }}\\n{% else %}\\n\\\n \\ {{ not is_state('binary_sensor.working_today', 'on') }}\\n{% endif %}\"\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.sleep_in_ramp_active\n - action: input_select.select_option\n target:\n entity_id: input_select.home_state\n data:\n option: Day\n - if:\n - condition: template\n value_template: '{{ is_non_work_day }}'\n - condition: state\n entity_id: input_boolean.kitchen_wled_enable\n state: 'on'\n then:\n - action: light.turn_off\n target:\n entity_id:\n - light.sink_wled\n - light.frig_strip\n - action: logbook.log\n data:\n name: WLED Control\n message: Kitchen WLED turned off at end of non-work day ramp\n - action: logbook.log\n data:\n name: Sleep-In Ramp\n message: 'Ramp complete - Triggered by: {{ trigger.platform }} | Non-work day:\n {{ is_non_work_day }}'", "config": [ { "name": "working today sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.working_today", "device_id": null } }, { "name": "home state select", "room": "system", "type": "input_select", "id": { "entity_id": "input_select.home_state", "device_id": null } }, { "name": "calculated home mode sensor", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.calculated_home_mode", "device_id": null } }, { "name": "sleep in ramp active", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_active", "device_id": null } }, { "name": "first kitchen motion today", "room": "kitchen", "type": "input_datetime", "id": { "entity_id": "input_datetime.first_kitchen_motion_today", "device_id": null } }, { "name": "sleep in ramp progress", "room": "system", "type": "sensor", "id": { "entity_id": "sensor.sleep_in_ramp_progress", "device_id": null } }, { "name": "kitchen WLED enable", "room": "kitchen", "type": "input_boolean", "id": { "entity_id": "input_boolean.kitchen_wled_enable", "device_id": null } }, { "name": "sink WLED light", "room": "kitchen", "type": "light", "id": { "entity_id": "light.sink_wled", "device_id": null } }, { "name": "fridge strip light", "room": "kitchen", "type": "light", "id": { "entity_id": "light.frig_strip", "device_id": null } } ] }, { "id": "daily_motion_reset", "automation": "- id: daily_motion_reset\n alias: Daily Motion Reset\n description: Resets daily motion lock and tracking at midnight\n triggers:\n - trigger: time\n at: 00:00:00\n actions:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.daily_motion_lock\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.first_kitchen_motion_today\n data:\n datetime: ''", "config": [ { "name": "first kitchen motion today", "room": "kitchen", "type": "input_datetime", "id": { "entity_id": "input_datetime.first_kitchen_motion_today", "device_id": null } }, { "name": "daily motion lock", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.daily_motion_lock", "device_id": null } } ] }, { "id": "kitchen_pyscript_morning_ramp_trigger", "automation": "- id: kitchen_pyscript_morning_ramp_trigger\n alias: Kitchen - Morning Ramp PyScript Trigger (motion)\n mode: single\n trigger:\n - trigger: state\n entity_id:\n - binary_sensor.aqara_motion_sensor_p1_occupancy\n - binary_sensor.kitchen_iris_frig_occupancy\n to: 'on'\n condition:\n - condition: state\n entity_id: input_boolean.sleep_in_ramp_system_enable\n state: 'on'\n - condition: state\n entity_id: pyscript.home_state\n state: Night\n action:\n - action: pyscript.morning_ramp_first_motion\n data:\n sensor: '{{ trigger.entity_id }}'", "config": [ { "name": "sleep in ramp system enable", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.sleep_in_ramp_system_enable", "device_id": null } }, { "name": "kitchen motion sensor P1", "room": "kitchen", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.aqara_motion_sensor_p1_occupancy", "device_id": null } }, { "name": "kitchen iris fridge occupancy", "room": "kitchen", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.kitchen_iris_frig_occupancy", "device_id": null } }, { "name": "pyscript home state", "room": "system", "type": "pyscript", "id": { "entity_id": "pyscript.home_state", "device_id": null } } ] }, { "id": "unlock_door_on_arrival", "automation": "- id: unlock_door_on_arrival\n alias: Unlock door when either iPhone arrives home\n description: Auto unlock front door when either phone enters the home zone\n triggers:\n - trigger: zone\n entity_id: device_tracker.iphone15\n zone: zone.home\n event: enter\n - trigger: zone\n entity_id: device_tracker.work_iphone\n zone: zone.home\n event: enter\n conditions:\n - condition: state\n entity_id: input_boolean.smart_lock_auto_unlock\n state: 'on'\n actions:\n - action: logbook.log\n data:\n name: Smart Lock\n message: Arrival unlock triggered by {{ trigger.entity_id or trigger.platform\n }}\n entity_id: lock.aqara_smart_lock_u100_lock\n - action: lock.unlock\n target:\n entity_id: lock.aqara_smart_lock_u100_lock\n - action: notify.mobile_app_iphone15\n data:\n message: The front door was unlocked (arrival).\n - action: notify.mobile_app_rrvqklh23h_iphone\n data:\n message: The front door was unlocked (arrival).\n mode: single", "config": [ { "name": "iPhone 15 tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.iphone15", "device_id": null } }, { "name": "work iPhone tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.work_iphone", "device_id": null } }, { "name": "smart lock auto unlock", "room": "entryway", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_lock_auto_unlock", "device_id": null } }, { "name": "Aqara smart lock U100", "room": "entryway", "type": "lock", "id": { "entity_id": "lock.aqara_smart_lock_u100_lock", "device_id": null } } ] }, { "id": "auto_lock_when_door_closes", "automation": "- id: auto_lock_when_door_closes\n alias: Auto-lock instantly when front door closes\n description: Locks immediately when contact sensor reports closed\n triggers:\n - trigger: state\n entity_id: binary_sensor.front_door_contact_contact\n from: 'on'\n to: 'off'\n conditions:\n - condition: state\n entity_id: input_boolean.smart_lock_auto_lock\n state: 'on'\n - condition: state\n entity_id: lock.aqara_smart_lock_u100_lock\n state: unlocked\n actions:\n - action: logbook.log\n data:\n name: Smart Lock\n message: Door closed → locking now\n entity_id: lock.aqara_smart_lock_u100_lock\n - action: lock.lock\n target:\n entity_id: lock.aqara_smart_lock_u100_lock\n - action: notify.mobile_app_iphone15\n data:\n message: The front door auto-locked instantly after closing.\n - action: notify.mobile_app_rrvqklh23h_iphone\n data:\n message: The front door auto-locked instantly after closing.\n mode: restart", "config": [ { "name": "Aqara smart lock U100", "room": "entryway", "type": "lock", "id": { "entity_id": "lock.aqara_smart_lock_u100_lock", "device_id": null } }, { "name": "front door contact sensor", "room": "entryway", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.front_door_contact_contact", "device_id": null } }, { "name": "smart lock auto lock", "room": "entryway", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_lock_auto_lock", "device_id": null } } ] }, { "id": "track_last_departed_phone", "automation": "- id: track_last_departed_phone\n alias: Track last phone departed\n triggers:\n - trigger: zone\n entity_id: device_tracker.iphone15\n zone: zone.home\n event: leave\n id: iphone15_leave\n - trigger: zone\n entity_id: device_tracker.work_iphone\n zone: zone.home\n event: leave\n id: work_iphone_leave\n actions:\n - choose:\n - conditions:\n - condition: trigger\n id: iphone15_leave\n sequence:\n - action: input_text.set_value\n target:\n entity_id: input_text.smart_lock_last_departed\n data:\n value: iphone15\n - action: logbook.log\n data:\n name: Smart Lock\n message: Last departed set to iphone15\n - conditions:\n - condition: trigger\n id: work_iphone_leave\n sequence:\n - action: input_text.set_value\n target:\n entity_id: input_text.smart_lock_last_departed\n data:\n value: work_iphone\n - action: logbook.log\n data:\n name: Smart Lock\n message: Last departed set to work_iphone\n mode: restart", "config": [ { "name": "iPhone 15 tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.iphone15", "device_id": null } }, { "name": "work iPhone tracker", "room": "system", "type": "device_tracker", "id": { "entity_id": "device_tracker.work_iphone", "device_id": null } }, { "name": "smart lock last departed", "room": "entryway", "type": "input_text", "id": { "entity_id": "input_text.smart_lock_last_departed", "device_id": null } } ] }, { "id": "away_enforce_after_5min", "automation": "- id: away_enforce_after_5min\n alias: Away enforce after 5 minutes\n description: After 5 minutes away, lock if needed and notify only the last departed\n phone\n triggers:\n - trigger: state\n entity_id: binary_sensor.both_phones_home\n to: 'off'\n for:\n minutes: 5\n conditions:\n - condition: state\n entity_id: input_boolean.smart_lock_away_enforce\n state: 'on'\n - condition: state\n entity_id: binary_sensor.both_phones_home\n state: 'off'\n - condition: state\n entity_id: binary_sensor.front_door_contact_contact\n state: 'off'\n actions:\n - action: logbook.log\n data:\n name: Smart Lock\n message: Away 5-min check running\n entity_id: lock.aqara_smart_lock_u100_lock\n - choose:\n - conditions:\n - condition: state\n entity_id: lock.aqara_smart_lock_u100_lock\n state: unlocked\n sequence:\n - action: lock.lock\n target:\n entity_id: lock.aqara_smart_lock_u100_lock\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ states(''input_text.smart_lock_last_departed'') ==\n ''iphone15'' }}'\n sequence:\n - action: notify.mobile_app_iphone15\n data:\n message: 'Away check: Door was still unlocked after 5 minutes, locking\n now.'\n - conditions:\n - condition: template\n value_template: '{{ states(''input_text.smart_lock_last_departed'') ==\n ''work_iphone'' }}'\n sequence:\n - action: notify.mobile_app_rrvqklh23h_iphone\n data:\n message: 'Away check: Door was still unlocked after 5 minutes, locking\n now.'\n mode: single", "config": [ { "name": "both phones home sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.both_phones_home", "device_id": null } }, { "name": "Aqara smart lock U100", "room": "entryway", "type": "lock", "id": { "entity_id": "lock.aqara_smart_lock_u100_lock", "device_id": null } }, { "name": "front door contact sensor", "room": "entryway", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.front_door_contact_contact", "device_id": null } }, { "name": "smart lock last departed", "room": "entryway", "type": "input_text", "id": { "entity_id": "input_text.smart_lock_last_departed", "device_id": null } }, { "name": "smart lock away enforce", "room": "entryway", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_lock_away_enforce", "device_id": null } } ] }, { "id": "away_door_left_open", "automation": "- id: away_door_left_open\n alias: Away alert if door left open\n description: If both phones are away and door stays open >2 minutes, notify last\n departed phone\n triggers:\n - trigger: state\n entity_id: binary_sensor.front_door_contact_contact\n to: 'on'\n for:\n minutes: 2\n conditions:\n - condition: state\n entity_id: binary_sensor.both_phones_home\n state: 'off'\n actions:\n - action: logbook.log\n data:\n name: Smart Lock\n message: Door left open 2+ min while away\n entity_id: lock.aqara_smart_lock_u100_lock\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ states(''input_text.smart_lock_last_departed'') == ''iphone15''\n }}'\n sequence:\n - action: notify.mobile_app_iphone15\n data:\n message: 'Away alert: The front door has been left open for 2 minutes.'\n - conditions:\n - condition: template\n value_template: '{{ states(''input_text.smart_lock_last_departed'') == ''work_iphone''\n }}'\n sequence:\n - action: notify.mobile_app_rrvqklh23h_iphone\n data:\n message: 'Away alert: The front door has been left open for 2 minutes.'\n mode: single", "config": [ { "name": "both phones home sensor", "room": "system", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.both_phones_home", "device_id": null } }, { "name": "Aqara smart lock U100", "room": "entryway", "type": "lock", "id": { "entity_id": "lock.aqara_smart_lock_u100_lock", "device_id": null } }, { "name": "front door contact sensor", "room": "entryway", "type": "binary_sensor", "id": { "entity_id": "binary_sensor.front_door_contact_contact", "device_id": null } }, { "name": "smart lock last departed", "room": "entryway", "type": "input_text", "id": { "entity_id": "input_text.smart_lock_last_departed", "device_id": null } } ] }, { "id": "smart_switch_1_manual_amber_activate", "automation": "- id: smart_switch_1_manual_amber_activate\n alias: Smart Switch 1 - Manual Amber Activate\n triggers:\n - trigger: state\n entity_id: input_boolean.smart_switch_1_manual_amber_trigger\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.smart_switch_1_amber_mode_enable\n state: 'on'\n actions:\n - action: script.smart_switch_1_amber_sequence\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.smart_switch_1_manual_amber_trigger\n - action: logbook.log\n data:\n name: Smart Switch 1 Amber\n message: Manual amber mode activated\n entity_id: light.smart_switch_1", "config": [ { "name": "smart switch 1 manual amber trigger", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_1_manual_amber_trigger", "device_id": null } }, { "name": "smart switch 1 amber mode enable", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_1_amber_mode_enable", "device_id": null } }, { "name": "smart switch 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_1", "device_id": null } } ] }, { "id": "smart_switch_2_manual_amber_activate", "automation": "- id: smart_switch_2_manual_amber_activate\n alias: Smart Switch 2 - Manual Amber Activate\n triggers:\n - trigger: state\n entity_id: input_boolean.smart_switch_2_manual_amber_trigger\n to: 'on'\n conditions:\n - condition: state\n entity_id: input_boolean.smart_switch_2_amber_mode_enable\n state: 'on'\n actions:\n - action: script.smart_switch_2_amber_sequence\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.smart_switch_2_manual_amber_trigger\n - action: logbook.log\n data:\n name: Smart Switch 2 Amber\n message: Manual amber mode activated\n entity_id: light.smart_switch_2", "config": [ { "name": "smart switch 2 manual amber trigger", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_2_manual_amber_trigger", "device_id": null } }, { "name": "smart switch 2 amber mode enable", "room": "living_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.smart_switch_2_amber_mode_enable", "device_id": null } }, { "name": "smart switch 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_2", "device_id": null } } ] }, { "id": "smart_switch_1_amber_button", "automation": "- id: smart_switch_1_amber_button\n alias: Smart Switch 1 - Amber Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_1_activate_amber\n actions:\n - action: script.smart_switch_1_amber_sequence", "config": [ { "name": "smart switch 1 activate amber button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_1_activate_amber", "device_id": null } } ] }, { "id": "smart_switch_1_normal_button", "automation": "- id: smart_switch_1_normal_button\n alias: Smart Switch 1 - Normal Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_1_normal_mode\n actions:\n - action: light.turn_on\n target:\n entity_id: light.smart_switch_1\n data:\n brightness_pct: 80\n color_temp_kelvin: 4000", "config": [ { "name": "smart switch 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_1", "device_id": null } }, { "name": "smart switch 1 normal mode button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_1_normal_mode", "device_id": null } } ] }, { "id": "smart_switch_2_amber_button", "automation": "- id: smart_switch_2_amber_button\n alias: Smart Switch 2 - Amber Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_2_activate_amber\n actions:\n - action: script.smart_switch_2_amber_sequence", "config": [ { "name": "smart switch 2 activate amber button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_2_activate_amber", "device_id": null } } ] }, { "id": "smart_switch_2_normal_button", "automation": "- id: smart_switch_2_normal_button\n alias: Smart Switch 2 - Normal Button\n triggers:\n - trigger: state\n entity_id: input_button.smart_switch_2_normal_mode\n actions:\n - action: light.turn_on\n target:\n entity_id: light.smart_switch_2\n data:\n brightness_pct: 80\n color_temp_kelvin: 4000", "config": [ { "name": "smart switch 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_2", "device_id": null } }, { "name": "smart switch 2 normal mode button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.smart_switch_2_normal_mode", "device_id": null } } ] }, { "id": "both_switches_amber_button", "automation": "- id: both_switches_amber_button\n alias: Both Switches - Amber Button\n triggers:\n - trigger: state\n entity_id: input_button.both_switches_amber\n actions:\n - action: script.both_switches_amber_mode", "config": [ { "name": "both switches amber button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.both_switches_amber", "device_id": null } } ] }, { "id": "both_switches_normal_button", "automation": "- id: both_switches_normal_button\n alias: Both Switches - Normal Button\n triggers:\n - trigger: state\n entity_id: input_button.both_switches_normal\n actions:\n - action: light.turn_on\n target:\n entity_id:\n - light.smart_switch_1\n - light.smart_switch_2\n data:\n brightness_pct: 80\n color_temp_kelvin: 4000", "config": [ { "name": "smart switch 1", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_1", "device_id": null } }, { "name": "smart switch 2", "room": "living_room", "type": "light", "id": { "entity_id": "light.smart_switch_2", "device_id": null } }, { "name": "both switches normal button", "room": "living_room", "type": "input_button", "id": { "entity_id": "input_button.both_switches_normal", "device_id": null } } ] }, { "id": "trial_gate_yaml_home_state_eval", "automation": "- id: trial_gate_yaml_home_state_eval\n alias: TRIAL – Gate YAML Home State Evaluation\n mode: restart\n triggers:\n - trigger: state\n entity_id: input_boolean.use_pyscript_home_state\n actions:\n - choose:\n - conditions:\n - condition: state\n entity_id: input_boolean.use_pyscript_home_state\n state: 'on'\n sequence:\n - action: automation.turn_off\n target:\n entity_id: automation.home_state_evaluation\n - action: logbook.log\n data:\n name: TRIAL\n message: Disabled YAML Home State Evaluation (toggle ON)\n - conditions:\n - condition: state\n entity_id: input_boolean.use_pyscript_home_state\n state: 'off'\n sequence:\n - action: automation.turn_on\n target:\n entity_id: automation.home_state_evaluation\n - action: logbook.log\n data:\n name: TRIAL\n message: Enabled YAML Home State Evaluation (toggle OFF)", "config": [ { "name": "use pyscript home state", "room": "system", "type": "input_boolean", "id": { "entity_id": "input_boolean.use_pyscript_home_state", "device_id": null } }, { "name": "Home State Evaluation", "room": null, "type": "automation", "id": { "entity_id": "automation.home_state_evaluation", "device_id": null } } ] }, { "id": "monitor_dryer_running", "automation": "- alias: Monitor Dryer Running State\n id: monitor_dryer_running\n description: Track when dryer starts and stops running\n mode: restart\n triggers:\n - trigger: numeric_state\n entity_id: sensor.dryer_dryer_electric_w_value\n above: 50\n id: dryer_start\n - trigger: numeric_state\n entity_id: sensor.dryer_dryer_electric_w_value\n below: 50\n for:\n minutes: 2\n id: dryer_stop\n actions:\n - choose:\n - conditions:\n - condition: trigger\n id: dryer_start\n sequence:\n - action: input_boolean.turn_on\n target:\n entity_id: input_boolean.dryer_running\n - action: logbook.log\n data:\n name: Dryer Status\n message: Dryer started running\n - conditions:\n - condition: trigger\n id: dryer_stop\n sequence:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.dryer_running\n - action: logbook.log\n data:\n name: Dryer Status\n message: Dryer finished running\n - action: script.send_dryer_done_notification", "config": [ { "name": "dryer electric power", "room": "laundry_room", "type": "sensor", "id": { "entity_id": "sensor.dryer_dryer_electric_w_value", "device_id": null } }, { "name": "dryer running", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.dryer_running", "device_id": null } } ] }, { "id": "simple_washer_done", "automation": "- alias: Simple Washer Done Notification\n id: simple_washer_done\n description: Alexa announces and iPhone notifies when washer is done, checks if\n dryer is running\n mode: single\n triggers:\n - trigger: numeric_state\n entity_id: sensor.washer_power\n below: 8\n for:\n minutes: 1\n conditions:\n - condition: state\n entity_id: input_boolean.washer_notifications\n state: 'on'\n - condition: state\n entity_id: input_boolean.dryer_reminder_enable\n state: 'on'\n actions:\n - action: script.send_washer_done_notification", "config": [ { "name": "washer power", "room": "laundry_room", "type": "sensor", "id": { "entity_id": "sensor.washer_power", "device_id": null } }, { "name": "washer notifications", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_notifications", "device_id": null } }, { "name": "dryer reminder enable", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.dryer_reminder_enable", "device_id": null } } ] }, { "id": "dryer_reminder_every_15min", "automation": "- alias: Dryer Reminder Every 15min\n id: dryer_reminder_every_15min\n description: Keep reminding every 15min until clothes moved to dryer\n mode: restart\n triggers:\n - trigger: time_pattern\n minutes: /15\n conditions:\n - condition: state\n entity_id: input_boolean.washer_notifications\n state: 'on'\n - condition: state\n entity_id: input_boolean.dryer_reminder_enable\n state: 'on'\n - condition: state\n entity_id: input_boolean.clothes_in_dryer_pending\n state: 'on'\n - condition: time\n after: 08:00:00\n before: '21:00:00'\n actions:\n - action: script.send_iphone_notification\n data:\n title: '🔔 Reminder: Dryer?'\n message: Don't forget - did you move the clothes to the dryer?\n actions:\n - action: CLOTHES_IN_DRYER_YES\n title: ✅ Yes, all moved!\n - action: CLOTHES_REMIND_30MIN\n title: ⏰ Remind me later", "config": [ { "name": "washer notifications", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_notifications", "device_id": null } }, { "name": "dryer reminder enable", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.dryer_reminder_enable", "device_id": null } }, { "name": "clothes in dryer pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.clothes_in_dryer_pending", "device_id": null } } ] }, { "id": "handle_clothes_in_dryer_yes", "automation": "- alias: Handle Clothes in Dryer Confirmed\n id: handle_clothes_in_dryer_yes\n description: Stop reminders when user confirms clothes in dryer\n mode: single\n triggers:\n - trigger: event\n event_type: mobile_app_notification_action\n event_data:\n action: CLOTHES_IN_DRYER_YES\n actions:\n - action: script.handle_confirmation\n data:\n boolean_entity: input_boolean.clothes_in_dryer_pending\n title: 👍 Perfect!\n message: Great job! No more reminders.", "config": [ { "name": "clothes in dryer pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.clothes_in_dryer_pending", "device_id": null } } ] }, { "id": "handle_dryer_remind_30min", "automation": "- alias: Handle Dryer Remind 30min\n id: handle_dryer_remind_30min\n description: Snooze dryer reminder for 30 minutes\n mode: restart\n triggers:\n - trigger: event\n event_type: mobile_app_notification_action\n event_data:\n action: CLOTHES_REMIND_30MIN\n actions:\n - action: script.handle_snooze\n data:\n boolean_entity: input_boolean.clothes_in_dryer_pending\n snooze_title: ⏰ Snoozed!\n snooze_message: I'll remind you again in 30 minutes.\n reminder_title: 🔔 Snooze Over!\n reminder_message: Did you move the clothes to the dryer now?\n reminder_actions:\n - action: CLOTHES_IN_DRYER_YES\n title: ✅ Yes, all moved!\n - action: CLOTHES_REMIND_30MIN\n title: ⏰ Remind me later", "config": [ { "name": "clothes in dryer pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.clothes_in_dryer_pending", "device_id": null } } ] }, { "id": "washer_cleaning_after_cycle", "automation": "- alias: Washer Cleaning Reminder - Check After Cycle\n id: washer_cleaning_after_cycle\n description: Check if washer needs cleaning after each wash cycle (every 30 days)\n mode: single\n triggers:\n - trigger: numeric_state\n entity_id: sensor.washer_power\n below: 8\n for:\n minutes: 1\n conditions:\n - condition: state\n entity_id: input_boolean.washer_notifications\n state: 'on'\n - condition: state\n entity_id: input_boolean.washer_cleaning_reminder_enable\n state: 'on'\n - condition: state\n entity_id: input_boolean.washer_cleaning_pending\n state: 'off'\n - condition: time\n after: 08:00:00\n before: '21:00:00'\n actions:\n - variables:\n last_cleaned: '{{ states(''input_datetime.washer_last_cleaned'') }}'\n days_since_cleaned: \"{% if last_cleaned != 'unknown' %}\\n {{ ((as_timestamp(now())\\\n \\ - as_timestamp(last_cleaned)) / 86400) | round(0) }}\\n{% else %}\\n 31\\n\\\n {% endif %}\"\n - if:\n - condition: template\n value_template: '{{ days_since_cleaned >= 30 }}'\n then:\n - action: input_boolean.turn_on\n target:\n entity_id: input_boolean.washer_cleaning_pending\n - action: script.send_iphone_notification\n data:\n title: 🧽 Washer Maintenance Time!\n message: '{% if last_cleaned != ''unknown'' %} It''s been {{ days_since_cleaned\n }} days since you last cleaned the washer. Time for a cleaning cycle? {%\n else %} When did you last clean the washer? It''s been a while - time for\n a maintenance cycle? {% endif %}'\n actions:\n - action: WASHER_CLEANED_YES\n title: ✅ Just cleaned it!\n - action: WASHER_CLEAN_REMIND_LATER\n title: 🌙 Remind me tonight", "config": [ { "name": "washer power", "room": "laundry_room", "type": "sensor", "id": { "entity_id": "sensor.washer_power", "device_id": null } }, { "name": "washer notifications", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_notifications", "device_id": null } }, { "name": "washer cleaning reminder enable", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_cleaning_reminder_enable", "device_id": null } }, { "name": "washer cleaning pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_cleaning_pending", "device_id": null } }, { "name": "washer last cleaned", "room": "laundry_room", "type": "input_datetime", "id": { "entity_id": "input_datetime.washer_last_cleaned", "device_id": null } } ] }, { "id": "washer_cleaning_nag_hourly", "automation": "- alias: Washer Cleaning Reminder - Nag Every Hour\n id: washer_cleaning_nag_hourly\n description: Keep reminding about washer cleaning every hour until confirmed\n mode: restart\n triggers:\n - trigger: time_pattern\n minutes: 0\n conditions:\n - condition: state\n entity_id: input_boolean.washer_notifications\n state: 'on'\n - condition: state\n entity_id: input_boolean.washer_cleaning_reminder_enable\n state: 'on'\n - condition: state\n entity_id: input_boolean.washer_cleaning_pending\n state: 'on'\n - condition: time\n after: 09:00:00\n before: '21:00:00'\n actions:\n - action: script.send_iphone_notification\n data:\n title: 🔔 Cleaning Reminder\n message: Don't forget - your washer needs a cleaning cycle soon!\n actions:\n - action: WASHER_CLEANED_YES\n title: ✅ Just cleaned it!\n - action: WASHER_CLEAN_REMIND_LATER\n title: 🌙 Remind me tonight", "config": [ { "name": "washer notifications", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_notifications", "device_id": null } }, { "name": "washer cleaning reminder enable", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_cleaning_reminder_enable", "device_id": null } }, { "name": "washer cleaning pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_cleaning_pending", "device_id": null } } ] }, { "id": "handle_washer_cleaned_yes", "automation": "- alias: Handle Washer Cleaned Confirmed\n id: handle_washer_cleaned_yes\n description: Stop reminders when user confirms washer was cleaned\n mode: single\n triggers:\n - trigger: event\n event_type: mobile_app_notification_action\n event_data:\n action: WASHER_CLEANED_YES\n actions:\n - action: input_boolean.turn_off\n target:\n entity_id: input_boolean.washer_cleaning_pending\n - action: input_datetime.set_datetime\n target:\n entity_id: input_datetime.washer_last_cleaned\n data:\n date: '{{ now().strftime(''%Y-%m-%d'') }}'\n - action: script.handle_confirmation\n data:\n boolean_entity: input_boolean.washer_cleaning_pending\n title: 🌟 Excellent!\n message: Thanks! I'll remind you again in 30 days.", "config": [ { "name": "washer cleaning pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_cleaning_pending", "device_id": null } }, { "name": "washer last cleaned", "room": "laundry_room", "type": "input_datetime", "id": { "entity_id": "input_datetime.washer_last_cleaned", "device_id": null } } ] }, { "id": "handle_washer_clean_remind_tonight", "automation": "- alias: Handle Washer Clean Remind Tonight\n id: handle_washer_clean_remind_tonight\n description: Snooze washer cleaning reminder until evening\n mode: restart\n triggers:\n - trigger: event\n event_type: mobile_app_notification_action\n event_data:\n action: WASHER_CLEAN_REMIND_LATER\n actions:\n - action: script.handle_snooze\n data:\n boolean_entity: input_boolean.washer_cleaning_pending\n snooze_title: 🌙 Got it!\n snooze_message: I'll remind you tonight about washer cleaning.\n delay_time: '19:00:00'\n reminder_title: 🌆 Evening Reminder!\n reminder_message: Good time to run a washer cleaning cycle tonight?\n reminder_actions:\n - action: WASHER_CLEANED_YES\n title: ✅ Just cleaned it!\n - action: WASHER_CLEAN_REMIND_LATER\n title: 📅 Maybe tomorrow", "config": [ { "name": "washer cleaning pending", "room": "laundry_room", "type": "input_boolean", "id": { "entity_id": "input_boolean.washer_cleaning_pending", "device_id": null } } ] } ]