To be honest that does not make any sense to me as sunset and sunrise are celestial timings. For instance there are locations on earth where the sun sets and rises in the same 24hrs. To combine the two time systems is confusing. But ok if that is the way it is my automation is not going to work
I’ll see if I can move the creators to changing that
See the documentation for time conditions here and the documentation for sunrise/sunset conditions here
it’s fairly well explained.
also please post any code you provide properly formatted by adding three backticks (```) on the line before and after the code block. It makes it possible to see syntax errors.
Kia Ora to you my fellow homie half way across the globe.
Nope it shouldn’t and it wasn’t I changed it after pasting it here to preserve a bit of privacy. Well spotted though Thanks.
The issue is indeed the sunrise sunset bit. In my humble opinion the period between sunset and sunrise is one period and therefor should not be interrupted by a clock moving from 23:59:59 to 00:00:00. conversely the period between sunrise and sunset is also one period which is uninterrupted. The key word being “sun”. I’ll will have to learn to live with the way the creators of HA set it up or convince them of changing it LOL.
Another thing that I miss in conditional automations is for examples the terms “if then than that” but maybe that will come at some point in time, either after sunrise or before sunset
But don’t get me wrong i’m absolutely not dissing HA I fricken love and truely think it’s Sweet As
TBH, I’m not sure how it could be any other way and still make sense.
the problem is that each condition has to be evaluated as a self contained unit.
so let’s say I have the conditions as you have them above:
- condition: time
after: '21:30'
- condition: sun
before: sunrise
taken together it makes sense to interpret them the way you expect.
but taking them individually they make less sense to interpret them that way.
If you just look at:
- condition: time
after: '21:30'
it would mean “after 2130”. Is that 2130 today? tomorrow? next year? yesterday? it would always be after 2130 because there’s no boundary to either end.
the same for “before sunrise”. Which one? today? yesterday? tomorrow?
both of those situations are resolved by assuming that you mean “today”. Which the developers decided would be delimited by midnight.
if you put both a “before” and “after” in the same condition you won’t have that non-limitation issue. and even then the standard is to wrap those conditions around a reference of midnight.
when using time as a condition it would be within the day. So indeed when I say 21:30 it is the first 21:30 it meets and then it is true. That time is taken over 24hours makes all the sense.
But when you consider sunrise and sunset the premis becomes different because a day starts at sunrise and ends at sunset. The night starts at sunset and ends at sunrise. This is a celestial timing and has nothing to do with hour human 24hour clock. Had we had a day with 27 and half hours sunrise and sunset would stil determine one day and one night. Iow on cyclye.
Maybe it’s not possible to define it that way backended, that I don’t know but. It is as you mentioned “delimited” by the clock.
Of course if I say I want it to work after 21:30 and before 07:00 than it will work. And I could adjust the 07:00 everyday to match the sunrise.
Let me ask you this then; I would like the automation to work between 21:30 until the next sunrise how would you set that up?
I say it is a period of time of 24 hours (this Day, the next Day, A Day next month).
I don’t say “a day and night” tomorrow.
they just chose the midnight moment to reference it because that is when the date changes (it’s a new “Day”) and makes the most sense since it never changes.
If they used sunrise then it would change every Day as in your current situation.
there is another option that hasn’t been discussed but might be more closely to what you are thinking.
you can use “below_horizon” and “above_horizon” as the sun state condition and will likely give you what you describe. IOW, “is it above or below the horizon (‘day’ or ‘night’) right now?”
But it still won’t solve the time requirement (after 2130) so you will still need the ‘or’ for those two conditions to work correctly.
Ok, Tried this one but it fails as it automation takes the current time. I suspect it will work after midnight although then the after 21:30 and before 12:00 will the issue for the next day. LOL
The whole motion automation triggers one light on, then after few seconds another light and after a few more seconds even more lights. After the motion is cleared plus an X amount of minutes all lights should turn off.
when I’m home it should only do that between 21:30 and sunrise the following day. When I am not home it should turn off between after sunset and before sunrise.
as we were talking about days and midnight I used the offset function and added 24 hrs to force next day. that worked but then i’m not sure what that will do after midnight
For shits and grins I tried saying between sunset and sunrise not before 21:30 that hasnt worked yet but might be because of the automation being fired at the wrong time in the sequence.