Hold the signal ever for min. 5 seonds before changing

Hello,

I have a problem with a signal, which aktivates a relay over a GPIO pin.
In some cases the relay is ON for some month, in other cases there is a change from ON to OFF in 250ms. This quick changes destroy my device on the load side.

The relay is connected to the GPIO pins.

The Nodered flow works with numbers 1 which aktivates the GPIO and number 0 which deactivates the GPIO.

Between ON -> OFF an OFF -> ON there have to be ever delay from minimum 5 seconds.

If I simulate it with my nodes here, there is no delay from second change to third. and so on.

Can somebody give me little help, please

image

[
    {
        "id": "2cfb65993f5fc7bd",
        "type": "inject",
        "z": "203feb89db46103a",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 650,
        "y": 1100,
        "wires": [
            [
                "180b3039e1aaacc9"
            ]
        ]
    },
    {
        "id": "51d7bb66fb99ef1f",
        "type": "inject",
        "z": "203feb89db46103a",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 650,
        "y": 1140,
        "wires": [
            [
                "180b3039e1aaacc9"
            ]
        ]
    },
    {
        "id": "180b3039e1aaacc9",
        "type": "delay",
        "z": "203feb89db46103a",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 900,
        "y": 1120,
        "wires": [
            [
                "ee8d7bce85356e08"
            ]
        ]
    },
    {
        "id": "ee8d7bce85356e08",
        "type": "debug",
        "z": "203feb89db46103a",
        "name": "Relay",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1090,
        "y": 1120,
        "wires": []
    }
]

If you want to slow down what is being set, use a delay node in Rate Limit mode
the below for example will allow 1 message per 5s (queuing them)

image

Thank you very much. I was in the near, but couldn´t find the goal. Thanks!

1 Like