Stop a node from running

Hey All,
I've got a motion sensor that triggers a Light Transition Node which dims down for 3 minutes to a dim level. Then holds at that brightness for 5 minuets at which point it trips the next Light Transition Node which dims it all the way down.

If motion is detected while the second Light Transition Node is running they will both be running causing the light to flicker.

How can I set this up so the second Light Transition Node stops when the motion sensor detects more movement?

[
    {
        "id": "4e0717ed72f9a962",
        "type": "light-transition",
        "z": "b8865bf6a1a8afeb",
        "name": "",
        "startRGB": "#ff0000",
        "transitionRGB": "#ffc864",
        "endRGB": "#ffffff",
        "startMired": "",
        "endMired": "",
        "transitionTime": "3",
        "transitionTimeUnits": "Minute",
        "steps": "200",
        "startBright": "250",
        "endBright": "5",
        "brightnessType": "Percent",
        "transitionType": "Linear",
        "colorTransitionType": "Weighted",
        "x": 550,
        "y": 440,
        "wires": [
            [
                "88431beee925b54e"
            ],
            []
        ]
    },
    {
        "id": "ebe7b499e58b0fa1",
        "type": "mqtt in",
        "z": "b8865bf6a1a8afeb",
        "name": "",
        "topic": "/shop/motionSensor",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "e8de652f3f0d5685",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 90,
        "y": 480,
        "wires": [
            [
                "21ef253f129e2dac"
            ]
        ]
    },
    {
        "id": "21ef253f129e2dac",
        "type": "switch",
        "z": "b8865bf6a1a8afeb",
        "name": "ON?",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "onPirActive",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 270,
        "y": 480,
        "wires": [
            [
                "4a81ebe9ad59f31b",
                "4e0717ed72f9a962",
                "27058b8614cfa4e4",
                "9b3422149211a344"
            ]
        ]
    },
    {
        "id": "4a81ebe9ad59f31b",
        "type": "trigger",
        "z": "b8865bf6a1a8afeb",
        "name": "",
        "op1": "",
        "op2": "",
        "op1type": "nul",
        "op2type": "date",
        "duration": "5",
        "extend": true,
        "overrideDelay": false,
        "units": "min",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 530,
        "y": 500,
        "wires": [
            [
                "50778a92a191dc0a"
            ]
        ]
    },
    {
        "id": "50778a92a191dc0a",
        "type": "light-transition",
        "z": "b8865bf6a1a8afeb",
        "name": "",
        "startRGB": "#ff0000",
        "transitionRGB": "#ffc864",
        "endRGB": "#ffffff",
        "startMired": "",
        "endMired": "",
        "transitionTime": "1",
        "transitionTimeUnits": "Minute",
        "steps": "10",
        "startBright": "5",
        "endBright": "0",
        "brightnessType": "Percent",
        "transitionType": "Linear",
        "colorTransitionType": "Weighted",
        "x": 550,
        "y": 560,
        "wires": [
            [
                "88431beee925b54e"
            ],
            []
        ]
    },
    {
        "id": "27058b8614cfa4e4",
        "type": "trigger",
        "z": "b8865bf6a1a8afeb",
        "name": "",
        "op1": "",
        "op2": "0",
        "op1type": "nul",
        "op2type": "num",
        "duration": "7",
        "extend": true,
        "overrideDelay": false,
        "units": "min",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 530,
        "y": 620,
        "wires": [
            [
                "88431beee925b54e"
            ]
        ]
    },
    {
        "id": "e8de652f3f0d5685",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.1.154",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

You can use either maintain a flow or global var with a true/false entry and then use a switch node to only allow traffic when the variable is TRUE. Or you could use one of the contributed GATE nodes.

Hmm, I'm doing that with the first switch node. I'm trying to Stop the Light Transition Node when it's already running.

According to the read me

This node will stop running when it has reached the last step. It will send a msg.payload of complete out of the second output on the node. You can also manually stop the node by sending a msg.payload of stop or STOP. The node will end its loop and send a msg.payload of stopped out of the second output.

If this is the node in question

1 Like

Thanks for reading the manual for me... I'll start there next time.

But seriously, thank you!
Rich

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