Hi,
Is the reason for wanting to shift the timing because of the shorter days in winter & the amount of light around?
I do some similar adjustments to when some automations are triggered, mainly around when lights might come one, based on lux from my outdoor weather station or indoor lux sensors.
Maybe that is something to consider, if you didn’t already.
Cheers
Nick
Yeah I thought about indoor lux readings from various motion sensors and such. I just haven’t taken the time to gather the data needed to do that, but that seems like a viable option.
I’ll consider that option and I’ll need to start tracking the data based on the lux values of things.
Hmm, darn, the motion sensors I use don’t share light level data. Doing some research into how to do this, with say, an ESP8266 and photo resister or something. Maybe that’s too complicated but I could measure different parts of a room with 2 or 3 sensors wired to the ESP.
My sensors are zigbee & many of the door/window sensors also have lux builtin. I also have a dedicated lux sensor in each room to use for this exact purpose. I’m very happy with my Xiaomi sensors, if you are looking to buy something.
How about using the sun’s azimuth, which is an attribute on sun.sun. That would be the same-ish time of the day, independent of daylight savings. I use this to close a blind for the period while the sun shines in on my laptop.
If you are in the Pacific Time Zone, it will return either PST or PDT. Try it out in the template editor in the developer tools.
But I’m not clear on what you’re trying to do. Do you want your automations to shift an hour during daylight savings to essentially negate the clock change? If so, you could just set your automations to happen at some offset from UTC, which isn’t impacted by any DST changes. A template trigger like the following would trigger after 10pm (22:00) PST during PST and after 9pm PDT during PDT:
Where I live elevation varies too much between summer and winter, so using azimuth like a sundial works better. Depends on what you’re trying to achieve I guess.
Yeah, for blinds azimuth matters, but for light levels elevation usually matters more - unless you live in the shadow of mountains where a combo is needed.
I like this idea and will give it a try tonight. I’m trying to decide how the “template trigger” works though. When I test this in the developer tools, and pick a time a minute ahead, I see that when the time hits it changes from false to true but stays in that state.
Does a “template trigger” only fire when it a change in it’s state occurs?
Because your use of >= leaves the test true even after the time has passed.
I tried it with == and never saw it flip between false to true.
Yes, the transition from false to true is what causes the trigger. Same for state and numeric_state triggers; they all trigger on the transition. It doesn’t matter how long the trigger remains satisfied. This is also the reason that creating a new automation with a trigger that is already satisfied will not cause the automation to run.
As to your other question: now() is accurate to milliseconds, and when you use it in templates, the templates will only get refreshed once per minute. So when you use == it is essentially impossible for that comparison to ever be true.
OK, working on this. One more question though. I’ve got another automation that’s based on the sun object that I’d also like to offset by an hour based on DST.
trigger:
- platform: sun
event: sunset
offset: "-01:15:00"
Can you help me with a template to offset that by either “-01:!5” or just “-00:15” based on the ```
tm_isdst() value ?