I’ve multiple input_select to indicate days and week for trash bin pickup:
input_select.monday can be YES or NO
one for each day of the week.
also I’ve input_select.week can be EVEN, ODD, ALL
In this scenario I can config at 100% days of trash bin pickup.
Now I’d like to create a sensor.date who tell me the next day in format: name-of-day YYYY-MM-DD for the next pickup day.
For example if i’ve set a pickup day only on saturday and today is friday, the sensor must be show me: Sat 2019-03-23 (example based on a real date, day after tomorrow).
Sensor must be based also for type of week odd or even.for example this week is n. 12 EVEN (18 to 24 march) so if I set week ODD, the next pickup day for the example above bust be on 30 March and NOT 24 march.
A next step (optional but ideally) woud be…if pickup day is saturday and today is saturday, sensor.date for the next pickup day must show me TODAY (if now is <= 12:00 a.m.) otherwhise like before (Sat YYYY-MM-DD) if now is Sat but time is > 12:00 a.m.
How can I create a next date calculation based only on my input_select YES/NO for each day (and type week)?
Sorry for the question but manipulate dates for me is hell
You configure the trash dates by hand? Why not automate it? There are a lot of (custom) components for trash collectors already. Is yours not supported yet?
Although I like what you’re trying to achieve, that sounds like a very complicated setup
I can’t really work on a full solution right now (at work) but can at least give you a few pointers for your date calculations:
To get a date/time/week/weekday etc, you can use this formula:
There’s no API service for Italy. I’m modifying the solution by user Skavala who has a good point to start from. And adapt it for me needs. At the end i hope to share my solution.
Hi, yes the user is… Me
Thanks to your suggest i succesfully get what I want and now with this new request i hope to expand my project and then share it. Thanks a lot