From 4bd1eeca0006b7af15a6a5b4f8b1800a83ec0b3e Mon Sep 17 00:00:00 2001 From: "J.P. Krauss" Date: Sat, 9 Nov 2024 07:56:42 -0800 Subject: [PATCH] feat: Force holiday light turn-on outside of Christmas Season --- packages/holiday/holiday.yaml | 32 ++++++++++++++++++++++++++++---- packages/security/security.yaml | 12 ++++++------ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/packages/holiday/holiday.yaml b/packages/holiday/holiday.yaml index 1ea1fb9..2a06815 100644 --- a/packages/holiday/holiday.yaml +++ b/packages/holiday/holiday.yaml @@ -1,5 +1,13 @@ # Holiday Package +# ----------------------------------------------------------------------------- +# Holiday State Helpers +input_boolean: + holiday_override_lights_night: + name: Always Turn On Holiday Lights at Night + holiday_override_lights_morning: + name: Always Turn On Holiday Lights in the Morning + # ----------------------------------------------------------------------------- # Holiday Sensors template: @@ -41,7 +49,11 @@ automation: - platform: sun event: sunset condition: - - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - alias: Christmas Season or Light Override Enabled + condition: or + conditions: + - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - "{{ is_state('input_boolean.holiday_override_lights_night', 'on') }}" action: - service: switch.turn_on target: @@ -55,7 +67,11 @@ automation: - platform: sun event: sunset condition: - - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - alias: Christmas Season or Light Override Enabled + condition: or + conditions: + - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - "{{ is_state('input_boolean.holiday_override_lights_night', 'on') }}" action: - service: light.turn_on data: @@ -70,7 +86,11 @@ automation: - platform: time at: '04:30:00' condition: - - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - alias: Christmas Season or Light Override Enabled + condition: or + conditions: + - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - "{{ is_state('input_boolean.holiday_override_lights_morning', 'on') }}" action: - service: switch.turn_on target: @@ -84,7 +104,11 @@ automation: - platform: time at: '04:30:00' condition: - - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - alias: Christmas Season or Light Override Enabled + condition: or + conditions: + - "{{ is_state('binary_sensor.is_christmas_season', 'on') }}" + - "{{ is_state('input_boolean.holiday_override_lights_morning', 'on') }}" action: - service: light.turn_on data: diff --git a/packages/security/security.yaml b/packages/security/security.yaml index 530318f..1d26748 100644 --- a/packages/security/security.yaml +++ b/packages/security/security.yaml @@ -680,7 +680,7 @@ automation: - alias: Process callback choose: - - conditions: "{{ wait.remaining > 0 and wait.trigger.event.data.action == action_ignore }}" + - conditions: "{{ wait.remaining > 0 and 'event' in wait.trigger and wait.trigger.event.data.action == action_ignore }}" sequence: - alias: Notify that the event was ignored action: notify.security @@ -692,14 +692,14 @@ automation: |first|default({'attributes':{'friendly_name':'Automation'}}) %}Open garage door ignored by {{ person.attributes.friendly_name }} - - conditions: "{{ wait.remaining > 0 and wait.trigger.event.data.action == action_close }}" + - conditions: "{{ wait.remaining > 0 and 'event' in wait.trigger and wait.trigger.event.data.action == action_close }}" sequence: - alias: Close garage door action: switch.turn_on target: entity_id: switch.garage_door_relay_1 - - conditions: "{{ wait.remaining > 0 and wait.trigger.entity_id == 'alarm_control_panel.ha_alarm' }}" + - conditions: "{{ wait.remaining > 0 and 'entity_id' in wait.trigger and wait.trigger.entity_id == 'alarm_control_panel.ha_alarm' }}" sequence: - alias: Notify the event was cancelled action: notify.security @@ -771,7 +771,7 @@ automation: - alias: Process callback choose: - - conditions: "{{ wait.remaining > 0 and wait.trigger.event.data.action == action_ignore }}" + - conditions: "{{ wait.remaining > 0 and 'event' in wait.trigger and wait.trigger.event.data.action == action_ignore }}" sequence: - alias: Notify that the event was ignored action: notify.security @@ -783,14 +783,14 @@ automation: |first|default({'attributes':{'friendly_name':'Automation'}}) %}Unlocked front door ignored by {{ person.attributes.friendly_name }} - - conditions: "{{ wait.remaining > 0 and wait.trigger.event.data.action == action_lock }}" + - conditions: "{{ wait.remaining > 0 and 'event' in wait.trigger and wait.trigger.event.data.action == action_lock }}" sequence: - alias: Lock front door action: lock.lock target: entity_id: lock.front_door_lock_doorlock - - conditions: "{{ wait.remaining > 0 and wait.trigger.entity_id == 'alarm_control_panel.ha_alarm' }}" + - conditions: "{{ wait.remaining > 0 and 'entity_id' in wait.trigger and wait.trigger.entity_id == 'alarm_control_panel.ha_alarm' }}" sequence: - alias: Notify the event was cancelled action: notify.security