Skip to content

Instantly share code, notes, and snippets.

@Ltek
Last active December 30, 2025 01:12
Show Gist options
  • Select an option

  • Save Ltek/f58bbbde02471437ef863c334572a320 to your computer and use it in GitHub Desktop.

Select an option

Save Ltek/f58bbbde02471437ef863c334572a320 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint : Smart Garage - Door, Lighting, and Alerts by LTek
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 2025.12.28.14d
Author: LTek
📖 Community Discussion, Help, and Details... https://community.home-assistant.io/
source_url: https://gist.github.com/Ltek/
Important Note: this made to work with garage doors that report as Covers entities.
**FEATURES**
- Separate notification settings for each garage door state (open, opening, closed, closing, stopped)
- Auto-close default timer (non-scheduled)
- Three customizable door schedules (open or close at specific times)
- Bypass schedule for open notifications
- Repeat notifications with configurable limits
- Rich notification customization per state
- Custom actions for each trigger
- Lighting control based on garage door states and other triggers
- Alert notifications for door opening/opening during specific schedules
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 garage door 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 (only if schedule condition is enabled)
default: "22:00:00"
selector:
time: {}
alert_end_time:
name: 🔴 End Time
description: End time for alert schedule (only if schedule condition is enabled)
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
default: "22:00:00"
selector:
time: {}
open_bypass_end_time:
name: 🔴 Bypass End Time
default: "07: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 Control"
description: |
Control lights based on garage door states and other entities.
Use cases like... Garage door opens; Door from your house to the garage opens
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 (lock, door sensor, switch, cover/door)
default: []
selector:
entity:
domain:
- binary_sensor
- switch
- lock
- cover
multiple: true
lighting_on_for_opening:
name: 🔼 Turn On when Opening
description: Turn lights on when door starts opening
default: false
selector:
boolean: {}
lighting_on_for_open:
name: 🔵 Turn On when 100% Open
description: Turn lights on when door is open
default: true
selector:
boolean: {}
lighting_on_for_closing:
name: 🔽 Turn On when Closing
description: Turn lights on when door starts closing
default: false
selector:
boolean: {}
lighting_on_for_closed:
name: ⛔ Turn Off when 100% Closed
description: Turn lights off when door is closed
default: true
selector:
boolean: {}
lighting_on_for_stopped:
name: ⚠️ Turn On when Stopped mid-cycle
description: Turn lights on when door stops mid-cycle
default: false
selector:
boolean: {}
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: Start time for disabling lighting control
default: "22:00:00"
selector:
time: {}
lighting_schedule_end_time:
name: 🕒 Disabled End Time
description: End time for disabling lighting control
default: "06: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. Set start time to 00:00 and end time to 23:59 for 24-hour coverage on selected days."
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
default: "00:00:00"
selector:
time: {}
schedule1_end_time:
name: 🔴 End Time
default: "23:59:59"
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. Set start time to 00:00 and end time to 23:59 for 24-hour coverage on selected days."
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
default: "00:00:00"
selector:
time: {}
schedule2_end_time:
name: 🔴 End Time
default: "23:59:59"
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. Set start time to 00:00 and end time to 23:59 for 24-hour coverage on selected days."
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
default: "00:00:00"
selector:
time: {}
schedule3_end_time:
name: 🔴 End Time
default: "23:59:59"
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
mode: restart
max_exceeded: silent
trigger_variables:
# GARAGE DOOR ENTITY (STANDALONE)
garage_door_entity: !input garage_door_entity
variables:
# 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
light_on_for_opening: !input lighting_on_for_opening
light_on_for_open: !input lighting_on_for_open
light_on_for_closing: !input lighting_on_for_closing
light_on_for_closed: !input lighting_on_for_closed
light_on_for_stopped: !input lighting_on_for_stopped
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 - CORRECT approach
- trigger: template
value_template: >
{{ states(garage_door_entity) not in ['open', 'opening', 'closed', 'closing'] }}
for: !input stopped_duration_before_alert
id: trigger_stopped
# Other triggers
- trigger: state
entity_id: !input lighting_trigger_entity
id: trigger_lighting_entities
- trigger: state
entity_id: !input lighting_entities
id: trigger_lights_changed
- trigger: time_pattern
hours: "/1"
minutes: "0"
seconds: "0"
id: check_door_schedules
action:
- choose:
# Handle OPEN trigger
- conditions:
- condition: trigger
id: trigger_open
sequence:
# 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:
# 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:
# 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: "{{ light_on_for_open }}"
- 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:
# 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 }}"
# Start off timer if configured
- if:
- condition: template
value_template: >
{% set timer = light_off_timer if light_off_timer is defined else {} %}
{% set total_seconds = timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 %}
{{ total_seconds > 0 }}
then:
# Wait for the specified delay, then turn lights off
- delay: "{{ light_off_timer }}"
- 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 Auto-Close Default
- if:
- condition: template
value_template: "{{ autoclose_default_enabled }}"
- condition: template
value_template: "{{ states(garage_door_entity) == 'open' }}"
then:
- delay: "{{ autoclose_default_delay }}"
- if:
- condition: template
value_template: "{{ states(garage_door_entity) == 'open' }}"
then:
- service: cover.close_cover
target:
entity_id: !input garage_door_entity
# Handle OPENING trigger
- conditions:
- condition: trigger
id: trigger_opening
sequence:
- 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:
# 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:
# 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: "{{ light_on_for_opening }}"
- 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:
- 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 }}"
# Start off timer if configured
- if:
- condition: template
value_template: >
{% set timer = light_off_timer if light_off_timer is defined else {} %}
{% set total_seconds = timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 %}
{{ total_seconds > 0 }}
then:
# Wait for the specified delay, then turn lights off
- delay: "{{ light_off_timer }}"
- 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 CLOSED trigger
- conditions:
- condition: trigger
id: trigger_closed
sequence:
- 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:
# 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: "{{ light_on_for_closed }}"
- 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:
# 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:
- 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:
# 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: "{{ light_on_for_closing }}"
- 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:
- 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 }}"
# Start off timer if configured
- if:
- condition: template
value_template: >
{% set timer = light_off_timer if light_off_timer is defined else {} %}
{% set total_seconds = timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 %}
{{ total_seconds > 0 }}
then:
# Wait for the specified delay, then turn lights off
- delay: "{{ light_off_timer }}"
- 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 STOPPED trigger
- conditions:
- condition: trigger
id: trigger_stopped
sequence:
- 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:
# 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: "{{ light_on_for_stopped }}"
- 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:
- 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 }}"
# Start off timer if configured
- if:
- condition: template
value_template: >
{% set timer = light_off_timer if light_off_timer is defined else {} %}
{% set total_seconds = timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 %}
{{ total_seconds > 0 }}
then:
# Wait for the specified delay, then turn lights off
- delay: "{{ light_off_timer }}"
- 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 LIGHTING trigger entities
- conditions:
- condition: trigger
id: trigger_lighting_entities
sequence:
# 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:
# 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 }}"
# Start off timer if configured
- if:
- condition: template
value_template: >
{% set timer = light_off_timer if light_off_timer is defined else {} %}
{% set total_seconds = timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 %}
{{ total_seconds > 0 }}
then:
# Wait for the specified delay, then turn lights off
- delay: "{{ light_off_timer }}"
- 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 LIGHTS CHANGED trigger (when lights themselves are changed and not turned off)
- conditions:
- condition: trigger
id: trigger_lights_changed
sequence:
# 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 conditions are met
- if:
- condition: template
value_template: "{{ enable_lighting_control }}"
- condition: template
value_template: >
{% set timer = light_off_timer if light_off_timer is defined else {} %}
{% set total_seconds = timer.hours|default(0) * 3600 + timer.minutes|default(0) * 60 + timer.seconds|default(0) + timer.days|default(0) * 86400 %}
{{ total_seconds > 0 }}
- condition: template
value_template: "{{ trigger_state != 'off' }}"
- 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:
# Wait for the specified delay, then turn the light off
- delay: "{{ light_off_timer }}"
# Turn off the specific light that was changed (if it's still on)
- if:
- condition: template
value_template: "{{ states(changed_light) != 'off' }}"
then:
- service: light.turn_off
target:
entity_id: "{{ changed_light }}"
# 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:
- 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:
# 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:
- 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:
- 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:
# 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:
- 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:
- 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:
# 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:
- 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:
- 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