How to automate light based on known future events?

I’ve been trying to set up some lights based on some calendar events but fear I’ve been down the rabbit hole that long I can’t find my way out again!

So, I’m trying to build a notification light to let me know which bins to put out on a given week.
I’ve finally managed to scrape the local site and have a list of which bins go out on what date (dates change due to public holidays, bins change when they start collecting the garden bin, etc).

I am running the scraper on GitHub, runs up selenium, generates a JSON file I can then download to process (tried this on HA but kept running into issues). The site gives me the next 3 months worth of dates.

Now my issue is I can’t work out which way to go from here. There doesn’t appear to be a way I can schedule the download, process it, then ‘load in’ 3 months worth of future events to fire off, as and when required.

Rather than trying to load in 3 months worth of events, should I instead be looking to automate the scrape once a week and just set up that week’s event instead?

I’ve circled round a few times, should I write a python script to run every day to look at the downloaded file, should I trigger the scrape once a week, should I load the file into node-red and process it that way, should I be writing an add-on.

I’m not looking for someone to do my work for me but point me in the right direction as I seem to be struggling with the proper way to approach driving the data through the system.
Any pointers much appreciated!

Can you determine a way to just stuff a Google calendar (or whatever your favorite calendar that supports a HA integration) right at this point with whatever is processing this?

I had looked at the google calendar integration but thought it didn’t do what I needed, however looking at it again I must have misunderstood. I’m looking at implementing that now, see how I go.

1 Like

It took quite a few evenings of a few minutes here and there but I got it into Google calendar and now have it triggering the lights. The automation kicked in before the event time as expected, it didn’t trigger to turn them off but a little debugging I’m sure I’ll get that sorted.

There are some examples in Calendar - Home Assistant for how to do things based on calendar events that are turning on/off.

For something where you want to look further ahead, check out this trash reminder blueprint: