Hi All,
I am hoping someone might be able to help me with a flow I want to implement.
Here is the scenario:
My garbage is normally collected every Tuesday, but if a holiday falls on a Monday, or Tuesday, garbage is collected on Wednesday.
I have the Holidays addon installed in Home Assistant, with a Holiday helper called ‘Observed Holidays for Garage Collection’ that has specific holidays that garbage is not collected in it.
The state of the Holiday helper returns how many days until the next observed Holiday. (Example: ‘17’ *17 days until Memorial Day)
I also have a local calendar called “Garbage Collection”, that is empty.
What I would like to do is create a flow in Node Red that
- Runs every Wednesday at 12:00am
- Checks if the upcoming Monday or Tuesday is a Holiday, by checking if the Holiday Helper state has a value of 6 or 7 (6 days from Wednesday would mean that upcoming Monday is a observed holiday, and 7 days from Wednesday would mean that upcoming Tuesday is a observed holiday)
- If the value is not a 6 or 7, create a Calendar event in Home Assistant for Garbage Collection for upcoming Tuesday (Normal Garbage Collection day)
- If the value is a 6 or 7, create a Calendar event in Home Assistant for Garbage Collection for upcoming Wednesday (Holiday Garbage Collection day)
I have basically already created a ‘Injector’ node to trigger the automation on Wednesdays at 12am that calls one ‘Current State’ node that checks the Holiday Helper state to see if has a value of 6, and another to check if the value is 7.
What I am having an issue with is steps 3 and 4 from above. How do I create an add Calendar Event in my ‘Garbage Collection’ local calendar? And how do I determine what date a Tuesday or Wednesday may fall on?
Any help would be greatly appreciated