Switch node labels

I have a flow that has one input that needs to be switched between about 20 different paths.

When using a single switch node it is very cumbersome to try and follow the flow. I realize you can add labels and then hover over the output. But, when you have as many outputs as I do, trying to find the output you are looking for takes a while. Also when changing/reordering the labels get all out of alignment.

I would like to propose some upgrades to the switch node. I think the labels should be linked to the condition in the properties dialog. Something like this:

properties

Also the labels should be displayed on the node itself like this:

switch_labels

Are these changes possible?

Currently I use a bunch of different switch nodes connected to a single input like below:

multiple_switches

Is there maybe a better way to do this, that is just as easy to follow?

Are you sure you need to do that? Often there are better ways of solving the problem. Can you say why you need to do it?

I have 433Mhz remote codes coming in and I need to perform different actions based on which code comes in. Each code has a unique action.

I like the idea of this and as an workaround for now, I came up with this idea

image

I think the downside of your proposal is the editing space taken up by the label

Maybe a compromise would be to have the output dots be evenly spaced instead of clustered in the vertical centre

image

image

1 Like

That makes more sense to me. However, if you go ahead with this labeling please make it optional as I prefer the way it is now for my few-output switches. Or maybe an add-on node instead of a replacement.

Thanks

Maybe an option could be that if all of the label boxes are empty, the look of the node would not change.

1 Like

:point_up_2: There ya go

Since I'm addicted to mqtt and always have a broker running somewhere, I tend to approach this kind of problem "backward":

[{"id":"638aef5c.e41ba","type":"change","z":"5faee2f.474159c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":300,"wires":[["43caf8f8.cae2b"]]},{"id":"43caf8f8.cae2b","type":"mqtt out","z":"5faee2f.474159c","name":"","topic":"","qos":"","retain":"","broker":"aab50065.4b5c8","x":450,"y":300,"wires":[]},{"id":"24c70407.2fa1ec","type":"mqtt in","z":"5faee2f.474159c","name":"","topic":"living","qos":"2","datatype":"auto","broker":"27637075.6e9868","x":590,"y":200,"wires":[["5e18a921.3db228"]]},{"id":"898811bf.1bab7","type":"mqtt in","z":"5faee2f.474159c","name":"","topic":"bedroom","qos":"2","datatype":"auto","broker":"27637075.6e9868","x":600,"y":260,"wires":[["1c2136d.9ad2a49"]]},{"id":"bea7aa24.47eac8","type":"mqtt in","z":"5faee2f.474159c","name":"","topic":"outside","qos":"2","datatype":"auto","broker":"27637075.6e9868","x":590,"y":320,"wires":[["dc4986df.54692"]]},{"id":"d1dd3d4f.9c9fa","type":"mqtt in","z":"5faee2f.474159c","name":"all","topic":"+","qos":"2","datatype":"auto","broker":"27637075.6e9868","x":590,"y":380,"wires":[["27254326.693194"]]},{"id":"5e18a921.3db228","type":"debug","z":"5faee2f.474159c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":200,"wires":[]},{"id":"4e9b5251.c8a2dc","type":"inject","z":"5faee2f.474159c","name":"","topic":"","payload":"living","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["638aef5c.e41ba"]]},{"id":"1c2136d.9ad2a49","type":"debug","z":"5faee2f.474159c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":260,"wires":[]},{"id":"dc4986df.54692","type":"debug","z":"5faee2f.474159c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":320,"wires":[]},{"id":"27254326.693194","type":"debug","z":"5faee2f.474159c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":380,"wires":[]},{"id":"67bce359.2111a4","type":"inject","z":"5faee2f.474159c","name":"","topic":"","payload":"bedroom","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":300,"wires":[["638aef5c.e41ba"]]},{"id":"b702c972.5e2088","type":"inject","z":"5faee2f.474159c","name":"","topic":"","payload":"outside","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":340,"wires":[["638aef5c.e41ba"]]},{"id":"aab50065.4b5c8","type":"mqtt-broker","z":"","name":"","broker":"pi3plus.local","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"27637075.6e9868","type":"mqtt-broker","z":"","name":"","broker":"pi3plus.local","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

This is almost self-documenting and avoids problems when adding or removing branches.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.