Is there a possibility to get the information if it is daylight saving time or not?
If you mean using Lua, the answer is yes. The following code will set dst true or false:
local now = os.date("*t")
local dst = now.isdst
So dst can either be true or false, right? (CET or CEST)
Do you have an idea to use this state as an input in PLEG?
As far as I know there is no way to use Lua directly in PLEG.
Richard added the ability to use Lua in his latest PLEG updates
LUA is supported only in Actions … And can not contribute to inputs.
If you want this then use it to drive a Virtual Switch that indicates DST and set it in your Vera Startup LUA
As DST usually changes at either 01:00 or 02:00, I would create a scene to run every day at 02:01 to set an appropriate flag. This could be a VirtualSwitch, a MultiSwitch button or an added variable on some device. If you use the last option, you could use a PLEG Device Property to refer to it.
For example, this will add the variable DST to device 23 (which happens to be RTS’s DayTime plugin on my system):
local now = os.date("*t")
local dst = "0"
if now.isdst then dst = "1" end
local olddst = luup.variable_get("urn:your-name-com:serviceId:Variables","DST",23)
if olddst ~= dst then
luup.variable_set("urn:your-name-com:serviceId:Variables","DST",dst,23)
end
I am curious about what scenario would need to know about DST ?
I know people have fixed schedules.
And I understand schedules relative to sunrise/sunset.
Thank you.
It is my indicator for summer time. In winter I want to close my shades earlier and I think this is a good way doing it.
I guess I could also use the date for doing so. Time will show wether it was a good idea or not.
Why is it not relative sunrise/sunset ?
Or some like a combination of Sunrise or 7:00 AM which ever is later ?
Well in summer time (DST) the sun is more strong in the evening. Therefore it makes sense to leave shades opened for a longer time.
Only because DST redefines “evening”!
But seriously, if you’ve got actions that you want to react to the amount of daylight you do or don’t have, you should be using one of Vera’s astronomical plugins, Day Or Night being one of them. If you are at high latitudes and need to handle the longer twilight hours you get in the summer then you could use the Heliotrope plugin and react to the sun’s altitude reported by the plugin.
Edit: Psychologically speaking, DST does have an effect on people’s routines more than it deserves to. If that’s the effect that the OP is looking for, then probably nothing else will substitute for it. Come to think of it, a similar thing happens with Easter where I live: before Easter, people are still in Summer Mode. After Easter, people are in Winter Mode. No matter whether it’s an early or late Easter. Perhaps we need an Easter plugin…
That sounds interesting. Didn’t know this was possible.
DST was just an idea but the more I think about it, you are right.
Just brainstroming here about the Heliotrope plugin:
Actually at sunset the height is always at 0?, so this wont change from the Day or Night Plugin. What changes is the height the sun reaches during the day and the azimuth at a specific time.
So either one of them could indicate “summer”. The reached height is probably the easiest. Which value makes sense has to be investigated, though. Any ideas or experience?
Thanks for the input!
If you want to capture the season, the Heliotrope plugin has two more variables which don’t display on the dashboard but are on the first tab: Right Ascension and Declination. I’ve talked about those in other posts and they are better explained on Wikipedia, so I will let you search for them. You might find them more appropriate than a date test depending on what you want to do.
The useful thing about testing the sun’s altitude is that it corresponds well with how bright twilight is. -6 degrees is about the point at which you need outside lighting. -12 is about the point it’s too dark to see the horizon. If you live near enough to the Arctic circle then twilight can last for hours because the sun is only a little below the southwest horizon. Heliotrope captures this effect, whereas sunset + a constant duration does not.
To get back on topic, decide if your scene cares about the amount of daylight outside, or on civil time as dictated by your government. Both have their place, but should not be conflated.
Perfect, so I could check the sunrise/sunset (incl. twilight) and also decide to change the behaviour in summer depending on right Ascension:
For northern hemisphere?
right ascension: 0 to 6 is spring; 6 to 12 is summer; and so on
[quote=“futzle, post:13, topic:179914”]If you want to capture the season, the Heliotrope plugin has two more variables which don’t display on the dashboard but are on the first tab: Right Ascension and Declination. I’ve talked about those in other posts and they are better explained on Wikipedia, so I will let you search for them. You might find them more appropriate than a date test depending on what you want to do.
The useful thing about testing the sun’s altitude is that it corresponds well with how bright twilight is. -6 degrees is about the point at which you need outside lighting. -12 is about the point it’s too dark to see the horizon. If you live near enough to the Arctic circle then twilight can last for hours because the sun is only a little below the southwest horizon. Heliotrope captures this effect, whereas sunset + a constant duration does not.
To get back on topic, decide if your scene cares about the amount of daylight outside, or on civil time as dictated by your government. Both have their place, but should not be conflated.[/quote]
I have seen this app for a long time and always just passed it by.
I have been mulling over opening blinds when the sun hits its zenith. We have an east facing wall with a lot of window area which will allow too much sun in. This causes a lot of heat in the rooms and added A/C expense. So much so that before I tinted these windows, my A/C could not get to equilibrium.
Likewise, we have south facing windows that the sun doesn’t shine through during the summer months (we are in south florida)
Thanks @futzle for bringing us up to date on its very practical uses. Very cool app.
[quote=“dawiinci, post:14, topic:179914”]For northern hemisphere?
right ascension: 0 to 6 is spring; 6 to 12 is summer; and so on[/quote]
Almost. Heliotrope measures right ascension in degrees, not hours, so you have to multiply those numbers by 15.
0 is the March equinox.
(6 * 15 =) 90 is the June solstice.
-180 or +180 is the September equinox.
-90 or +270 is the December solstice.
I’ve named months rather than seasons there because months are the same the world over.
There are two variables: RightAscension has the range [-180, 180). RightAscension360 has the range [0, 360). The only difference is where the discontinuity is. So to match northern hemisphere summer, you’d test RightAscension >= 90. To match northern hemisphere winter, you’d test RightAscension360 >= 270. To match a two-month period straddling the March equinox, you’d test -30 < RightAscension < 30.