Hi,
I use an old removed HACS integration to notify and keep track of garbage pickup.
Since it is removed and gives me an error in logs everytime i restart i was looking to change to local calendar as suggested in HACS.
But there is one choice missing in the recurring part of local calendar, Odd or Even week numbers.
I would like to suggest to add those in the same list as the picture shows, the repeat section:
As of now when i have every 2 weeks it will of course work until the week number counter resets from week 53 to 1. Obviously i can change manually everytime this happens, but that might be after i have missed this once which i rather would not like to happen since we have to pay even if we don’t put our bins in the right place.
So i’m hoping for this to be added so i can keep track using supported functions instead of HACS integrations.
You could possibly use a template sensor to indicate even odd weeks. strftime has two ways to calculate week number:
%U Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 00, 01, …, 53
%W Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 00, 01, …, 53
Because Jan 1 was on a Monday this year, that means that %U will always be one behind %W except on Sundays. To create an is_odd_week template binary sensor, the template might look like:
{{ now().strftime("%W") | int % 2 }}
From your post, it sounds like you might need to count weeks from one instead of zero. That might look like
{{ (now().strftime("%W") | int + 1) % 2 }}
Or maybe you need some other definition of counting weeks than is provided here. You might be able to do a custom calculation based on the day of year values that strftime can provide – %j.
For example, counting the first seven days of the year (regardless of which day of week was first) as week 1, then the next seven as week 2, etc. for an is_odd_week binary sensor would look like: