Last active
January 28, 2026 22:43
-
-
Save Ltek/f58bbbde02471437ef863c334572a320 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint : Smart Garage - Door, Lighting, and Alerts by LTek
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: π Smart Garage - Door, Lighting, and Alerts by LTek | |
| description: | | |
| π **Smart Garage - Door, Lighting, and Alerts** | |
| Comprehensive Garage Automation for Door States, Notifications, Alerts, Lighting, and Auto-Close/Open | |
| π Version 2026.01.28.22d | |
| Author: LTek | |
| - Fix: Light Off Timer logic, really this time I hope! | |
| - New: Debug notification | |
| π Community Discussion, Help, and Details... https://community.home-assistant.io/ | |
| source_url: https://gist.github.com/Ltek/f58bbbde02471437ef863c334572a320 | |
| Important Note: this made to work with garage doors that report as Covers entities. | |
| **FEATURES** | |
| π’ Custom Notifications per garage door state - open, opening, closed, closing, stopped | |
| π¨ Alert notification schedules for door state - for when door should not be opening but are | |
| β±οΈ Auto-close default timer - does not use schedule | |
| π Three customizable door schedules - open or close at specific times | |
| π‘οΈ Bypass schedule for open notifications | |
| π Repeat notifications with configurable limits | |
| βοΈ Custom actions for each door state and light trigger | |
| π‘ Lighting control based on garage door states and other triggers | |
| π Debug out to Persistent UI web notifications | |
| domain: automation | |
| input: | |
| # ======================================== | |
| # GARAGE DOOR ENTITY (STANDALONE) | |
| # ======================================== | |
| garage_door_entity: | |
| name: Garage Door Entity | |
| description: The garage door cover entity to monitor | |
| selector: | |
| entity: | |
| domain: cover | |
| multiple: false | |
| # ======================================== | |
| # ALERT NOTIFICATION SECTION | |
| # ======================================== | |
| alert_notification_section: | |
| name: "Alert Notification Settings" | |
| description: "Alerts when OPENs during specific day/time schedules or based on entity state. Intended for getting an alert when the door opens during periods it should not be." | |
| icon: mdi:bell-alert | |
| collapsed: true | |
| input: | |
| alert_enable_notification: | |
| name: β Enable Alert Notifications | |
| description: Send when Time or Entity conditions are met | |
| default: false | |
| selector: | |
| boolean: {} | |
| # Alert Schedule Condition | |
| alert_enable_schedule: | |
| name: π Enable Schedule Condition | |
| description: Send alerts when door opens during specific days/times | |
| default: true | |
| selector: | |
| boolean: {} | |
| alert_days: | |
| name: ποΈ Alert Days | |
| description: Days when alerts should be sent during specified times (only if schedule condition is enabled) | |
| default: | |
| - mon | |
| - tue | |
| - wed | |
| - thu | |
| - fri | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Monday | |
| value: mon | |
| - label: Tuesday | |
| value: tue | |
| - label: Wednesday | |
| value: wed | |
| - label: Thursday | |
| value: thu | |
| - label: Friday | |
| value: fri | |
| - label: Saturday | |
| value: sat | |
| - label: Sunday | |
| value: sun | |
| alert_start_time: | |
| name: π’ Start Time | |
| description: Start time for alert schedule when enabled. For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "22:00:00" | |
| selector: | |
| time: {} | |
| alert_end_time: | |
| name: π΄ End Time | |
| description: End time for alert schedule when enabled. For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "06:00:00" | |
| selector: | |
| time: {} | |
| # Entity State Condition | |
| alert_enable_entity: | |
| name: βοΈ Enable Entity State Condition | |
| description: Send alerts when specific entity is in specific state | |
| default: false | |
| selector: | |
| boolean: {} | |
| alert_entity: | |
| name: π Monitored Entity | |
| description: Entity to monitor for alert condition (only if entity condition is enabled) | |
| default: "" | |
| selector: | |
| entity: | |
| multiple: false | |
| alert_entity_states: | |
| name: π Monitored Entity State | |
| description: Comma-separated list of states that trigger alert (e.g., "Sleep,Away,Vacation"). If any state matches, alert is triggered. | |
| default: "on" | |
| selector: | |
| text: | |
| multiline: false | |
| alert_notify_devices: | |
| name: π² Mobile Notification Devices | |
| description: Mobile devices to receive alert notifications | |
| default: [] | |
| selector: | |
| device: | |
| integration: mobile_app | |
| multiple: true | |
| alert_notification_title: | |
| name: π¬ Alert Notification Title | |
| default: 'β οΈ Garage Door Alert' | |
| selector: | |
| text: {} | |
| alert_notification_message: | |
| name: π’ Alert Notification Message | |
| default: '{{ friendly_name }} was opened during alert hours at {{ as_timestamp(states[trigger.entity_id].last_updated) | timestamp_custom("%I:%M:%S %p") }}' | |
| selector: | |
| text: | |
| multiline: true | |
| alert_notification_click_url: | |
| name: π Alert Click URL | |
| default: /dashboard-garage | |
| selector: | |
| text: {} | |
| alert_notification_icon: | |
| name: π¨ Alert Notification Icon (Android) | |
| default: bell-alert | |
| selector: | |
| select: | |
| options: | |
| - bell-alert | |
| - alert-circle | |
| - security | |
| - garage-alert | |
| - home-alert | |
| alert_notification_color: | |
| name: π¨ Alert Notification Color (Android) | |
| default: red | |
| selector: | |
| select: | |
| options: | |
| - red | |
| - orange | |
| - yellow | |
| - purple | |
| - pink | |
| alert_notification_persistent: | |
| name: π Alert Persistent (Android) | |
| default: true | |
| selector: | |
| boolean: {} | |
| alert_notification_interruption: | |
| name: π Alert Interruption Level (iOS) | |
| default: critical | |
| selector: | |
| select: | |
| options: | |
| - passive | |
| - active | |
| - time-sensitive | |
| - critical | |
| alert_custom_action: | |
| name: βοΈ Alert Custom Action | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # OPEN TRIGGER SETTINGS SECTION | |
| # ======================================== | |
| open_trigger_section: | |
| name: "Open Trigger Settings" | |
| description: "Configure notifications when door is OPEN" | |
| icon: mdi:garage-open | |
| collapsed: true | |
| input: | |
| open_enable_notification: | |
| name: π’ Enable Open Notifications | |
| default: true | |
| selector: | |
| boolean: {} | |
| open_duration_before_alert: | |
| name: β° Time Delay Before Open Alert | |
| description: How long door must be open before first alert | |
| default: | |
| minutes: 5 | |
| selector: | |
| duration: | |
| enable_day: true | |
| open_friendly_name: | |
| name: π·οΈ Custom Friendly Name | |
| default: 'Garage Door' | |
| selector: | |
| text: {} | |
| open_notify_devices: | |
| name: π² Mobile Notification Devices | |
| description: Mobile devices to receive notifications | |
| default: [] | |
| selector: | |
| device: | |
| integration: mobile_app | |
| multiple: true | |
| open_notification_title: | |
| name: π¬ Notification Title | |
| default: '{{ open_friendly_name }} is Open' | |
| selector: | |
| text: {} | |
| open_notification_message: | |
| name: π§ Notification Message | |
| default: 'Door has been open since {{ as_timestamp(states[trigger.entity_id].last_updated) | timestamp_custom("%I:%M:%S %p") }}' | |
| selector: | |
| text: | |
| multiline: true | |
| open_notification_click_url: | |
| name: π Click URL | |
| default: /dashboard-garage | |
| selector: | |
| text: {} | |
| open_repeat_notification: | |
| name: π Repeat Alerts | |
| default: true | |
| selector: | |
| boolean: {} | |
| open_max_repeat_count: | |
| name: π’ Maximum Repeat Count | |
| description: 0 for unlimited | |
| default: 0 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 100 | |
| step: 1 | |
| mode: box | |
| open_time_between_repeats: | |
| name: β³ Delay Between Repeats | |
| default: | |
| minutes: 10 | |
| selector: | |
| duration: | |
| enable_day: true | |
| open_bypass_entities: | |
| name: π‘οΈ Bypass Entities | |
| description: No notifications when these are "on" | |
| default: [] | |
| selector: | |
| entity: | |
| domain: | |
| - binary_sensor | |
| - input_boolean | |
| multiple: true | |
| open_bypass_schedule_enabled: | |
| name: π Enable Bypass Time Schedule | |
| description: Suppress notifications during specific days/times | |
| default: false | |
| selector: | |
| boolean: {} | |
| open_bypass_days: | |
| name: π Bypass Days | |
| description: Days when notifications should be suppressed during specified times | |
| default: | |
| - mon | |
| - tue | |
| - wed | |
| - thu | |
| - fri | |
| - sat | |
| - sun | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Monday | |
| value: mon | |
| - label: Tuesday | |
| value: tue | |
| - label: Wednesday | |
| value: wed | |
| - label: Thursday | |
| value: thu | |
| - label: Friday | |
| value: fri | |
| - label: Saturday | |
| value: sat | |
| - label: Sunday | |
| value: sun | |
| open_bypass_start_time: | |
| name: π’ Bypass Start Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| open_bypass_end_time: | |
| name: π΄ Bypass End Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| open_notification_icon: | |
| name: π¨ Notification Icon (Android) | |
| default: garage-open | |
| selector: | |
| select: | |
| options: | |
| - garage-open | |
| - garage-alert | |
| - alert-circle | |
| - door-open | |
| - home-alert | |
| open_notification_color: | |
| name: π¨ Notification Color (Android) | |
| default: red | |
| selector: | |
| select: | |
| options: | |
| - red | |
| - orange | |
| - yellow | |
| - green | |
| - blue | |
| - purple | |
| open_notification_persistent: | |
| name: π Persistent (Android) | |
| default: false | |
| selector: | |
| boolean: {} | |
| open_notification_interruption: | |
| name: π Interruption Level (iOS) | |
| default: active | |
| selector: | |
| select: | |
| options: | |
| - passive | |
| - active | |
| - time-sensitive | |
| - critical | |
| open_custom_action: | |
| name: βοΈ Custom Action | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # OPENING TRIGGER SETTINGS SECTION | |
| # ======================================== | |
| opening_trigger_section: | |
| name: "Opening Trigger Settings" | |
| description: "Configure notifications when door is OPENING" | |
| icon: mdi:arrow-up | |
| collapsed: true | |
| input: | |
| opening_enable_notification: | |
| name: π’ Enable Opening Notifications | |
| default: false | |
| selector: | |
| boolean: {} | |
| opening_duration_before_alert: | |
| name: β° Time Delay Before Opening Alert | |
| default: | |
| seconds: 0 | |
| selector: | |
| duration: | |
| enable_day: true | |
| opening_friendly_name: | |
| name: π·οΈ Custom Friendly Name | |
| default: 'Garage Door' | |
| selector: | |
| text: {} | |
| opening_notify_devices: | |
| name: π² Mobile Notification Devices | |
| description: Mobile devices to receive notifications | |
| default: [] | |
| selector: | |
| device: | |
| integration: mobile_app | |
| multiple: true | |
| opening_notification_title: | |
| name: π¬ Notification Title | |
| default: '{{ opening_friendly_name }} is Opening' | |
| selector: | |
| text: {} | |
| opening_notification_message: | |
| name: π§ Notification Message | |
| default: 'Door started opening at {{ as_timestamp(states[trigger.entity_id].last_updated) | timestamp_custom("%I:%M:%S %p") }}' | |
| selector: | |
| text: | |
| multiline: true | |
| opening_notification_click_url: | |
| name: π Click URL | |
| default: /dashboard-garage | |
| selector: | |
| text: {} | |
| opening_repeat_notification: | |
| name: π Repeat Alerts | |
| default: false | |
| selector: | |
| boolean: {} | |
| opening_max_repeat_count: | |
| name: π’ Maximum Repeat Count | |
| default: 0 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 100 | |
| step: 1 | |
| mode: box | |
| opening_time_between_repeats: | |
| name: β³ Delay Between Repeats | |
| default: | |
| minutes: 1 | |
| selector: | |
| duration: | |
| enable_day: true | |
| opening_bypass_entities: | |
| name: π‘οΈ Bypass Entities | |
| default: [] | |
| selector: | |
| entity: | |
| domain: | |
| - binary_sensor | |
| - input_boolean | |
| multiple: true | |
| opening_notification_icon: | |
| name: π¨ Notification Icon (Android) | |
| default: garage-open-variant | |
| selector: | |
| select: | |
| options: | |
| - garage-open-variant | |
| - garage | |
| - arrow-up | |
| - door-open | |
| opening_notification_color: | |
| name: π¨ Notification Color (Android) | |
| default: yellow | |
| selector: | |
| select: | |
| options: | |
| - red | |
| - orange | |
| - yellow | |
| - green | |
| - blue | |
| - purple | |
| opening_notification_persistent: | |
| name: π Persistent (Android) | |
| default: false | |
| selector: | |
| boolean: {} | |
| opening_notification_interruption: | |
| name: π Interruption Level (iOS) | |
| default: passive | |
| selector: | |
| select: | |
| options: | |
| - passive | |
| - active | |
| - time-sensitive | |
| - critical | |
| opening_custom_action: | |
| name: βοΈ Custom Action | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # CLOSED TRIGGER SETTINGS SECTION | |
| # ======================================== | |
| closed_trigger_section: | |
| name: "Closed Trigger Settings" | |
| description: "Configure notifications when door is CLOSED" | |
| icon: mdi:garage | |
| collapsed: true | |
| input: | |
| closed_enable_notification: | |
| name: π’ Enable Closed Notifications | |
| default: false | |
| selector: | |
| boolean: {} | |
| closed_duration_before_alert: | |
| name: β° Time Delay Before Closed Alert | |
| default: | |
| seconds: 0 | |
| selector: | |
| duration: | |
| enable_day: true | |
| closed_friendly_name: | |
| name: π·οΈ Custom Friendly Name | |
| default: 'Garage Door' | |
| selector: | |
| text: {} | |
| closed_notify_devices: | |
| name: π² Mobile Notification Devices | |
| description: Mobile devices to receive notifications | |
| default: [] | |
| selector: | |
| device: | |
| integration: mobile_app | |
| multiple: true | |
| closed_notification_title: | |
| name: π¬ Notification Title | |
| default: '{{ closed_friendly_name }} is Closed' | |
| selector: | |
| text: {} | |
| closed_notification_message: | |
| name: π§ Notification Message | |
| default: 'Door closed at {{ as_timestamp(states[trigger.entity_id].last_updated) | timestamp_custom("%I:%M:%S %p") }}' | |
| selector: | |
| text: | |
| multiline: true | |
| closed_notification_click_url: | |
| name: π Click URL | |
| default: /dashboard-garage | |
| selector: | |
| text: {} | |
| closed_repeat_notification: | |
| name: π Repeat Alerts | |
| default: false | |
| selector: | |
| boolean: {} | |
| closed_max_repeat_count: | |
| name: π’ Maximum Repeat Count | |
| default: 0 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 100 | |
| step: 1 | |
| mode: box | |
| closed_time_between_repeats: | |
| name: β³ Delay Between Repeats | |
| default: | |
| minutes: 1 | |
| selector: | |
| duration: | |
| enable_day: true | |
| closed_bypass_entities: | |
| name: π‘οΈ Bypass Entities | |
| default: [] | |
| selector: | |
| entity: | |
| domain: | |
| - binary_sensor | |
| - input_boolean | |
| multiple: true | |
| closed_notification_icon: | |
| name: π¨ Notification Icon (Android) | |
| default: garage | |
| selector: | |
| select: | |
| options: | |
| - garage | |
| - garage-variant | |
| - check-circle | |
| - door-closed | |
| closed_notification_color: | |
| name: π¨ Notification Color (Android) | |
| default: green | |
| selector: | |
| select: | |
| options: | |
| - red | |
| - orange | |
| - yellow | |
| - green | |
| - blue | |
| - purple | |
| closed_notification_persistent: | |
| name: π Persistent (Android) | |
| default: false | |
| selector: | |
| boolean: {} | |
| closed_notification_interruption: | |
| name: π Interruption Level (iOS) | |
| default: passive | |
| selector: | |
| select: | |
| options: | |
| - passive | |
| - active | |
| - time-sensitive | |
| - critical | |
| closed_custom_action: | |
| name: βοΈ Custom Action | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # CLOSING TRIGGER SETTINGS SECTION | |
| # ======================================== | |
| closing_trigger_section: | |
| name: "Closing Trigger Settings" | |
| description: "Configure notifications when door is CLOSING" | |
| icon: mdi:arrow-down | |
| collapsed: true | |
| input: | |
| closing_enable_notification: | |
| name: π¬ Enable Closing Notifications | |
| default: false | |
| selector: | |
| boolean: {} | |
| closing_duration_before_alert: | |
| name: β° Time Delay Before Closing Alert | |
| default: | |
| seconds: 0 | |
| selector: | |
| duration: | |
| enable_day: true | |
| closing_friendly_name: | |
| name: π·οΈ Custom Friendly Name | |
| default: 'Garage Door' | |
| selector: | |
| text: {} | |
| closing_notify_devices: | |
| name: π² Mobile Notification Devices | |
| description: Mobile devices to receive notifications | |
| default: [] | |
| selector: | |
| device: | |
| integration: mobile_app | |
| multiple: true | |
| closing_notification_title: | |
| name: π¬ Notification Title | |
| default: '{{ closing_friendly_name }} is Closing' | |
| selector: | |
| text: {} | |
| closing_notification_message: | |
| name: π§ Notification Message | |
| default: 'Door started closing at {{ as_timestamp(states[trigger.entity_id].last_updated) | timestamp_custom("%I:%M:%S %p") }}' | |
| selector: | |
| text: | |
| multiline: true | |
| closing_notification_click_url: | |
| name: π Click URL | |
| default: /dashboard-garage | |
| selector: | |
| text: {} | |
| closing_repeat_notification: | |
| name: π Repeat Alerts | |
| default: false | |
| selector: | |
| boolean: {} | |
| closing_max_repeat_count: | |
| name: π’ Maximum Repeat Count | |
| default: 0 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 100 | |
| step: 1 | |
| mode: box | |
| closing_time_between_repeats: | |
| name: β³ Delay Between Repeats | |
| default: | |
| minutes: 1 | |
| selector: | |
| duration: | |
| enable_day: true | |
| closing_bypass_entities: | |
| name: π‘οΈ Bypass Entities | |
| default: [] | |
| selector: | |
| entity: | |
| domain: | |
| - binary_sensor | |
| - input_boolean | |
| multiple: true | |
| closing_notification_icon: | |
| name: π¨ Notification Icon (Android) | |
| default: garage-variant | |
| selector: | |
| select: | |
| options: | |
| - garage-variant | |
| - garage | |
| - arrow-down | |
| - door-closed | |
| closing_notification_color: | |
| name: π¨ Notification Color (Android) | |
| default: blue | |
| selector: | |
| select: | |
| options: | |
| - red | |
| - orange | |
| - yellow | |
| - green | |
| - blue | |
| - purple | |
| closing_notification_persistent: | |
| name: π Persistent (Android) | |
| default: false | |
| selector: | |
| boolean: {} | |
| closing_notification_interruption: | |
| name: π Interruption Level (iOS) | |
| default: passive | |
| selector: | |
| select: | |
| options: | |
| - passive | |
| - active | |
| - time-sensitive | |
| - critical | |
| closing_custom_action: | |
| name: βοΈ Custom Action | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # STOPPED TRIGGER SETTINGS SECTION | |
| # ======================================== | |
| stopped_trigger_section: | |
| name: "Stopped Trigger Settings" | |
| description: "Configure notifications when door is STOPPED" | |
| icon: mdi:alert-circle | |
| collapsed: true | |
| input: | |
| stopped_enable_notification: | |
| name: π’ Enable Stopped Notifications | |
| default: true | |
| selector: | |
| boolean: {} | |
| stopped_duration_before_alert: | |
| name: β° Time Delay Before Stopped Alert | |
| default: | |
| seconds: 5 | |
| selector: | |
| duration: | |
| enable_day: true | |
| stopped_friendly_name: | |
| name: π·οΈ Custom Friendly Name | |
| default: 'Garage Door' | |
| selector: | |
| text: {} | |
| stopped_notify_devices: | |
| name: π² Mobile Notification Devices | |
| description: Mobile devices to receive notifications | |
| default: [] | |
| selector: | |
| device: | |
| integration: mobile_app | |
| multiple: true | |
| stopped_notification_title: | |
| name: π¬ Notification Title | |
| default: 'β οΈ {{ stopped_friendly_name }} Stopped Mid-Position' | |
| selector: | |
| text: {} | |
| stopped_notification_message: | |
| name: π§ Notification Message | |
| default: 'Door stopped at {{ as_timestamp(states[trigger.entity_id].last_updated) | timestamp_custom("%I:%M:%S %p") }}' | |
| selector: | |
| text: | |
| multiline: true | |
| stopped_notification_click_url: | |
| name: π Click URL | |
| default: /dashboard-garage | |
| selector: | |
| text: {} | |
| stopped_repeat_notification: | |
| name: π Repeat Alerts | |
| default: true | |
| selector: | |
| boolean: {} | |
| stopped_max_repeat_count: | |
| name: π’ Maximum Repeat Count | |
| default: 3 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 100 | |
| step: 1 | |
| mode: box | |
| stopped_time_between_repeats: | |
| name: β³ Delay Between Repeats | |
| default: | |
| minutes: 5 | |
| selector: | |
| duration: | |
| enable_day: true | |
| stopped_bypass_entities: | |
| name: π‘οΈ Bypass Entities | |
| default: [] | |
| selector: | |
| entity: | |
| domain: | |
| - binary_sensor | |
| - input_boolean | |
| multiple: true | |
| stopped_notification_icon: | |
| name: π¨ Notification Icon (Android) | |
| default: alert-circle | |
| selector: | |
| select: | |
| options: | |
| - alert-circle | |
| - alert | |
| - pause-circle | |
| - garage-alert | |
| stopped_notification_color: | |
| name: π¨ Notification Color (Android) | |
| default: orange | |
| selector: | |
| select: | |
| options: | |
| - red | |
| - orange | |
| - yellow | |
| - green | |
| - blue | |
| - purple | |
| stopped_notification_persistent: | |
| name: π Persistent (Android) | |
| default: true | |
| selector: | |
| boolean: {} | |
| stopped_notification_interruption: | |
| name: π Interruption Level (iOS) | |
| default: time-sensitive | |
| selector: | |
| select: | |
| options: | |
| - passive | |
| - active | |
| - time-sensitive | |
| - critical | |
| stopped_custom_action: | |
| name: βοΈ Custom Action | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # LIGHTING SECTION | |
| # ======================================== | |
| lighting_section: | |
| name: "Lighting Controls" | |
| description: "Triggers for Door States, Additional Entities, and Light Settings; plus Custom Actions!" | |
| icon: mdi:lightbulb | |
| collapsed: true | |
| input: | |
| lighting_enable_control: | |
| name: π― Enable Lighting Control | |
| description: Enable automatic lighting control based triggers below | |
| default: false | |
| selector: | |
| boolean: {} | |
| lighting_entities: | |
| name: π‘ Lights to Control | |
| description: Select the lights to control | |
| default: [] | |
| selector: | |
| entity: | |
| domain: light | |
| multiple: true | |
| lighting_trigger_entity: | |
| name: β‘ Triggers to Turn Lights ON | |
| description: Lights turn on when these entities change to ON (motion sensor, lock, door sensor, switch, cover/door) | |
| default: [] | |
| selector: | |
| entity: | |
| domain: | |
| - binary_sensor | |
| - switch | |
| - lock | |
| - cover | |
| - motion | |
| multiple: true | |
| lighting_triggers: | |
| name: π Door State Triggers | |
| description: Select which door states should turn lights ON | |
| default: | |
| - open | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: "πΌ Turn On when Opening" | |
| value: opening | |
| - label: "π΅ Turn On when 100% Open" | |
| value: open | |
| - label: "π½ Turn On when Closing" | |
| value: closing | |
| - label: "β οΈ Turn On when Stopped mid-cycle" | |
| value: stopped | |
| - label: "β Turn Off when 100% Closed" | |
| value: closed | |
| lighting_off_timer: | |
| name: β±οΈ Light Off Timer | |
| description: Turn lights off after this delay (0 to disable auto-off) | |
| default: | |
| minutes: 5 | |
| selector: | |
| duration: | |
| enable_day: true | |
| lighting_brightness: | |
| name: π Light Brightness | |
| description: Brightness percentage when turning lights on (1-100) | |
| default: 100 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 100 | |
| step: 1 | |
| unit_of_measurement: '%' | |
| mode: slider | |
| lighting_color_temp: | |
| name: π¨ Light Color Temperature | |
| description: Color temperature in Kelvin (optional) | |
| default: 3000 | |
| selector: | |
| number: | |
| min: 2000 | |
| max: 6500 | |
| step: 100 | |
| unit_of_measurement: 'K' | |
| mode: box | |
| lighting_schedule_enabled: | |
| name: π Use Disable Schedule? | |
| description: Disable lighting control during specific days/times | |
| default: false | |
| selector: | |
| boolean: {} | |
| lighting_schedule_days: | |
| name: π Disabled Days | |
| description: Days when lighting control should be disabled | |
| default: | |
| - mon | |
| - tue | |
| - wed | |
| - thu | |
| - fri | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Monday | |
| value: mon | |
| - label: Tuesday | |
| value: tue | |
| - label: Wednesday | |
| value: wed | |
| - label: Thursday | |
| value: thu | |
| - label: Friday | |
| value: fri | |
| - label: Saturday | |
| value: sat | |
| - label: Sunday | |
| value: sun | |
| lighting_schedule_start_time: | |
| name: π’ Disabled Start Time | |
| description: Disable lighting control starts at this time. For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "06:00:00" | |
| selector: | |
| time: {} | |
| lighting_schedule_end_time: | |
| name: π΄ Disabled End Time | |
| description: Disable lighting control ends at this time. For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "17:00:00" | |
| selector: | |
| time: {} | |
| lighting_custom_action: | |
| name: βοΈ Custom Lighting Action | |
| description: Custom action to run for lighting control | |
| default: [] | |
| selector: | |
| action: {} | |
| # ======================================== | |
| # AUTO-CLOSE DEFAULT SECTION | |
| # ======================================== | |
| autoclose_default_section: | |
| name: "Auto-Close Default" | |
| description: "Auto-close door after a set time (does not use a schedule)" | |
| icon: mdi:timer-outline | |
| collapsed: true | |
| input: | |
| autoclose_default_enabled: | |
| name: π Enable Auto-Close Default | |
| description: Auto-close door after delay below when door opens (24/7) | |
| default: false | |
| selector: | |
| boolean: {} | |
| autoclose_default_delay: | |
| name: β±οΈ Auto-Close Delay | |
| description: How long door stays open before auto-closing | |
| default: | |
| minutes: 10 | |
| selector: | |
| duration: | |
| enable_day: true | |
| # ======================================== | |
| # DOOR SCHEDULE 1 SECTION | |
| # ======================================== | |
| door_schedule1_section: | |
| name: "Door Schedule 1" | |
| description: "Schedule to automatically open or close the door. For 24-hour coverage, set both start and end times to 00:00:00." | |
| icon: mdi:calendar-clock | |
| collapsed: true | |
| input: | |
| schedule1_enabled: | |
| name: π Enable Door Schedule 1 | |
| default: false | |
| selector: | |
| boolean: {} | |
| schedule1_action: | |
| name: βοΈ Schedule Action | |
| description: Whether to open or close the door during this schedule | |
| default: close | |
| selector: | |
| select: | |
| options: | |
| - label: Close Door | |
| value: close | |
| - label: Open Door | |
| value: open | |
| schedule1_days: | |
| name: π Active Days | |
| default: | |
| - mon | |
| - tue | |
| - wed | |
| - thu | |
| - fri | |
| - sat | |
| - sun | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Monday | |
| value: mon | |
| - label: Tuesday | |
| value: tue | |
| - label: Wednesday | |
| value: wed | |
| - label: Thursday | |
| value: thu | |
| - label: Friday | |
| value: fri | |
| - label: Saturday | |
| value: sat | |
| - label: Sunday | |
| value: sun | |
| schedule1_start_time: | |
| name: π’ Start Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| schedule1_end_time: | |
| name: π΄ End Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| schedule1_delay: | |
| name: β±οΈ Action Delay | |
| description: How long after door opens before closing (for close action) or how long after schedule starts before opening (for open action) | |
| default: | |
| minutes: 10 | |
| selector: | |
| duration: | |
| enable_day: true | |
| # ======================================== | |
| # DOOR SCHEDULE 2 SECTION | |
| # ======================================== | |
| door_schedule2_section: | |
| name: "Door Schedule 2" | |
| description: "Schedule to automatically open or close the door. For 24-hour coverage, set both start and end times to 00:00:00." | |
| icon: mdi:calendar-clock | |
| collapsed: true | |
| input: | |
| schedule2_enabled: | |
| name: π Enable Door Schedule 2 | |
| default: false | |
| selector: | |
| boolean: {} | |
| schedule2_action: | |
| name: βοΈ Schedule Action | |
| description: Whether to open or close the door during this schedule | |
| default: close | |
| selector: | |
| select: | |
| options: | |
| - label: Close Door | |
| value: close | |
| - label: Open Door | |
| value: open | |
| schedule2_days: | |
| name: π Active Days | |
| default: | |
| - mon | |
| - tue | |
| - wed | |
| - thu | |
| - fri | |
| - sat | |
| - sun | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Monday | |
| value: mon | |
| - label: Tuesday | |
| value: tue | |
| - label: Wednesday | |
| value: wed | |
| - label: Thursday | |
| value: thu | |
| - label: Friday | |
| value: fri | |
| - label: Saturday | |
| value: sat | |
| - label: Sunday | |
| value: sun | |
| schedule2_start_time: | |
| name: π’ Start Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| schedule2_end_time: | |
| name: π΄ End Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| schedule2_delay: | |
| name: β±οΈ Action Delay | |
| description: How long after door opens before closing (for close action) or how long after schedule starts before opening (for open action) | |
| default: | |
| minutes: 15 | |
| selector: | |
| duration: | |
| enable_day: true | |
| # ======================================== | |
| # DOOR SCHEDULE 3 SECTION | |
| # ======================================== | |
| door_schedule3_section: | |
| name: "Door Schedule 3" | |
| description: "Schedule to automatically open or close the door. For 24-hour coverage, set both start and end times to 00:00:00." | |
| icon: mdi:calendar-clock | |
| collapsed: true | |
| input: | |
| schedule3_enabled: | |
| name: π Enable Door Schedule 3 | |
| default: false | |
| selector: | |
| boolean: {} | |
| schedule3_action: | |
| name: βοΈ Schedule Action | |
| description: Whether to open or close the door during this schedule | |
| default: close | |
| selector: | |
| select: | |
| options: | |
| - label: Close Door | |
| value: close | |
| - label: Open Door | |
| value: open | |
| schedule3_days: | |
| name: π Active Days | |
| default: | |
| - mon | |
| - tue | |
| - wed | |
| - thu | |
| - fri | |
| - sat | |
| - sun | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Monday | |
| value: mon | |
| - label: Tuesday | |
| value: tue | |
| - label: Wednesday | |
| value: wed | |
| - label: Thursday | |
| value: thu | |
| - label: Friday | |
| value: fri | |
| - label: Saturday | |
| value: sat | |
| - label: Sunday | |
| value: sun | |
| schedule3_start_time: | |
| name: π’ Start Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| schedule3_end_time: | |
| name: π΄ End Time | |
| description: For 24-hour coverage, set both start and end times to 00:00:00. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| schedule3_delay: | |
| name: β±οΈ Action Delay | |
| description: How long after door opens before closing (for close action) or how long after schedule starts before opening (for open action) | |
| default: | |
| minutes: 5 | |
| selector: | |
| duration: | |
| enable_day: true | |
| # ======================================== | |
| # DEBUG SECTION | |
| # ======================================== | |
| debug_section: | |
| name: "Debug Settings" | |
| description: "Enable debug notifications for troubleshooting" | |
| icon: mdi:bug | |
| collapsed: true | |
| input: | |
| debug_enabled: | |
| name: π Enable Debug Notifications | |
| description: Send persistent notifications for debugging automation triggers and actions | |
| default: false | |
| selector: | |
| boolean: {} | |
| debug_notification_id: | |
| name: π§ Debug Notification ID | |
| description: Unique ID for debug notifications (for clearing/updating) | |
| default: "smart_garage_debug" | |
| selector: | |
| text: {} | |
| debug_include_variables: | |
| name: π Include Variables in Debug | |
| description: Show variable values in debug notifications | |
| default: false | |
| selector: | |
| boolean: {} | |
| debug_trigger_types: | |
| name: β‘ Debug Trigger Types | |
| description: Select which trigger types to debug | |
| default: | |
| - door_states | |
| - lighting | |
| - schedules | |
| - alerts | |
| selector: | |
| select: | |
| multiple: true | |
| options: | |
| - label: Door State Changes | |
| value: door_states | |
| - label: Lighting Triggers | |
| value: lighting | |
| - label: Schedule Checks | |
| value: schedules | |
| - label: Alert Checks | |
| value: alerts | |
| - label: All Triggers | |
| value: all | |
| mode: restart | |
| max_exceeded: silent | |
| trigger_variables: | |
| # GARAGE DOOR ENTITY (STANDALONE) | |
| garage_door_entity: !input garage_door_entity | |
| variables: | |
| # DEBUG VARIABLES | |
| debug_enabled: !input debug_enabled | |
| debug_notification_id: !input debug_notification_id | |
| debug_include_variables: !input debug_include_variables | |
| debug_trigger_types: !input debug_trigger_types | |
| automation_friendly_name: > | |
| {{ this.attributes.friendly_name | trim | default('Smart Garage', true) }} | |
| # ALERT NOTIFICATION VARIABLES | |
| alert_enable_notification: !input alert_enable_notification | |
| alert_enable_schedule: !input alert_enable_schedule | |
| alert_days: !input alert_days | |
| alert_start_time: !input alert_start_time | |
| alert_end_time: !input alert_end_time | |
| alert_enable_entity: !input alert_enable_entity | |
| alert_entity: !input alert_entity | |
| alert_entity_states: !input alert_entity_states | |
| alert_notify_devices: !input alert_notify_devices | |
| alert_notification_title: !input alert_notification_title | |
| alert_notification_message: !input alert_notification_message | |
| alert_notification_click_url: !input alert_notification_click_url | |
| alert_notification_icon: !input alert_notification_icon | |
| alert_notification_color: !input alert_notification_color | |
| alert_notification_persistent: !input alert_notification_persistent | |
| alert_notification_interruption: !input alert_notification_interruption | |
| alert_custom_action: !input alert_custom_action | |
| # OPEN TRIGGER VARIABLES | |
| enable_open_notification: !input open_enable_notification | |
| open_duration_before_alert: !input open_duration_before_alert | |
| open_friendly_name: !input open_friendly_name | |
| open_notify_devices: !input open_notify_devices | |
| open_notification_title: !input open_notification_title | |
| open_notification_message: !input open_notification_message | |
| open_notification_click_url: !input open_notification_click_url | |
| open_repeat_notification: !input open_repeat_notification | |
| open_max_repeat_count: !input open_max_repeat_count | |
| open_time_between_repeats: !input open_time_between_repeats | |
| open_bypass_entities: !input open_bypass_entities | |
| open_bypass_schedule_enabled: !input open_bypass_schedule_enabled | |
| open_bypass_days: !input open_bypass_days | |
| open_bypass_start_time: !input open_bypass_start_time | |
| open_bypass_end_time: !input open_bypass_end_time | |
| open_notification_icon: !input open_notification_icon | |
| open_notification_color: !input open_notification_color | |
| open_notification_persistent: !input open_notification_persistent | |
| open_notification_interruption: !input open_notification_interruption | |
| open_custom_action: !input open_custom_action | |
| # OPENING TRIGGER VARIABLES | |
| enable_opening_notification: !input opening_enable_notification | |
| opening_duration_before_alert: !input opening_duration_before_alert | |
| opening_friendly_name: !input opening_friendly_name | |
| opening_notify_devices: !input opening_notify_devices | |
| opening_notification_title: !input opening_notification_title | |
| opening_notification_message: !input opening_notification_message | |
| opening_notification_click_url: !input opening_notification_click_url | |
| opening_repeat_notification: !input opening_repeat_notification | |
| opening_max_repeat_count: !input opening_max_repeat_count | |
| opening_time_between_repeats: !input opening_time_between_repeats | |
| opening_bypass_entities: !input opening_bypass_entities | |
| opening_notification_icon: !input opening_notification_icon | |
| opening_notification_color: !input opening_notification_color | |
| opening_notification_persistent: !input opening_notification_persistent | |
| opening_notification_interruption: !input opening_notification_interruption | |
| opening_custom_action: !input opening_custom_action | |
| # CLOSED TRIGGER VARIABLES | |
| enable_closed_notification: !input closed_enable_notification | |
| closed_duration_before_alert: !input closed_duration_before_alert | |
| closed_friendly_name: !input closed_friendly_name | |
| closed_notify_devices: !input closed_notify_devices | |
| closed_notification_title: !input closed_notification_title | |
| closed_notification_message: !input closed_notification_message | |
| closed_notification_click_url: !input closed_notification_click_url | |
| closed_repeat_notification: !input closed_repeat_notification | |
| closed_max_repeat_count: !input closed_max_repeat_count | |
| closed_time_between_repeats: !input closed_time_between_repeats | |
| closed_bypass_entities: !input closed_bypass_entities | |
| closed_notification_icon: !input closed_notification_icon | |
| closed_notification_color: !input closed_notification_color | |
| closed_notification_persistent: !input closed_notification_persistent | |
| closed_notification_interruption: !input closed_notification_interruption | |
| closed_custom_action: !input closed_custom_action | |
| # CLOSING TRIGGER VARIABLES | |
| enable_closing_notification: !input closing_enable_notification | |
| closing_duration_before_alert: !input closing_duration_before_alert | |
| closing_friendly_name: !input closing_friendly_name | |
| closing_notify_devices: !input closing_notify_devices | |
| closing_notification_title: !input closing_notification_title | |
| closing_notification_message: !input closing_notification_message | |
| closing_notification_click_url: !input closing_notification_click_url | |
| closing_repeat_notification: !input closing_repeat_notification | |
| closing_max_repeat_count: !input closing_max_repeat_count | |
| closing_time_between_repeats: !input closing_time_between_repeats | |
| closing_bypass_entities: !input closing_bypass_entities | |
| closing_notification_icon: !input closing_notification_icon | |
| closing_notification_color: !input closing_notification_color | |
| closing_notification_persistent: !input closing_notification_persistent | |
| closing_notification_interruption: !input closing_notification_interruption | |
| closing_custom_action: !input closing_custom_action | |
| # STOPPED TRIGGER VARIABLES | |
| enable_stopped_notification: !input stopped_enable_notification | |
| stopped_duration_before_alert: !input stopped_duration_before_alert | |
| stopped_friendly_name: !input stopped_friendly_name | |
| stopped_notify_devices: !input stopped_notify_devices | |
| stopped_notification_title: !input stopped_notification_title | |
| stopped_notification_message: !input stopped_notification_message | |
| stopped_notification_click_url: !input stopped_notification_click_url | |
| stopped_repeat_notification: !input stopped_repeat_notification | |
| stopped_max_repeat_count: !input stopped_max_repeat_count | |
| stopped_time_between_repeats: !input stopped_time_between_repeats | |
| stopped_bypass_entities: !input stopped_bypass_entities | |
| stopped_notification_icon: !input stopped_notification_icon | |
| stopped_notification_color: !input stopped_notification_color | |
| stopped_notification_persistent: !input stopped_notification_persistent | |
| stopped_notification_interruption: !input stopped_notification_interruption | |
| stopped_custom_action: !input stopped_custom_action | |
| # LIGHTING VARIABLES | |
| enable_lighting_control: !input lighting_enable_control | |
| light_entities: !input lighting_entities | |
| lighting_trigger_entity: !input lighting_trigger_entity | |
| lighting_triggers: !input lighting_triggers | |
| light_off_timer: !input lighting_off_timer | |
| light_brightness: !input lighting_brightness | |
| light_color_temp: !input lighting_color_temp | |
| lighting_schedule_enabled: !input lighting_schedule_enabled | |
| lighting_schedule_days: !input lighting_schedule_days | |
| lighting_schedule_start_time: !input lighting_schedule_start_time | |
| lighting_schedule_end_time: !input lighting_schedule_end_time | |
| lighting_custom_action: !input lighting_custom_action | |
| # AUTO-CLOSE DEFAULT VARIABLES | |
| autoclose_default_enabled: !input autoclose_default_enabled | |
| autoclose_default_delay: !input autoclose_default_delay | |
| # DOOR SCHEDULE VARIABLES | |
| schedule1_enabled: !input schedule1_enabled | |
| schedule1_action: !input schedule1_action | |
| schedule1_days: !input schedule1_days | |
| schedule1_start_time: !input schedule1_start_time | |
| schedule1_end_time: !input schedule1_end_time | |
| schedule1_delay: !input schedule1_delay | |
| schedule2_enabled: !input schedule2_enabled | |
| schedule2_action: !input schedule2_action | |
| schedule2_days: !input schedule2_days | |
| schedule2_start_time: !input schedule2_start_time | |
| schedule2_end_time: !input schedule2_end_time | |
| schedule2_delay: !input schedule2_delay | |
| schedule3_enabled: !input schedule3_enabled | |
| schedule3_action: !input schedule3_action | |
| schedule3_days: !input schedule3_days | |
| schedule3_start_time: !input schedule3_start_time | |
| schedule3_end_time: !input schedule3_end_time | |
| schedule3_delay: !input schedule3_delay | |
| triggers: | |
| # ALL state triggers directly reference the input | |
| - trigger: state | |
| entity_id: !input garage_door_entity | |
| to: "open" | |
| for: !input open_duration_before_alert | |
| id: trigger_open | |
| - trigger: state | |
| entity_id: !input garage_door_entity | |
| to: "opening" | |
| for: !input opening_duration_before_alert | |
| id: trigger_opening | |
| - trigger: state | |
| entity_id: !input garage_door_entity | |
| to: "closed" | |
| for: !input closed_duration_before_alert | |
| id: trigger_closed | |
| - trigger: state | |
| entity_id: !input garage_door_entity | |
| to: "closing" | |
| for: !input closing_duration_before_alert | |
| id: trigger_closing | |
| # Template trigger - Stopped trigger - robust version | |
| - platform: template | |
| value_template: > | |
| {% set door = garage_door_entity %} | |
| {% if not is_state_available(door) %} | |
| false | |
| {% else %} | |
| {% set door_state = states(door) %} | |
| {% set position = state_attr(door, 'current_position') %} | |
| {# Only proceed if we have a position attribute #} | |
| {% if position is none or position is string %} | |
| false | |
| {% else %} | |
| {% set pos_num = position | float(default=0) %} | |
| {# Door is stopped mid-position if: #} | |
| {# 1. Not actively opening/closing #} | |
| {# 2. Position is between 1 and 99 (not fully open or closed) #} | |
| {{ door_state not in ['opening', 'closing'] and | |
| pos_num > 0 and pos_num < 100 }} | |
| {% endif %} | |
| {% endif %} | |
| for: !input stopped_duration_before_alert | |
| id: trigger_stopped | |
| # Lighting triggers - State trigger for multiple entities | |
| - trigger: state | |
| entity_id: !input lighting_trigger_entity | |
| id: trigger_lighting_entities | |
| # Trigger for monitoring light entities (for Light Off Timer) | |
| - trigger: state | |
| entity_id: !input lighting_entities | |
| id: trigger_lights_state_changed | |
| - trigger: time_pattern | |
| hours: "/1" | |
| minutes: "0" | |
| seconds: "0" | |
| id: check_door_schedules | |
| action: | |
| # Clear previous debug notification at start | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| then: | |
| - service: persistent_notification.dismiss | |
| data: | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Start of main choose block | |
| - choose: | |
| # Handle OPEN trigger | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_open | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - OPEN Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| πͺ Door Entity: {{ garage_door_entity }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_open_notification: {{ enable_open_notification }} | |
| - open_friendly_name: {{ open_friendly_name }} | |
| - open_duration_before_alert: {{ open_duration_before_alert }} | |
| - open_notify_devices count: {{ open_notify_devices | length }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Set variables for this trigger | |
| - variables: | |
| friendly_name: "{{ open_friendly_name }}" | |
| notification_tag: "garage-open-{{ garage_door_entity }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Check if open notifications are enabled and conditions met | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_open_notification }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| - condition: template | |
| value_template: > | |
| {% set open_bypass_entities = open_bypass_entities if open_bypass_entities is defined else [] %} | |
| {% if open_bypass_entities | length > 0 %} | |
| {{ not (open_bypass_entities | selectattr('state', 'eq', 'on') | list | count > 0) }} | |
| {% else %} | |
| true | |
| {% endif %} | |
| - condition: template | |
| value_template: > | |
| {% if open_bypass_schedule_enabled %} | |
| {% set open_bypass_days = open_bypass_days if open_bypass_days is defined else [] %} | |
| {% set day_match = current_day in open_bypass_days %} | |
| {% if day_match %} | |
| {% if open_bypass_start_time <= open_bypass_end_time %} | |
| {{ not (current_time >= open_bypass_start_time and current_time <= open_bypass_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= open_bypass_start_time or current_time <= open_bypass_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for sending open notifications | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending OPEN Notifications" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Notification Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π± Devices: {{ open_notify_devices | length }} device(s) | |
| π¬ Title: {{ open_notification_title }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # OPEN - Send notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ open_notify_devices if open_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
| data: | |
| message: "{{ open_notification_message }}" | |
| title: "{{ open_notification_title }}" | |
| data: | |
| clickAction: "{{ open_notification_click_url }}" | |
| url: "{{ open_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ open_notification_color }}" | |
| notification_icon: "mdi:{{ open_notification_icon }}" | |
| push: | |
| interruption-level: "{{ open_notification_interruption }}" | |
| persistent: "{{ open_notification_persistent }}" | |
| sticky: "{{ open_notification_persistent }}" | |
| # Execute custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ open_custom_action is defined and open_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ open_custom_action }}" | |
| # Handle repeat notifications if enabled | |
| - if: | |
| - condition: template | |
| value_template: "{{ open_repeat_notification }}" | |
| then: | |
| - variables: | |
| repeat_counter: 0 | |
| - repeat: | |
| while: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| - condition: template | |
| value_template: "{{ open_max_repeat_count == 0 or repeat_counter < open_max_repeat_count }}" | |
| sequence: | |
| - delay: "{{ open_time_between_repeats }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| - condition: template | |
| value_template: "{{ open_max_repeat_count == 0 or repeat_counter < open_max_repeat_count }}" | |
| then: | |
| - repeat: | |
| for_each: "{{ open_notify_devices if open_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ open_notification_message }}" | |
| title: "{{ open_notification_title }}" | |
| data: | |
| clickAction: "{{ open_notification_click_url }}" | |
| url: "{{ open_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ open_notification_color }}" | |
| notification_icon: "mdi:{{ open_notification_icon }}" | |
| push: | |
| interruption-level: "{{ open_notification_interruption }}" | |
| persistent: "{{ open_notification_persistent }}" | |
| sticky: "{{ open_notification_persistent }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ open_custom_action is defined and open_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ open_custom_action }}" | |
| - variables: | |
| repeat_counter: "{{ repeat_counter + 1 }}" | |
| # Handle alert notification for OPEN based on conditions | |
| - if: | |
| - condition: template | |
| value_template: "{{ alert_enable_notification }}" | |
| - condition: or | |
| conditions: | |
| # Schedule condition | |
| - condition: and | |
| conditions: | |
| - condition: template | |
| value_template: "{{ alert_enable_schedule }}" | |
| - condition: template | |
| value_template: > | |
| {% set alert_days = alert_days if alert_days is defined else [] %} | |
| {{ current_day in alert_days }} | |
| - condition: template | |
| value_template: > | |
| {% if alert_start_time <= alert_end_time %} | |
| {{ current_time >= alert_start_time and current_time <= alert_end_time }} | |
| {% else %} | |
| {{ current_time >= alert_start_time or current_time <= alert_end_time }} | |
| {% endif %} | |
| # Entity condition | |
| - condition: and | |
| conditions: | |
| - condition: template | |
| value_template: "{{ alert_enable_entity }}" | |
| - condition: template | |
| value_template: "{{ alert_entity != '' }}" | |
| - condition: template | |
| value_template: > | |
| {% if alert_enable_entity and alert_entity != '' and alert_entity_states != '' %} | |
| {% set states_list = alert_entity_states.split(',') | map('trim') | list %} | |
| {{ states(alert_entity) in states_list }} | |
| {% else %} | |
| false | |
| {% endif %} | |
| then: | |
| # Debug notification for alert | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'alerts' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending ALERT Notifications" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Alert Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π Schedule Match: {{ alert_enable_schedule and current_day in alert_days and ((alert_start_time <= alert_end_time and current_time >= alert_start_time and current_time <= alert_end_time) or (alert_start_time > alert_end_time and (current_time >= alert_start_time or current_time <= alert_end_time))) }} | |
| βοΈ Entity Match: {{ alert_enable_entity and alert_entity != '' and (states(alert_entity) in alert_entity_states.split(',')) }} | |
| π± Alert Devices: {{ alert_notify_devices | length }} device(s) | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # ALERT - Send alert notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ alert_notify_devices if alert_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ alert_notification_message }}" | |
| title: "{{ alert_notification_title }}" | |
| data: | |
| clickAction: "{{ alert_notification_click_url }}" | |
| url: "{{ alert_notification_click_url }}" | |
| tag: "garage-alert-{{ garage_door_entity }}" | |
| color: "{{ alert_notification_color }}" | |
| notification_icon: "mdi:{{ alert_notification_icon }}" | |
| push: | |
| interruption-level: "{{ alert_notification_interruption }}" | |
| persistent: "{{ alert_notification_persistent }}" | |
| sticky: "{{ alert_notification_persistent }}" | |
| # Execute alert custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ alert_custom_action is defined and alert_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ alert_custom_action }}" | |
| # Handle lighting control for OPEN state | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: "{{ 'open' in lighting_triggers }}" | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for lighting control | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - OPEN Lighting Control" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π‘ Lights: {{ light_entities | length }} light(s) | |
| π Brightness: {{ light_brightness }}% | |
| π¨ Color Temp: {{ light_color_temp }}K | |
| β±οΈ Off Timer: {{ light_off_timer }} | |
| π Schedule Enabled: {{ lighting_schedule_enabled }} | |
| π Schedule Active: {{ not (lighting_schedule_enabled and current_day in lighting_schedule_days and ((lighting_schedule_start_time <= lighting_schedule_end_time and current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) or (lighting_schedule_start_time > lighting_schedule_end_time and (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time)))) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Turn lights on with specified settings | |
| - if: | |
| - condition: template | |
| value_template: "{{ light_entities is defined and light_entities | length > 0 }}" | |
| then: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_entities }}" | |
| data: | |
| brightness_pct: "{{ light_brightness }}" | |
| color_temp: "{{ light_color_temp }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle Auto-Close Default | |
| - if: | |
| - condition: template | |
| value_template: "{{ autoclose_default_enabled }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| then: | |
| # Debug notification for auto-close | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Auto-Close Started" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Start Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| β±οΈ Close Delay: {{ autoclose_default_delay }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - delay: "{{ autoclose_default_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| then: | |
| # Debug notification for auto-close action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Auto-Close Executing" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Close Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.close_cover | |
| target: | |
| entity_id: !input garage_door_entity | |
| # Handle OPENING trigger | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_opening | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - OPENING Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| πͺ Door Entity: {{ garage_door_entity }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_opening_notification: {{ enable_opening_notification }} | |
| - opening_friendly_name: {{ opening_friendly_name }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - variables: | |
| friendly_name: "{{ opening_friendly_name }}" | |
| notification_tag: "garage-opening-{{ garage_door_entity }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Check if opening notifications are enabled and conditions met | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_opening_notification }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'opening' }}" | |
| - condition: template | |
| value_template: > | |
| {% set opening_bypass_entities = opening_bypass_entities if opening_bypass_entities is defined else [] %} | |
| {% if opening_bypass_entities | length > 0 %} | |
| {{ not (opening_bypass_entities | selectattr('state', 'eq', 'on') | list | count > 0) }} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for sending opening notifications | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending OPENING Notifications" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Notification Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π± Devices: {{ opening_notify_devices | length }} device(s) | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # OPENING - Send notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ opening_notify_devices if opening_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
| data: | |
| message: "{{ opening_notification_message }}" | |
| title: "{{ opening_notification_title }}" | |
| data: | |
| clickAction: "{{ opening_notification_click_url }}" | |
| url: "{{ opening_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ opening_notification_color }}" | |
| notification_icon: "mdi:{{ opening_notification_icon }}" | |
| push: | |
| interruption-level: "{{ opening_notification_interruption }}" | |
| persistent: "{{ opening_notification_persistent }}" | |
| sticky: "{{ opening_notification_persistent }}" | |
| # Execute custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ opening_custom_action is defined and opening_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ opening_custom_action }}" | |
| # Handle repeat notifications if enabled | |
| - if: | |
| - condition: template | |
| value_template: "{{ opening_repeat_notification }}" | |
| then: | |
| - variables: | |
| repeat_counter: 0 | |
| - repeat: | |
| while: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'opening' }}" | |
| - condition: template | |
| value_template: "{{ opening_max_repeat_count == 0 or repeat_counter < opening_max_repeat_count }}" | |
| sequence: | |
| - delay: "{{ opening_time_between_repeats }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'opening' }}" | |
| - condition: template | |
| value_template: "{{ opening_max_repeat_count == 0 or repeat_counter < opening_max_repeat_count }}" | |
| then: | |
| - repeat: | |
| for_each: "{{ opening_notify_devices if opening_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ opening_notification_message }}" | |
| title: "{{ opening_notification_title }}" | |
| data: | |
| clickAction: "{{ opening_notification_click_url }}" | |
| url: "{{ opening_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ opening_notification_color }}" | |
| notification_icon: "mdi:{{ opening_notification_icon }}" | |
| push: | |
| interruption-level: "{{ opening_notification_interruption }}" | |
| persistent: "{{ opening_notification_persistent }}" | |
| sticky: "{{ opening_notification_persistent }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ opening_custom_action is defined and opening_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ opening_custom_action }}" | |
| - variables: | |
| repeat_counter: "{{ repeat_counter + 1 }}" | |
| # Handle alert notification for OPENING based on conditions | |
| - if: | |
| - condition: template | |
| value_template: "{{ alert_enable_notification }}" | |
| - condition: or | |
| conditions: | |
| # Schedule condition | |
| - condition: and | |
| conditions: | |
| - condition: template | |
| value_template: "{{ alert_enable_schedule }}" | |
| - condition: template | |
| value_template: > | |
| {% set alert_days = alert_days if alert_days is defined else [] %} | |
| {{ current_day in alert_days }} | |
| - condition: template | |
| value_template: > | |
| {% if alert_start_time <= alert_end_time %} | |
| {{ current_time >= alert_start_time and current_time <= alert_end_time }} | |
| {% else %} | |
| {{ current_time >= alert_start_time or current_time <= alert_end_time }} | |
| {% endif %} | |
| # Entity condition | |
| - condition: and | |
| conditions: | |
| - condition: template | |
| value_template: "{{ alert_enable_entity }}" | |
| - condition: template | |
| value_template: "{{ alert_entity != '' }}" | |
| - condition: template | |
| value_template: > | |
| {% if alert_enable_entity and alert_entity != '' and alert_entity_states != '' %} | |
| {% set states_list = alert_entity_states.split(',') | map('trim') | list %} | |
| {{ states(alert_entity) in states_list }} | |
| {% else %} | |
| false | |
| {% endif %} | |
| then: | |
| # Debug notification for alert | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'alerts' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending ALERT Notifications (Opening)" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Alert Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π Schedule Match: {{ alert_enable_schedule and current_day in alert_days and ((alert_start_time <= alert_end_time and current_time >= alert_start_time and current_time <= alert_end_time) or (alert_start_time > alert_end_time and (current_time >= alert_start_time or current_time <= alert_end_time))) }} | |
| βοΈ Entity Match: {{ alert_enable_entity and alert_entity != '' and (states(alert_entity) in alert_entity_states.split(',')) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Send alert notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ alert_notify_devices if alert_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ alert_notification_message }}" | |
| title: "{{ alert_notification_title }}" | |
| data: | |
| clickAction: "{{ alert_notification_click_url }}" | |
| url: "{{ alert_notification_click_url }}" | |
| tag: "garage-alert-{{ garage_door_entity }}" | |
| color: "{{ alert_notification_color }}" | |
| notification_icon: "mdi:{{ alert_notification_icon }}" | |
| push: | |
| interruption-level: "{{ alert_notification_interruption }}" | |
| persistent: "{{ alert_notification_persistent }}" | |
| sticky: "{{ alert_notification_persistent }}" | |
| # Execute alert custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ alert_custom_action is defined and alert_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ alert_custom_action }}" | |
| # Handle lighting control for OPENING state | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: "{{ 'opening' in lighting_triggers }}" | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for lighting control | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - OPENING Lighting Control" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π‘ Lights: {{ light_entities | length }} light(s) | |
| π Brightness: {{ light_brightness }}% | |
| π¨ Color Temp: {{ light_color_temp }}K | |
| β±οΈ Off Timer: {{ light_off_timer }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ light_entities is defined and light_entities | length > 0 }}" | |
| then: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_entities }}" | |
| data: | |
| brightness_pct: "{{ light_brightness }}" | |
| color_temp: "{{ light_color_temp }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle CLOSED trigger | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_closed | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Garage Door CLOSED Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| πͺ Door Entity: {{ garage_door_entity }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_closed_notification: {{ enable_closed_notification }} | |
| - closed_friendly_name: {{ closed_friendly_name }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - variables: | |
| friendly_name: "{{ closed_friendly_name }}" | |
| notification_tag: "garage-closed-{{ garage_door_entity }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Check if closed notifications are enabled and conditions met | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_closed_notification }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| - condition: template | |
| value_template: > | |
| {% set closed_bypass_entities = closed_bypass_entities if closed_bypass_entities is defined else [] %} | |
| {% if closed_bypass_entities | length > 0 %} | |
| {{ not (closed_bypass_entities | selectattr('state', 'eq', 'on') | list | count > 0) }} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for sending closed notifications | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending CLOSED Notifications" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Notification Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π± Devices: {{ closed_notify_devices | length }} device(s) | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # CLOSED - Send notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ closed_notify_devices if closed_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
| data: | |
| message: "{{ closed_notification_message }}" | |
| title: "{{ closed_notification_title }}" | |
| data: | |
| clickAction: "{{ closed_notification_click_url }}" | |
| url: "{{ closed_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ closed_notification_color }}" | |
| notification_icon: "mdi:{{ closed_notification_icon }}" | |
| push: | |
| interruption-level: "{{ closed_notification_interruption }}" | |
| persistent: "{{ closed_notification_persistent }}" | |
| sticky: "{{ closed_notification_persistent }}" | |
| # Execute custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ closed_custom_action is defined and closed_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ closed_custom_action }}" | |
| # Handle repeat notifications if enabled | |
| - if: | |
| - condition: template | |
| value_template: "{{ closed_repeat_notification }}" | |
| then: | |
| - variables: | |
| repeat_counter: 0 | |
| - repeat: | |
| while: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| - condition: template | |
| value_template: "{{ closed_max_repeat_count == 0 or repeat_counter < closed_max_repeat_count }}" | |
| sequence: | |
| - delay: "{{ closed_time_between_repeats }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| - condition: template | |
| value_template: "{{ closed_max_repeat_count == 0 or repeat_counter < closed_max_repeat_count }}" | |
| then: | |
| - repeat: | |
| for_each: "{{ closed_notify_devices if closed_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ closed_notification_message }}" | |
| title: "{{ closed_notification_title }}" | |
| data: | |
| clickAction: "{{ closed_notification_click_url }}" | |
| url: "{{ closed_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ closed_notification_color }}" | |
| notification_icon: "mdi:{{ closed_notification_icon }}" | |
| push: | |
| interruption-level: "{{ closed_notification_interruption }}" | |
| persistent: "{{ closed_notification_persistent }}" | |
| sticky: "{{ closed_notification_persistent }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ closed_custom_action is defined and closed_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ closed_custom_action }}" | |
| - variables: | |
| repeat_counter: "{{ repeat_counter + 1 }}" | |
| # Handle lighting control for CLOSED state | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: "{{ 'closed' in lighting_triggers }}" | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for lighting control | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - CLOSED Lighting Control" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π‘ Lights: {{ light_entities | length }} light(s) | |
| β Action: Turning lights OFF | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Turn lights off | |
| - if: | |
| - condition: template | |
| value_template: "{{ light_entities is defined and light_entities | length > 0 }}" | |
| then: | |
| - service: light.turn_off | |
| target: | |
| entity_id: "{{ light_entities }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle CLOSING trigger | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_closing | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - CLOSING Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| πͺ Door Entity: {{ garage_door_entity }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_closing_notification: {{ enable_closing_notification }} | |
| - closing_friendly_name: {{ closing_friendly_name }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - variables: | |
| friendly_name: "{{ closing_friendly_name }}" | |
| notification_tag: "garage-closing-{{ garage_door_entity }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Check if closing notifications are enabled and conditions met | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_closing_notification }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closing' }}" | |
| - condition: template | |
| value_template: > | |
| {% set closing_bypass_entities = closing_bypass_entities if closing_bypass_entities is defined else [] %} | |
| {% if closing_bypass_entities | length > 0 %} | |
| {{ not (closing_bypass_entities | selectattr('state', 'eq', 'on') | list | count > 0) }} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for sending closing notifications | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending CLOSING Notifications" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Notification Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π± Devices: {{ closing_notify_devices | length }} device(s) | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # CLOSING - Send notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ closing_notify_devices if closing_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
| data: | |
| message: "{{ closing_notification_message }}" | |
| title: "{{ closing_notification_title }}" | |
| data: | |
| clickAction: "{{ closing_notification_click_url }}" | |
| url: "{{ closing_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ closing_notification_color }}" | |
| notification_icon: "mdi:{{ closing_notification_icon }}" | |
| push: | |
| interruption-level: "{{ closing_notification_interruption }}" | |
| persistent: "{{ closing_notification_persistent }}" | |
| sticky: "{{ closing_notification_persistent }}" | |
| # Execute custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ closing_custom_action is defined and closing_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ closing_custom_action }}" | |
| # Handle repeat notifications if enabled | |
| - if: | |
| - condition: template | |
| value_template: "{{ closing_repeat_notification }}" | |
| then: | |
| - variables: | |
| repeat_counter: 0 | |
| - repeat: | |
| while: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closing' }}" | |
| - condition: template | |
| value_template: "{{ closing_max_repeat_count == 0 or repeat_counter < closing_max_repeat_count }}" | |
| sequence: | |
| - delay: "{{ closing_time_between_repeats }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closing' }}" | |
| - condition: template | |
| value_template: "{{ closing_max_repeat_count == 0 or repeat_counter < closing_max_repeat_count }}" | |
| then: | |
| - repeat: | |
| for_each: "{{ closing_notify_devices if closing_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ closing_notification_message }}" | |
| title: "{{ closing_notification_title }}" | |
| data: | |
| clickAction: "{{ closing_notification_click_url }}" | |
| url: "{{ closing_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ closing_notification_color }}" | |
| notification_icon: "mdi:{{ closing_notification_icon }}" | |
| push: | |
| interruption-level: "{{ closing_notification_interruption }}" | |
| persistent: "{{ closing_notification_persistent }}" | |
| sticky: "{{ closing_notification_persistent }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ closing_custom_action is defined and closing_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ closing_custom_action }}" | |
| - variables: | |
| repeat_counter: "{{ repeat_counter + 1 }}" | |
| # Handle lighting control for CLOSING state | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: "{{ 'closing' in lighting_triggers }}" | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for lighting control | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - CLOSING Lighting Control" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π‘ Lights: {{ light_entities | length }} light(s) | |
| π Brightness: {{ light_brightness }}% | |
| π¨ Color Temp: {{ light_color_temp }}K | |
| β±οΈ Off Timer: {{ light_off_timer }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ light_entities is defined and light_entities | length > 0 }}" | |
| then: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_entities }}" | |
| data: | |
| brightness_pct: "{{ light_brightness }}" | |
| color_temp: "{{ light_color_temp }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle STOPPED trigger | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_stopped | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Garage Door STOPPED Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| πͺ Door Entity: {{ garage_door_entity }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| π Position: {{ state_attr(garage_door_entity, 'current_position') | default('N/A') }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_stopped_notification: {{ enable_stopped_notification }} | |
| - stopped_friendly_name: {{ stopped_friendly_name }} | |
| - stopped_duration_before_alert: {{ stopped_duration_before_alert }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - variables: | |
| friendly_name: "{{ stopped_friendly_name }}" | |
| notification_tag: "garage-stopped-{{ garage_door_entity }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Check if stopped notifications are enabled and conditions met | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_stopped_notification }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) not in ['open', 'opening', 'closed', 'closing'] }}" | |
| - condition: template | |
| value_template: > | |
| {% set stopped_bypass_entities = stopped_bypass_entities if stopped_bypass_entities is defined else [] %} | |
| {% if stopped_bypass_entities | length > 0 %} | |
| {{ not (stopped_bypass_entities | selectattr('state', 'eq', 'on') | list | count > 0) }} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for sending stopped notifications | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'door_states' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Sending STOPPED Notifications" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Notification Time: {{ action_time }} | |
| πͺ Door: {{ friendly_name }} | |
| π± Devices: {{ stopped_notify_devices | length }} device(s) | |
| π Repeat Enabled: {{ stopped_repeat_notification }} | |
| π’ Max Repeats: {{ stopped_max_repeat_count }} | |
| β³ Time Between: {{ stopped_time_between_repeats }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # STOPPED - Send notifications to all selected devices | |
| - repeat: | |
| for_each: "{{ stopped_notify_devices if stopped_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
| data: | |
| message: "{{ stopped_notification_message }}" | |
| title: "{{ stopped_notification_title }}" | |
| data: | |
| clickAction: "{{ stopped_notification_click_url }}" | |
| url: "{{ stopped_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ stopped_notification_color }}" | |
| notification_icon: "mdi:{{ stopped_notification_icon }}" | |
| push: | |
| interruption-level: "{{ stopped_notification_interruption }}" | |
| persistent: "{{ stopped_notification_persistent }}" | |
| sticky: "{{ stopped_notification_persistent }}" | |
| # Execute custom action | |
| - if: | |
| - condition: template | |
| value_template: "{{ stopped_custom_action is defined and stopped_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ stopped_custom_action }}" | |
| # Handle repeat notifications if enabled | |
| - if: | |
| - condition: template | |
| value_template: "{{ stopped_repeat_notification }}" | |
| then: | |
| - variables: | |
| repeat_counter: 0 | |
| - repeat: | |
| while: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) not in ['open', 'opening', 'closed', 'closing'] }}" | |
| - condition: template | |
| value_template: "{{ stopped_max_repeat_count == 0 or repeat_counter < stopped_max_repeat_count }}" | |
| sequence: | |
| - delay: "{{ stopped_time_between_repeats }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) not in ['open', 'opening', 'closed', 'closing'] }}" | |
| - condition: template | |
| value_template: "{{ stopped_max_repeat_count == 0 or repeat_counter < stopped_max_repeat_count }}" | |
| then: | |
| - repeat: | |
| for_each: "{{ stopped_notify_devices if stopped_notify_devices is defined else [] }}" | |
| sequence: | |
| - service: "{{ repeat.item }}" | |
| data: | |
| message: "{{ stopped_notification_message }}" | |
| title: "{{ stopped_notification_title }}" | |
| data: | |
| clickAction: "{{ stopped_notification_click_url }}" | |
| url: "{{ stopped_notification_click_url }}" | |
| tag: "{{ notification_tag }}" | |
| color: "{{ stopped_notification_color }}" | |
| notification_icon: "mdi:{{ stopped_notification_icon }}" | |
| push: | |
| interruption-level: "{{ stopped_notification_interruption }}" | |
| persistent: "{{ stopped_notification_persistent }}" | |
| sticky: "{{ stopped_notification_persistent }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ stopped_custom_action is defined and stopped_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ stopped_custom_action }}" | |
| - variables: | |
| repeat_counter: "{{ repeat_counter + 1 }}" | |
| # Handle lighting control for STOPPED state | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: "{{ 'stopped' in lighting_triggers }}" | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for lighting control | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - STOPPED Lighting Control" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π‘ Lights: {{ light_entities | length }} light(s) | |
| π Brightness: {{ light_brightness }}% | |
| π¨ Color Temp: {{ light_color_temp }}K | |
| β±οΈ Off Timer: {{ light_off_timer }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ light_entities is defined and light_entities | length > 0 }}" | |
| then: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_entities }}" | |
| data: | |
| brightness_pct: "{{ light_brightness }}" | |
| color_temp: "{{ light_color_temp }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle LIGHTING trigger entities | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_lighting_entities | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Lighting Entity Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| β‘ Trigger Entity: {{ trigger.entity_id }} | |
| π Trigger State: {{ trigger.to_state.state }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_lighting_control: {{ enable_lighting_control }} | |
| - light_entities count: {{ light_entities | length }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Check if the trigger entity changed to an active state | |
| - variables: | |
| trigger_entity: "{{ trigger.entity_id }}" | |
| trigger_state: "{{ trigger.to_state.state }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: > | |
| {% set active_states = ['on', 'open', 'unlocked'] %} | |
| {{ trigger_state in active_states }} | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Debug notification for lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Triggering Lights ON" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| β‘ Trigger Entity: {{ trigger_entity }} | |
| π Trigger State: {{ trigger_state }} | |
| π‘ Lights: {{ light_entities | length }} light(s) | |
| π Brightness: {{ light_brightness }}% | |
| π¨ Color Temp: {{ light_color_temp }}K | |
| β±οΈ Off Timer: {{ light_off_timer }} | |
| π Schedule Enabled: {{ lighting_schedule_enabled }} | |
| π Schedule Active: {{ not (lighting_schedule_enabled and current_day in lighting_schedule_days and ((lighting_schedule_start_time <= lighting_schedule_end_time and current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) or (lighting_schedule_start_time > lighting_schedule_end_time and (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time)))) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Turn lights on with specified settings | |
| - if: | |
| - condition: template | |
| value_template: "{{ light_entities is defined and light_entities | length > 0 }}" | |
| then: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_entities }}" | |
| data: | |
| brightness_pct: "{{ light_brightness }}" | |
| color_temp: "{{ light_color_temp }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle LIGHTS STATE CHANGED trigger (for Light Off Timer) | |
| - conditions: | |
| - condition: trigger | |
| id: trigger_lights_state_changed | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Light State Changed" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| π‘ Light Entity: {{ trigger.entity_id }} | |
| π Light State: {{ trigger.to_state.state }} | |
| {% if debug_include_variables %} | |
| π Variables: | |
| - enable_lighting_control: {{ enable_lighting_control }} | |
| - light_off_timer: {{ light_off_timer }} | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Variables for this trigger | |
| - variables: | |
| changed_light: "{{ trigger.entity_id }}" | |
| trigger_state: "{{ trigger.to_state.state }}" | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Only proceed if lighting control is enabled and light was turned ON (not off) | |
| - if: | |
| - condition: template | |
| value_template: "{{ enable_lighting_control }}" | |
| - condition: template | |
| value_template: "{{ trigger_state != 'off' and trigger_state != 'unavailable' }}" | |
| - condition: template | |
| value_template: > | |
| {% if lighting_schedule_enabled %} | |
| {% set lighting_schedule_days = lighting_schedule_days if lighting_schedule_days is defined else [] %} | |
| {% set day_match = current_day in lighting_schedule_days %} | |
| {% if day_match %} | |
| {% if lighting_schedule_start_time <= lighting_schedule_end_time %} | |
| {{ not (current_time >= lighting_schedule_start_time and current_time <= lighting_schedule_end_time) }} | |
| {% else %} | |
| {{ not (current_time >= lighting_schedule_start_time or current_time <= lighting_schedule_end_time) }} | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| {% else %} | |
| true | |
| {% endif %} | |
| then: | |
| # Calculate total seconds for timer | |
| - variables: | |
| timer_seconds: > | |
| {% set timer = light_off_timer if light_off_timer is defined else {} %} | |
| {{ timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 }} | |
| # Only start timer if it's configured (> 0 seconds) | |
| - if: | |
| - condition: template | |
| value_template: "{{ timer_seconds > 0 }}" | |
| then: | |
| # Debug notification for Light Off Timer start | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Starting Light Off Timer" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Timer Start: {{ action_time }} | |
| π‘ Light: {{ changed_light }} | |
| β±οΈ Timer Duration: {{ light_off_timer }} ({{ timer_seconds }} seconds) | |
| π Current State: {{ trigger_state }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Wait for the specified delay | |
| - delay: "{{ light_off_timer }}" | |
| # Check if light should be turned off | |
| - variables: | |
| should_turn_off: > | |
| {% if states(changed_light) == 'off' or states(changed_light) == 'unavailable' %} | |
| false | |
| {% else %} | |
| {% set door_state = states(garage_door_entity) %} | |
| {% set keep_lights_on = false %} | |
| {% if door_state == 'open' and 'open' in lighting_triggers %} | |
| {% set keep_lights_on = true %} | |
| {% elif door_state == 'opening' and 'opening' in lighting_triggers %} | |
| {% set keep_lights_on = true %} | |
| {% elif door_state == 'closing' and 'closing' in lighting_triggers %} | |
| {% set keep_lights_on = true %} | |
| {% elif door_state not in ['open', 'opening', 'closed', 'closing'] and 'stopped' in lighting_triggers %} | |
| {% set keep_lights_on = true %} | |
| {% endif %} | |
| {{ not keep_lights_on }} | |
| {% endif %} | |
| # Turn off if conditions are met | |
| - if: | |
| - condition: template | |
| value_template: "{{ should_turn_off }}" | |
| then: | |
| # Debug notification for turning light off | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Turning Light OFF" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Turn Off Time: {{ action_time }} | |
| π‘ Light: {{ changed_light }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| β±οΈ Timer Expired: Yes | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: light.turn_off | |
| target: | |
| entity_id: "{{ changed_light }}" | |
| else: | |
| # Debug notification for keeping light on | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'lighting' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Keeping Light ON" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Check Time: {{ action_time }} | |
| π‘ Light: {{ changed_light }} | |
| π Door State: {{ states(garage_door_entity) }} | |
| β±οΈ Timer Expired: Yes | |
| βΉοΈ Reason: Door state requires light to stay on | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Execute custom lighting action | |
| - if: | |
| - condition: template | |
| value_template: "{{ lighting_custom_action is defined and lighting_custom_action | length > 0 }}" | |
| then: | |
| - action: "{{ lighting_custom_action }}" | |
| # Handle door schedule checks (hourly) | |
| - conditions: | |
| - condition: trigger | |
| id: check_door_schedules | |
| sequence: | |
| # Capture trigger time at the beginning of the sequence | |
| - variables: | |
| trigger_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| # Debug notification | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule Check Triggered" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Start: {{ action_time }} | |
| π Current Day: {{ now().strftime('%a').lower() }} | |
| π Current Time: {{ now().strftime('%H:%M:%S') }} | |
| πͺ Door State: {{ states(garage_door_entity) }} | |
| {% if debug_include_variables %} | |
| π Schedule Status: | |
| - Schedule 1: {{ schedule1_enabled }} ({{ schedule1_action }}) | |
| - Schedule 2: {{ schedule2_enabled }} ({{ schedule2_action }}) | |
| - Schedule 3: {{ schedule3_enabled }} ({{ schedule3_action }}) | |
| {% endif %} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - variables: | |
| current_day: "{{ now().strftime('%a').lower() }}" | |
| current_time: "{{ now().strftime('%H:%M:%S') }}" | |
| # Check Schedule 1 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule1_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% set schedule1_days = schedule1_days if schedule1_days is defined else [] %} | |
| {{ current_day in schedule1_days }} | |
| - condition: template | |
| value_template: > | |
| {% if schedule1_start_time < schedule1_end_time %} | |
| {{ current_time >= schedule1_start_time and current_time <= schedule1_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule1_start_time or current_time <= schedule1_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 1 check | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 1 Active" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Check Time: {{ action_time }} | |
| π Schedule 1 Active | |
| βοΈ Action: {{ schedule1_action }} | |
| β±οΈ Delay: {{ schedule1_delay }} | |
| πͺ Door State: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Handle OPEN action for Schedule 1 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule1_action == 'open' }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| then: | |
| - delay: "{{ schedule1_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| - condition: template | |
| value_template: > | |
| {% if schedule1_start_time < schedule1_end_time %} | |
| {{ current_time >= schedule1_start_time and current_time <= schedule1_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule1_start_time or current_time <= schedule1_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 1 open action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 1 Opening Door" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π Schedule 1 Executing | |
| βοΈ Action: OPEN door | |
| πͺ Door State Before: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.open_cover | |
| target: | |
| entity_id: !input garage_door_entity | |
| # Handle CLOSE action for Schedule 1 (when door is open) | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule1_action == 'close' }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| then: | |
| - delay: "{{ schedule1_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| - condition: template | |
| value_template: > | |
| {% if schedule1_start_time < schedule1_end_time %} | |
| {{ current_time >= schedule1_start_time and current_time <= schedule1_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule1_start_time or current_time <= schedule1_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 1 close action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 1 Closing Door" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π Schedule 1 Executing | |
| βοΈ Action: CLOSE door | |
| πͺ Door State Before: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.close_cover | |
| target: | |
| entity_id: !input garage_door_entity | |
| # Check Schedule 2 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule2_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% set schedule2_days = schedule2_days if schedule2_days is defined else [] %} | |
| {{ current_day in schedule2_days }} | |
| - condition: template | |
| value_template: > | |
| {% if schedule2_start_time < schedule2_end_time %} | |
| {{ current_time >= schedule2_start_time and current_time <= schedule2_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule2_start_time or current_time <= schedule2_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 2 check | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 2 Active" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Check Time: {{ action_time }} | |
| π Schedule 2 Active | |
| βοΈ Action: {{ schedule2_action }} | |
| β±οΈ Delay: {{ schedule2_delay }} | |
| πͺ Door State: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Handle OPEN action for Schedule 2 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule2_action == 'open' }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| then: | |
| - delay: "{{ schedule2_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| - condition: template | |
| value_template: > | |
| {% if schedule2_start_time < schedule2_end_time %} | |
| {{ current_time >= schedule2_start_time and current_time <= schedule2_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule2_start_time or current_time <= schedule2_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 2 open action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 2 Opening Door" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π Schedule 2 Executing | |
| βοΈ Action: OPEN door | |
| πͺ Door State Before: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.open_cover | |
| target: | |
| entity_id: !input garage_door_entity | |
| # Handle CLOSE action for Schedule 2 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule2_action == 'close' }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| then: | |
| - delay: "{{ schedule2_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| - condition: template | |
| value_template: > | |
| {% if schedule2_start_time < schedule2_end_time %} | |
| {{ current_time >= schedule2_start_time and current_time <= schedule2_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule2_start_time or current_time <= schedule2_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 2 close action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 2 Closing Door" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π Schedule 2 Executing | |
| βοΈ Action: CLOSE door | |
| πͺ Door State Before: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.close_cover | |
| target: | |
| entity_id: !input garage_door_entity | |
| # Check Schedule 3 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule3_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% set schedule3_days = schedule3_days if schedule3_days is defined else [] %} | |
| {{ current_day in schedule3_days }} | |
| - condition: template | |
| value_template: > | |
| {% if schedule3_start_time < schedule3_end_time %} | |
| {{ current_time >= schedule3_start_time and current_time <= schedule3_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule3_start_time or current_time <= schedule3_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 3 check | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 3 Active" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Check Time: {{ action_time }} | |
| π Schedule 3 Active | |
| βοΈ Action: {{ schedule3_action }} | |
| β±οΈ Delay: {{ schedule3_delay }} | |
| πͺ Door State: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| # Handle OPEN action for Schedule 3 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule3_action == 'open' }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| then: | |
| - delay: "{{ schedule3_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'closed' }}" | |
| - condition: template | |
| value_template: > | |
| {% if schedule3_start_time < schedule3_end_time %} | |
| {{ current_time >= schedule3_start_time and current_time <= schedule3_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule3_start_time or current_time <= schedule3_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 3 open action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 3 Opening Door" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π Schedule 3 Executing | |
| βοΈ Action: OPEN door | |
| πͺ Door State Before: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.open_cover | |
| target: | |
| entity_id: !input garage_door_entity | |
| # Handle CLOSE action for Schedule 3 | |
| - if: | |
| - condition: template | |
| value_template: "{{ schedule3_action == 'close' }}" | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| then: | |
| - delay: "{{ schedule3_delay }}" | |
| - if: | |
| - condition: template | |
| value_template: "{{ states(garage_door_entity) == 'open' }}" | |
| - condition: template | |
| value_template: > | |
| {% if schedule3_start_time < schedule3_end_time %} | |
| {{ current_time >= schedule3_start_time and current_time <= schedule3_end_time }} | |
| {% else %} | |
| {{ current_time >= schedule3_start_time or current_time <= schedule3_end_time }} | |
| {% endif %} | |
| then: | |
| # Debug notification for Schedule 3 close action | |
| - if: | |
| - condition: template | |
| value_template: "{{ debug_enabled }}" | |
| - condition: template | |
| value_template: > | |
| {% if 'all' in debug_trigger_types %} | |
| true | |
| {% else %} | |
| {{ 'schedules' in debug_trigger_types }} | |
| {% endif %} | |
| then: | |
| - variables: | |
| action_time: "{{ now().strftime('%H:%M:%S.%f')[:-3] }}" | |
| - service: persistent_notification.create | |
| data: | |
| title: "π {{ automation_friendly_name }} - Schedule 3 Closing Door" | |
| message: | | |
| β‘ Trigger: {{ trigger_time }} | |
| π Action Time: {{ action_time }} | |
| π Schedule 3 Executing | |
| βοΈ Action: CLOSE door | |
| πͺ Door State Before: {{ states(garage_door_entity) }} | |
| notification_id: "{{ debug_notification_id }}_{{ now().strftime('%Y%m%d_%H%M%S%f')[:-3] }}" | |
| - service: cover.close_cover | |
| target: | |
| entity_id: !input garage_door_entity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment