There are a few example pistons out there that calculate the seasons. I actually use two myself, one for the meteorological season and another for determining the astronomical season. If you need a little primer on the difference between the two, here are some good references:
Essentially, the weather folks base the seasons on temperature, whereas the astronomers base the seasons on our big blue marble’s trip around the Sun.
Yes, I’m aware of the probable issues with executing a piston at midnight. I set it up this way for illustrative purposes. Meteorological seasons change at midnight on the first day of the appropriate month, so that’s the most accurate, but obviously, you can set it to run at whatever time you’d like.
Not moving between hemispheres? Pick the Set variable where you live and drop the if statement.
I use this to set my thermostat’s mode. I want that to change based on what the season feels like and not the solstice:
I also use it to change which Plex playlist is called via a webhook rather than the playlist based on the solstice/equinox or month. YMMV
Some season detector pistons I’ve seen have a lot of if/then or case statements to sieve dates. This example simplifies it down to a single line.
I’ll be posting my astrological season piston separately. Cheers!