I was trying to create a single automation to turn an input_boolean on or off depending on time (on at 4pm and off at 8pm). I have two time triggers (4pm / 8pm) and a choose that uses time but I don’t seem to understand how the time choose conditions work.
In the below automation, the choose conditions are for (after) 3:59pm & (before) 4:01pm and the other condition is 7:59pm / 8:01pm.
At 4pm, the trigger fires but the result of the choose is “default”. I’m not sure why it is not choosing the 3:59/4:01pm condition.
Here’s the automation:
id: '1656530783891'
alias: Turn Peak Electricity Toggle On/Off
description: >-
Turns on Peak Electricity Period boolean
(input_boolean.peak_electricity_period) at 4pm and turns it off at 8pm
trigger:
- platform: time
at: '16:00:00'
- platform: time
at: '20:00:00'
condition: []
action:
- choose:
- conditions:
- condition: time
before: '16:01:00'
after: '15:59:00'
weekday: []
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.peak_electricity_period
- service: notify.alexa_media_everywhere
data:
data:
type: announce
message: Electricity Peak Pricing, Minimize Electrical Usage
- conditions:
- condition: time
before: '20:01:00'
after: '19:59:00'
weekday: []
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.peak_electricity_period
- service: notify.alexa_media_everywhere
data:
message: Electricity Off Peak Pricing, Resume Electrical Usage
data:
type: announce
default: []
mode: single
and here are the step details:
Trigger:
platform: time
at: '16:00:00'
Choose:
Executed: June 30, 2022 at 4:00:00 PM
Result:
choice: default
Of course, there is no “default” set, so it doesn’t actually do anything.
Originally, I just had a 4pm option and the default was the 8pm (turn off). I also tried just having a time of 4pm/4pm for one option and 8pm/8pm for the other, but that also didn’t work.
In the meantime, I’ve created two automations (one for on and one for off), but I’d prefer to have just one.
What am I not understanding about the time condition?
Thanks,
phlepper