This is a piston I use to achieve a check against electric company holidays. (And weekends)
We have tiered electric where 12-7 m-f is significantly more expensive, outside of that and any listed holiday are cheap.
Since It is cheaper, on weekdays I have my ACs blow full cold at a variable time based on days high temp forecast on weekday non holidays in advance of noon. Basically only on high price days, it does precool
So I wrote this piston with a variable and a virtual switch to turn on only on days not to precool.
I use both, but specifically use the switch with some outside automations so it is easier to tie in that way.
The piston also watches if I manually change the switch (rare occasion) to match the variable’s condition to the switch, and if the local variable changes, it updates the global variable too. I have a local and global set differently because I’m adding another (semi related) layer to Automation later that I don’t want following the global variable, but that’s another story.
Lastly once annually it sends me reminders to update upcoming year’s holiday calendar
Again this piston is only for weekend and holiday tracking, I have other pistons that monitor the virtual switch
All I did was make a list of the holidays for the year, and once a year I have to update them. That’s it.
Then it does its thing the other 364 days per year