I have an automation that decrements an input number (Dynamic Timer) that can be updated by Alexa (Actionable Notifications) and motion detectors. Currently there are five automation integrated to control the basement lights. (Automation is necessary because there are many lights on the same circuit, prior to HA automation, the traditional timers could leave you trapped in the darkness looking for the switch.) Automation(s): basement_lights_triggers.yaml turns on the lights and sets the timer. basement_lights_timer.yaml decrements the value by one every minute. And finally, basement_lights_timeout.yaml turns the lights off when the timer reaches zero. Alexa (Actionable Notifications) and movement detectors also dynamically increase or decrease the timer value as needed. As my post indicated, the time pattern used is firing every minute instead of the ten times daily. I will confess, when written, I thought that an ‘and’ condition was possible in the trigger. Does anyone have any suggestions / experience that could move the time pattern condition out of the trigger section of the automation?
alias: basement_lights_timer
id: basement_lights_timer
description: Basement Light Timer
trigger:
- platform: time_pattern
minutes: "*"
- platform: numeric_state
entity_id: input_number.timer_basement
above: 0
condition:
- condition: numeric_state
entity_id: input_number.timer_basement
above: 0
action:
- choose:
- conditions:
- condition: state
entity_id: switch.basement_lights
state: 'on'
sequence:
- service: input_number.decrement
entity_id: input_number.timer_basement
- choose:
- conditions:
- condition: state
entity_id: switch.basement_lights
state: 'off'
sequence:
- service: input_number.set_value
data:
value: 0
target:
entity_id: input_number.timer_basement
mode: single