A node that can be pressed to start/stop messages flow....?

Hi,
I spend a lot of time in NodeRed find it time consuming to manually disable a node temporally when debugging.

Is there a node that allows you to drop it into a flow and tap it to open or close the link it's on? A bit like the inject node with it's 'inject once' button press...

I've tried searching for 'switch' or 'pause' but not coming up with anything.

Any ideas? Ta

No, but you can do it with switch node and have it route based on a context variable that can be toggled with 2 inject nodes and a change node.

[
    {
        "id": "cceba20d74756a69",
        "type": "switch",
        "z": "333c7c68.2b3d34",
        "name": "flow.tap",
        "property": "tap",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 460,
        "y": 740,
        "wires": [
            [
                "1f4583f12a69ac9c"
            ]
        ]
    },
    {
        "id": "ae2e908b5fd530f3",
        "type": "inject",
        "z": "333c7c68.2b3d34",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 330,
        "y": 620,
        "wires": [
            [
                "41b5cc5087da24d2"
            ]
        ]
    },
    {
        "id": "97b0c1500d7ea79c",
        "type": "inject",
        "z": "333c7c68.2b3d34",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 330,
        "y": 660,
        "wires": [
            [
                "41b5cc5087da24d2"
            ]
        ]
    },
    {
        "id": "41b5cc5087da24d2",
        "type": "change",
        "z": "333c7c68.2b3d34",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "tap",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 490,
        "y": 640,
        "wires": [
            []
        ]
    },
    {
        "id": "631c7ed8fd16575b",
        "type": "inject",
        "z": "333c7c68.2b3d34",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 300,
        "y": 740,
        "wires": [
            [
                "cceba20d74756a69"
            ]
        ]
    },
    {
        "id": "1f4583f12a69ac9c",
        "type": "debug",
        "z": "333c7c68.2b3d34",
        "name": "debug 34",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 620,
        "y": 740,
        "wires": []
    }
]

You can disable a node via the (right click) context menu.
Right click | Show action list | Disable selected nodes.

Unfortunately there is no keyboard shortcut for this action and I don't think you can specify your own, so it's no easier than using the node config dialog.

There is no default, but you can bind your own

Ah yes, thanks. I tried that but nothing happened.
Turns out you have to press the tick button.

So as an experiment I defined shortcuts

  • alt-d = disable selected nodes (was browser URL box recent searches dropdown )
  • alt-e = enable selected nodes (was browser edit menu)

Now I can click a node to select it then alt-d to disable it.
:+1:

I can recommend ctrl-shift-e and ctrl-shift-d.
I've been using those for ages without any clashes with other shortcuts in both Firefox and Chrome.

Thanks for all the responses, does anyone with the skills fancy writing a node to do this? is it even possible...?

Thanks

Thanks, I did think about the 'switch' node, but that would be even more time spent setting it up, especially where I might want a dozen or so switches...
Shame there isn't a simple node to drop onto a line?
P

Try a 'gate' node, something like node-red-contrib-flowgate seems to fit your requirements, as it's just one node that is dropped into your flow, written by @gmag11
(I don't have a use, so haven't used it)

4 Likes

Perfect! Many thanks...

1 Like

I have been using this gate node to trigger events from my application. It has many queuing and triage options which I use to trigger events on demand from buttons on the dashboard. Pretty neat...

3 Likes

Hi @Mrb32,

If you wouldn't mind, could you post a little piece of what you use it for? Your use case sounds fascinating, and I would like to understand it better.

Pretty simple...

I use tasmota ESP8266 devices and nodered to control my model railway.
In the simplest use case, q-gates each hold a payload containing a list (array) of devices and commands corresponding to a route trains should follow.
A dashboard button is used to open the gate (either flush or peek), the payload is then processed by a flow that will send distinct messages to each device, setting turnouts and/or signals in the process.
The original payload is then sent back to, or retained by, the gate, so that it is ready for the next time I need it.

There are a couple of more complex uses but the post would turn into war and peace...

May be not so fascinating after all...
Cheers.

2 Likes

Hi @Mrb32,

Thank you for that description. Super interesting to me, because you're describing something I haven't done, nor had really considered doing.

From my not-having-used-this-yet postion, what you've described seems to me to be a very dynamic way of (essentially) scripting complex events. The idea seems a bit like the "scenes" concept in home automation: given x input, do all of these things with all of these otherwise tangentially related systems.

You use it for model railways (which is a cool use case). I might use it to trigger events in an irrigation system for a small farm.

I thank you. You've given me a lot to think about, which is always the best bit.

Cheers.

2 Likes

If you fancy seeing the railways in action, you can have a look at my youtube channel. I don't go into the nodered aspect much, but every movement (start/stop, diversion, other automatism...) is done using nodered and tasmota.

Here is a link to the latest video:

3 Likes