Is there a way of visually representing the state of a boolean value inside a flow, as a text label or something else?

Hi,

I’m using Node-RED to do some complex automation, but the nature of my setup means that I sometimes have to disable parts of flows temporarily - particularly events that trigger on certain schedules. I’ve solved this by inserting a switch node just before the key action that checks a local boolean value. If true, do the thing, if false, don’t.

The value of boolean is set by two injection nodes, labelled ON and OFF, which effectively act as a way to enable or disable parts of flows. It works great.

Here’s an example of why this is useful. I’ve got an automation that controls access on a farm gate. It works on a schedule, so that packhouse trucks can get in during the day, but the gate will close after hours and over the weekends. But because some people have remote clickers, the automation also checks the gate state periodically and ensures that the gate is doing what it’s supposed to. That way, it’s never accidentally left open, nor can a truck be locked out when it needs to get in.

But, sometimes there’s a need to work over the weekend. In that case, I need the gate to stay open, but I’d rather not have to re-do the schedule just for this one event. Deleting the link to the closing flow obviously works, but is crude. Simply clicking the OFF button on that flow disables it until I click the ON button again.

The problem I’m now facing is that I don’t know what the current value of the boolean is. Is there some node that will visually display the value of a boolean, either as a text label, or as a visual on/off thingy?

Thank you.

I use node-red-contrib-simple-gate. It accepts control messages to open or close the gate (as per your ON and OFF), but shows the state (and time I think) as a status message. Any other messages it receives are passed as outputs if the gate is open, and blocked/dropped if it is closed. The state of the gate can be persisted between restarts/deploys.

1 Like

you should look at this : https://nodered.org/docs/writing-functions#adding-status

Adding a status to a function node let you “draw” shape/symbol/color on your node, like the blue dot appear on node not deployed yet or the red triangle when a node is misconfigured

1 Like

Thank you @dedlefou, your solution is actually what I ended up doing: adding status to a function node. Someone on reddit suggested this, but I forgot to come back here and update this thread.

Your suggestion goes a step further, though: I really like the idea of a coloured symbol - easier for the brain to take in.

The real solution is to build a dashboard for all this stuff, but I run on hassio and node-RED dashboard is borked by hassio’s Ingress security model. I remember reading it would require changes by the node-RED team (not just the node-RED plugin), so it’s unlikely to be fixed any time soon, if at all.

Anyhoo, thank you for your response, that’s totally the thing.