How to create 'manual switch' for part of Node Red flow?

I have a node-red flow that leverages Google TTS to announce when doors are opened/closed as well as send IOS notification.

I need to create a “Nap Time” toggle switch in HA front-end, that I can use the state of to disable the “Google TTS” portion but still allow for the IOS notification.

Since this won’t be tied to any physical device, I was looking at maybe a template switch, but that didn’t seem to fit.

Any suggestions/ideas?

Use a input_boolean

1 Like

Thanks… that is just what I am looking for.

Ok… now a follow up…

So I have my flow as follows:

Create msg payload > switch (check if running in certain time period) > tts output.

But what I want to do is as followings:

Create ms payload > switch (check if running in time windows) > check it “nap_time” = off > tts output

But when I check state of Nap_time, my msg.payload from create payload gets over written.

How do I retain that through the 2nd check or is there a way to do a combined time switch / If state ??

there is a “gate” node available … you can put this one into your flow and open/close the gate based on your input_boolean. This way the msg.payload will not be overwritten

I have the bool-gate installed, but I am struggling to figure out how to have it “read” the state of an input-binary.

you need to setup a HA trigger-node which is getting the new input-binary whenever it is changed. Than just feed the true/false or on/off as trigger into the gate

So it looks something like this??

I’m quite new to all of this too. I have been doing something similar with the HA current state switch. I have 0 background in programming so I’m sure there will be much prettier/nicer ways. But surely you could just have a ha current state node for the input Boolean before the google TTS? If you configured it to halt if off then it would just halt the flow and the TTS would not trigger.

@amishra123 The problem with using a STATE node is that is changes the message payload.

So I have the message payload on the INPUT side being “The xxx door was opened”, but on the far side it is either off/on for the state of NAP time.

Ah I see, ofcourse. As I said before I’m new to all this so my solutions are definitely not the most pretty or efficient. I would just make a different flow for each door. You could still have a switch which routes the on and off and then just pre-defined TTS messages for each door. with a current state before the TTS. You would have 4 flows, but then you would not need to worry about the saving the state etc and it would work!

you always can use a local or global variables … and set them via a change node !