Hello HA Gurus,
I am seeking for help. Maybe it is very simple but I am not able to find some working solution. I have automation for Night PIR lights which I would like to set conditions:
before midnight
it should trigger only after 23:00:00, while sensor.period_of_day_newest is also Night
after midnight
it should trigger only when sensor.period_of_day_newest is Night
Time condition is valid only until midnight but also during that time sensor.period_of_day_newest is Night so they are overlapping before midnight.
- condition: and
conditions:
- condition: time
after: "23:00:00"
- condition: state
entity_id: sensor.period_of_day_newest
state: night
Is there any way to combine time and state condition? I have sensor.period_of_day_newest which is calculating period of the day based on sun elevation.
Maybe it’s just in my head, but 23:00 is usually night, The state “night” doesn’t make sense in this combination.
“time” goes from 00:00:00:00:01 ( or something like that ) to > 23.59.59 … , then it’s sort off start over ( new day ) so from 00:00:01-something until ( time of first condition ) nothing will happens
Ok, So this is whole automation.
So I want this automation to be working after 23:00:00 passing midnight but not before some fixed time (like 05:00:00) but till period_of_day_newest is Night or Dawn.
But I think before: “05:00:00” is anyway required there or let`sa say 07:00:00 which does not matter as sensor.period_of_day_newest will switch to Dawn or Day much earlier so it will be TRUE. So this is solution but I wondered if this can be done without “Before” condition.