Gauge for Length of Day (showing Solstices & Equinoxes)


#24

Well, the summer solstice is close to the middle in the 3rd gauge since the winter solstice happens 10 days before the year is up…

So, I have to ask. Will you be using the gauge or simply text in the piston states?
(the code is substantially easier if you drop the gauge entirely)


#26

OK. I will be glad to help with the math, but I have a homework assignment for you first:

You need to find the longest and shortest days for your location (down to the seconds for accuracy). I put in my city at www.timeanddate.com/sun/ and then examined the “Daylength” in late June and then in late December to find the extremes.

For added accuracy, I recommend comparing a few years. I will need to know the longest DayLength in June, and the shortest DayLength in December. (I will base my math on the numbers you give me)


#27

@Alwas I sent your math in a PM to keep your personal information private


#28

Happy Summer Solstice everyone!

Here is how my 3 gauges changed in the past 24 hours:

Nice transition of colors as the first two gauges will now spend the next 6 months moving towards the left. (the 3rd gauge is continuing on moving to the right)

In the first gauge, Blue represents the coldest 3 months, Yellow is the hottest 3 months, and Green/Brown is the middle 3 months.

In the 2nd & 3rd gauge, Blue/White represents Winter, Green is Spring, Yellow/Orange is Summer, and Brown is Fall… (still tweaking my colors a bit)


#30

Stonehenge is definitely on my bucket-list…

In my last house, I placed decorative stones in various places around my backyard. The shadow from my flagpole acted like a solar calendar as it moved around throughout the year. It amazed me at just how precise it was…

I was originally inspired from Indiana Jones - Raiders of the Lost Ark, LOL

(Although I never put a crystal on the flagpole…)

Great 4 minute video here if you want to refresh your memory…


#31

If my math looks confusing, perhaps seeing a different example will help it to make sense:


#33

Have you noticed that the amount of sunlight visible X minutes before sunset seems quite different at various times throughout the year? For example, Sunset-20 seems much darker in the summer than in the winter.

I have come up with a math formula to automatically compensate for this. It ends up being a very simple formula, but does require the data stored in the @@dayLengthPercent variable above for it to work.

In the following example, at the summer solstice, the piston would trigger 60 minutes before sunset, and gradually shift over the next 6 months. By the time the winter solstice arrives, the piston would be firing 20 minutes before sunset. It would then spend the next 6 months slowly moving back in the other direction.
(the step-by-step guide below is so you can use numbers that work for you)

  • First, you have to decide how many minutes before sunset you want your piston to trigger at the two solstices. (I am using 60 for the longestDayOffset, and 20 for the shortestDayOffset)
  • Next, we subtract one from the other to find the difference. (60 - 20 = 40)
  • Finally, we take 100 divided by the difference to find our multiplier. (100 / 40 = 2.5)

The formula for webCoRE would be:
round(-((@@dayLengthPercent / multiplier) + shortestDayOffset),0)

Or, using our example above, you can define a variable in the top section like this:
define integer sunsetOffset = round(-((@@dayLengthPercent / 2.5) + 20),0)
(Don’t forget to replace 2.5 and 20 with YOUR numbers)

and make the first line of code something like this:
Time happens daily at {sunsetOffset} minutes past {$sunset}

This piston idea works great for things like closing blinds, turning on evening lights, or anything else revolving around the time of sunset… I have been using this code for a couple months, and it works like a champ! (every couple of days, the offset shifts another minute)

SIDE NOTE:
This formula was designed to work with any two integers (whole numbers)…
The only restriction is the longestDayOffset (Summer) has to be greater than the shortestDayOffset (Winter).


#34

Hi, WC. I enjoyed reading your post and piston for a gauge for length of day. Nice work.

As a newbie at webCoRE (starting today), how do I actually see the gauge?


#35

Hey thanks. I appreciate that. It sure was a lot of fun to build.

From the Dashboard, you can click on:
Settings > Categories > Add Category
Then give it a name, and make sure the second column says “Tiles” of some kind. Click Apply, and you are done.

Then any piston you want to display a tile and/or gauge, you just have to add the line of code, and remember to save that piston to that “Tile” Category you created.
2


#36

This is great! I’ve been bugged for years by the difference in darkness at 20 min before sunset between Summer and Winter solstice. Unfortunately, the basic tools I’ve been using (UpStart for UPB switches and SmartThings for Z-Wave switches) both provide a fixed positive or negative offset from Sunset and Sunrise all year long. Now I can begin moving Z-Wave control for lights on at sunset to a Piston. Thanks for thinking of this.


#37

Well, we are quickly approaching the last day of summer…
It seems appropriate to show the current data on my gauges:

temp

Reminder:

  • The first two gauges are moving towards the left (0) and are based on sunlight
  • The last gauge is moving towards the right (365) and is based on day of the year

#38

Two days left of summer! My background changed to “brown” as an early alert.

temp

The other two gauges will change background as it gets even closer.
(since the first two gauges are more precise)


#39

Last full day of summer is here:

temp

(I am still tweaking my colors a bit. It’s not so easy because certain elements only appear once a year, LOL)


#40

Beautiful transition for the Equinox.

temp

The ‘point 2’ after the 50 is because webCoRE rounds to the nearest minute for sunrise & sunset. Once webCoRE returns the actual seconds, my gauge will become even more accurate and display 50.0 at the equinoxes.


#41

Just an update for those curious…

You won’t hear this mentioned anywhere else, but today begins the darkest 3 months of the entire year…
(for those of us in the northern hemisphere)

We are currently halfway thru fall, but surprisingly, the day length has already dropped to only 15% above the absolute minimum.

temp

I have to admit, I never realized the rate of daylight increase/decrease changed so much throughout the year until I let webCoRE monitor this for awhile…


#42

15.7% here in TX right now.

I’m from the UK and I remember the very short winter days (dark on the way to work and on the way home, even at 4pm) and very long summer days (not dark until 10:00pm or later if the weather is good). It was an adjustment living much nearer to the Equator. Our day lengths don’t swing anywhere near as much here in TX.


#43

Just curious, was that 15.7% from earlier today? (once a day piston?)

I would have thought that no matter our location, our numbers would be dead on a match. Although, maybe it only matches on the actual day of the equinox and solstice… Or maybe it is the 0.4% difference because webCoRE only records sunrise and sunset rounded to the nearest minute.


#44

That’s what it’s showing right now. My piston executes at 15s after midnight.


#45

Same as mine, since the sunset and sunrise only changes once a day…

I wonder which of my other two guesses is the reason we don’t match exactly. (I am 15.3%)
I guess it could also be a slight difference in our math…


#46

Yes because I agree, our %ages should be the same.

It’s quite possible that the source data we are using is off slightly too.