Hi all,
TL;DR at the bottom, as I’ve waffled on a lot.
I’ve spent a few days putting this together and have to admit I’m quite proud that I’ve been able to figure it out - I’m still very much learning Node Red. Is it over engineered, yes! I couldn’t think of another way to achieve my goal, which was to have our Google Home devices announce the bins that need to go out the night before they’re due to be emptied.
As we have three bins and glass recycling boxes, all of which get emptied on differing schedules and, depending on bank holidays, even different days it can get a bit frustrating to have to constantly check multiple calendar cards, provided by the council, to make sure the right one(s) have gone out.
Thanks to @bruxy70’s brilliant Garbage Collection addon, coupled with @amaximus’ custom Lovelace card for it, I was able to ingest all of these calendars, including the random date changes, in to Hass.io and clearly display what needs to go out and when. Brilliant! But, my missus doesn’t use Hass.io or the companion apps (nor have I been able to form an argument to have a tablet setup just to display it…yet), things just need to work for her and as long as they do and make her life easier, I can continue to spend time and money on smart home stuff and automation.
A Redditor suggested @Apipa169’s Assistant Relay for Hassio addon, in a random thread, and it got me thinking about having Hass.io, via Node Red, announce which bins to take out the night before.
I use Excel heavily for most things and struggle to get out of the mindset of how I’d achieve things using that for everything else and so started off solving this problem (that probably no one else has) there. The first step was to work out all of the bin
combinations that we could face, 15 in case anyone is wondering, and then assigning a number value to them.
Why start at 100? Just to make sure that I didn’t run in to issues really. I also later realised that I needed to account for the bins that weren’t going out in the sum, i.e. 103 as each bin that isn’t going out is assigned a value of 1, which as I’ve typed this out I realise now probably isn’t actually required… Hindsight, hey? Well that gives me something to tweak in v2 .
Taking this concept in to Node Red was relatively straight forward, the most difficult bit was how to sum all of the outputs together, thankfully some Googling introduced me to the join node.
I didn’t want one massive flow or that the whole thing ran in one process, so opted to have this initial flow run at 6am each day and output the result to a text file, using the file node.
Then at 7:30pm daily the second part of the flow kicks off and reads the file before decoding it and vocalising the result through our Google Home devices.
From the testing I’ve done, it seems to work as designed and I’m really happy with it. The real world testing begins tonight, sadly it’s only a single bin tomorrow but as long as it fires and says the right bin I’ll be pleased.
Full flow export can be found here.
TL;DR over engineered a flow to solve a problem, that only I probably have, but I’m a Node Red n00b and quite proud of it. Can it be improved?
Thanks.