# Hold the signal ever for min. 5 seonds before changing

**URL:** <https://discourse.nodered.org/t/hold-the-signal-ever-for-min-5-seonds-before-changing/82689>\
**Category:** General\
**Created:** [7 November 2023 15:28 UTC](https://discourse.nodered.org/t/hold-the-signal-ever-for-min-5-seonds-before-changing/82689 "2023-11-07T15:28:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Herbert](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@Herbert](https://discourse.nodered.org/u/Herbert)\
**Post date:** [7 November 2023 15:28 UTC](https://discourse.nodered.org/t/hold-the-signal-ever-for-min-5-seonds-before-changing/82689/1 "2023-11-07T15:28:31Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/2/5285eb9a3b625c85daf5393ba95d1f1c097e8cdb.png)

```auto
[
    {
        "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": []
    }
]

```

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [7 November 2023 15:46 UTC](https://discourse.nodered.org/t/hold-the-signal-ever-for-min-5-seonds-before-changing/82689/2 "2023-11-07T15:46:37Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d5df6acfaae802ddcd77473a85f16fb83f17cd4f.png)

---

<div class="post-metadata">

**Author:** ![Herbert](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@Herbert](https://discourse.nodered.org/u/Herbert)\
**Post date:** [7 November 2023 15:54 UTC](https://discourse.nodered.org/t/hold-the-signal-ever-for-min-5-seonds-before-changing/82689/3 "2023-11-07T15:54:46Z")

</div>

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