I have a Node-Red flow with an exec node running a Python script that tests if my bins need to go out and if they do, it returns a string.
I’m passing the exec stdout to a HA Call Service notify node and using this to send a message telling me which bin needs to go out.
It all works after a lot of banging my head against several walls, except if no bins go out and the Python script returns nothing. I still get an HA notification with a title and no message.
How do I test if the exec node is not returing anything and conditionally send the notification? I’m new to Node red and have read as many posts and blogs as I can find but can’t work out how to do this.
Basically: If exec node returns nothing and payload: “”. Stop the Flow.
msg.payload will never be null unless you personally have set it to null. It can be empty, in standard nodered flows, but null is something very different to empty. Empty - is “” null, is basically that it doesn’t exist at all. Which it does, because the Exec node will output something even if it is just an empty string. (Which you can see in the debug node, is exactly what it did output)
null = not set.
Typically if I am doing work in a function node and I don’t want the flow to continue if my if statements suggest they shouldn’t - say if I am parsing the XML feed from the Met Office warnings and there is no warning - then I will simply do this:
msg = null;
Because the msg object is now null, the flow will end when it leaves the function node.
Sadly Home Assistant does not currently provide a way to subscribe to an ical. Though You we can probably create a Google calendar and subscribe that to the remote ical.
Edit: Where did you find out that they are going to provide an ical ?
“Regrettably we are unable to provide collection calendar downloads at this time. We are working on a new system which will give access to calendars, but unfortunately we have experienced unexpected delays. We anticipate the new system will go live in January. We apologise for any inconvenience caused by the delay in publishing next year’s calendars. This page will continue to be available to look up the next collection dates during this period.”
I contacted them asking what they are implementing and how and they came back and said it was ical.