I have a rule that reminds me that I should take out the trash bins every other week that works well, but the problem is a year like this (2020) when the year has 53 weeks (usually 52).
My garbage pick-up is every even week (week 2, 4, 6 etc.), and then the rule will be screwed up this year.
Of course there is no major issue to adjust the rule manually and in worst case it is only once per year.
However, I'm curious if it is possible to get the week number into Hubitat somehow?
There are some variable math functions, but I don't think there are any epoch conversion functions.
Could you use a local variable to count weeks, and when you get to 52, reset the week counter to whatever works for your logic? (perhaps just a skip the reminder, add one to the counter and carry on)...it would be a bit more complicated than that to catch the edge conditions (like 2020), but it seems like it might be doable.
Interesting idea I use outlook now but a Hubitat notification ( I use a RGBW bulb for my reminders) would be better.
Why does one even have to consider the date at all? Using a local variable might it be possible to have an even trigger on even weeks? If so, notifications would continue until the variable overflowed.
This runs once a week, and flips a Boolean variable each week. Only every other week will it send the notification. You just have to start it so it works the first time, or change the initial value of the Boolean local variable for that same reason.
I have something similar today that flips a Boolean variable every other week, but the problem are years like 2020 that has 53 weeks.
When week 53 ends in 2020 (actually 3:rd of January 2021), the weeks will start with 1 again for 2021 and the Boolean will indicate the wrong week as even (and the wrong week for garbage pick-up).
I was more thinking about if you maybe could import the current week number from somewhere to a variable or similar, and then include that variable into the rule?
Or if Hubitat had dates included in the software that also include the current (and accurate) week number?
Curious, does this mean that at the beginning of a year with 53 weeks, you experience a pickup two weeks in a row? Or you have two weeks with no pickup?
Our recycle is picked up every other week. Makes no difference if it is leap year or on what date it might fall, its simply every other week.
I will be creating a rule for this myself, thanks to your idea and bravenel's suggestion it will be easy.
Then have a rule that runs on January 1 that sets the Boolean to the right value for a new year.
For a year with 53 weeks, two weeks after 52 would be 1, but 1 is odd. Assuming we only want even numbered weeks, then the Boolean should be set to false on Jan 1, for the rule I posted above. The rule runs the first week, flips it to true, and exits the rule. So the first notice is the second week.
If you really really want to make this work every single year without any intervention, you will most likely need to create a small app to do this, this way you will be able to use Groovy math to get where you need to be.
Using that ISO week date info, I had managed to have this work in Excel but don't have access to that file anymore (old work place). So mathematically it is possible to do with easy maths (since I managed to do it in Excel).
Bonus, you will have learned basic Groovy app development and could release it to the community for others to use
Do you have these events in a Google calendar? There are community app(s) that can read calendar events, and could probably trigger off one of those. They aren't exactly easy to integrate with Google (Google's fault, not the app), but once you are up and running it seems to work OK.
Interesting, I was always under the impression it came from the Sabbath, but it seems to be limited to us old British Colonial rebels (Canada, USA & Australia).
But -- in my experience, Sunday is the first day of the week in the Middle east too (effectively), as Thursday is the last day of the work week, and Sunday the first...