# Button block until 2 seconds passes

**URL:** <https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542>\
**Category:** Dashboard\
**Created:** [26 September 2021 16:25 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542 "2021-09-26T16:25:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 16:25 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/1 "2021-09-26T16:25:45Z")

</div>

Hello, I got flow that control relays via modbusRTU. When I click the button on node-red dashboard to turn on the relay I got to wait at least 2 seconds to turn off the relay or turn on the others because MODBUS serial is busy. Is it possible to block button until 2 seconds passes?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 September 2021 16:32 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/2 "2021-09-26T16:32:48Z")

</div>

> [@bubuq3](#):
>
> Is it possible to block button until 2 seconds passes?

Yes. There are many ways. Using built in core nodes, you could use a change node to set a flow or global flag that then blocks further messages. Add a trigger node to send nothing then send a reset 2 seconds later.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 September 2021 16:33 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/3 "2021-09-26T16:33:38Z")

</div>

> [@bubuq3](#):
>
> MODBUS serial is busy

Why is it busy? Many reads? or many writes?

Are you reading lots of single items?

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 16:36 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/4 "2021-09-26T16:36:35Z")

</div>

Many writing request. Sending message via MQTT to my esp8266 then modbus command to modbus relay board.  
When I press1 (relay1) button on node-red and then after 1second I want it to turn off it doesn;t turn off

> The only one note: ModbusRTU write register operation takes time. That is you can get next MQTT event before previous write operation has finished in that case mb.writeHreg will not perform write request as serial but is busy.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 September 2021 16:43 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/5 "2021-09-26T16:43:17Z")

</div>

> [@bubuq3](#):
>
> When I press1 (relay1) button on node-red and then after 1second I want it to turn off it doesn;t turn off

Have you put anything in to turn it off?

Have you looked at the trigger node?

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 16:45 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/6 "2021-09-26T16:45:11Z")

</div>

Each click I got to wait at least 2 seconds then everything works. But I fast click switches on node-red dashboard it doesn't change the state of the relay. So you suggest trigger node. I got to look it up.

```auto
void callback(char * topic, byte * payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  if (!mb.slave()) {
    if (strstr(topic, sub1)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the LED if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0001, 0x0100, cbWrite); // 0x001 - relay 1, 0x002 - relay 2 and so on 

        // 0x0100 - turn on relay, 0x0200 turn off relay 

      } else {

        mb.writeHreg(SLAVE_ID, 0x0001, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub2)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0002, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0002, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub3)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0003, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0003, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub4)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0004, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0004, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub5)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0005, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0005, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub6)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0006, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0006, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub7)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0007, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0007, 0x0200, cbWrite); // turn off the light

      }
    } else if (strstr(topic, sub8)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the light if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0008, 0x0100, cbWrite);

      } else {

        mb.writeHreg(SLAVE_ID, 0x0008, 0x0200, cbWrite); // turn off the light

      }
    } else {
      Serial.println("unsubscribed topic");
    }
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5d927dad2bdb6392508bc1ee869947cc0e8eaee6.png)  
So I can use trigger node and set it to wait for 2 seconds and this will do the trick?

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 17:03 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/7 "2021-09-26T17:03:43Z")

</div>

trigger node doesn't do the trick 😃 or I don't know how to manage it. I'm such a rookie with HA and node-red. Could you please create a flow for me? I can't find an example how to manage it. Gotta search longer..

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 September 2021 17:12 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/8 "2021-09-26T17:12:14Z")

</div>

> [@bubuq3](#):
>
> or I don't know how to manage it. I'm such a rookie with HA and node-red.

As a new user, I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

* * *

![VI6TmDa06d](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d845fac041934c61933e841b4bd374c4b1c6b52.gif)

```auto
[{"id":"ade7ead4d31c06dc","type":"inject","z":"af952aeaa20f4f97","name":"dashboard button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":1720,"y":500,"wires":[["1c9b78d02ca6b8fd"]]},{"id":"1c9b78d02ca6b8fd","type":"trigger","z":"af952aeaa20f4f97","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"2","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1910,"y":500,"wires":[["72105917ed0f0a29"]]},{"id":"72105917ed0f0a29","type":"debug","z":"af952aeaa20f4f97","name":"To MQTT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2070,"y":500,"wires":[]}]

```

NOTE: i am unsure what you actual use case is.

The above is based on your earlier statement of switching off after 2 sec.

If you need something else, please be 100% specific.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [26 September 2021 17:15 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/9 "2021-09-26T17:15:31Z")

</div>

Sometimes to be fail safe with user interactions, self disabling/enabling the buttons may come handy.

Heres one way:

```auto
[
    {
        "id": "9ee2ddd772eacc28",
        "type": "ui_button",
        "z": "e490bfdba10fb48a",
        "name": "",
        "group": "922cc2b20a87f647",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "self activating button",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "topic",
        "topicType": "msg",
        "x": 640,
        "y": 520,
        "wires": [
            [
                "7849fdaecc168864"
            ]
        ]
    },
    {
        "id": "7849fdaecc168864",
        "type": "function",
        "z": "e490bfdba10fb48a",
        "name": "",
        "func": "\nlet msg_1 = {payload:\"ON\",topic:\"something\"} // or OFF, make your own logic.\nlet msg_2 = {enabled:false}\nreturn [msg_1,msg_2]\n",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 830,
        "y": 520,
        "wires": [
            [
                "7deb64b7e76f4fb3"
            ],
            [
                "a84dd3e194c2cbde"
            ]
        ]
    },
    {
        "id": "7deb64b7e76f4fb3",
        "type": "link out",
        "z": "e490bfdba10fb48a",
        "name": "to-device",
        "links": [],
        "x": 945,
        "y": 490,
        "wires": []
    },
    {
        "id": "a84dd3e194c2cbde",
        "type": "link out",
        "z": "e490bfdba10fb48a",
        "name": "back-to-button",
        "links": [
            "7da64e819336c26a"
        ],
        "x": 945,
        "y": 550,
        "wires": []
    },
    {
        "id": "7da64e819336c26a",
        "type": "link in",
        "z": "e490bfdba10fb48a",
        "name": "to-button",
        "links": [
            "a84dd3e194c2cbde"
        ],
        "x": 195,
        "y": 560,
        "wires": [
            [
                "7e8fb52f4cb3ff24"
            ]
        ]
    },
    {
        "id": "7e8fb52f4cb3ff24",
        "type": "trigger",
        "z": "e490bfdba10fb48a",
        "name": "",
        "op1": "",
        "op2": "{\"enabled\":true}",
        "op1type": "pay",
        "op2type": "json",
        "duration": "1",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 290,
        "y": 520,
        "wires": [
            [
                "f24a7e4b1d9747ad"
            ]
        ]
    },
    {
        "id": "f24a7e4b1d9747ad",
        "type": "change",
        "z": "e490bfdba10fb48a",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload.enabled",
                "pt": "msg",
                "to": "enabled",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 440,
        "y": 580,
        "wires": [
            [
                "9ee2ddd772eacc28"
            ]
        ]
    },
    {
        "id": "922cc2b20a87f647",
        "type": "ui_group",
        "name": "Default",
        "tab": "b15d581341d0093f",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "b15d581341d0093f",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 September 2021 17:22 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/10 "2021-09-26T17:22:20Z")

</div>

Or this will disable the switch for 2 seconds after you toggle it

 ![Untitled 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a0658e5d02be8f3acf53a7c808fc35f33d7ab3a3.jpeg)

```auto
[{"id":"accb4fab15dd9765","type":"ui_switch","z":"33c0f0bf5f175742","name":"","label":"switch","tooltip":"","group":"3ce32370.c60f1c","order":3,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":270,"y":380,"wires":[["4bc694a366f31a8e","7ca1966b42dabdaa"]]},{"id":"7ca1966b42dabdaa","type":"debug","z":"33c0f0bf5f175742","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":380,"wires":[]},{"id":"4bc694a366f31a8e","type":"trigger","z":"33c0f0bf5f175742","name":"disable for 2s","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"2","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":190,"y":320,"wires":[["b9aecf287f15b1a6"]]},{"id":"b9aecf287f15b1a6","type":"change","z":"33c0f0bf5f175742","name":"","rules":[{"t":"set","p":"enabled","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":320,"wires":[["accb4fab15dd9765"]]},{"id":"3ce32370.c60f1c","type":"ui_group","name":"Demo","tab":"d74bbed4.c2cfb","order":2,"disp":false,"width":"6","collapse":false,"className":""},{"id":"d74bbed4.c2cfb","type":"ui_tab","name":"Demo","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 17:24 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/11 "2021-09-26T17:24:18Z")

</div>

Watch this you will understand: [MODBUS Serial is busy - YouTube](https://youtu.be/8C1hwWNim1E)  
if there is too much MODBUS writing request it doesn't change the state of the relay.  
Got to do: delay() each write?

```auto
void callback(char * topic, byte * payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  if (!mb.slave()) {
    if (strstr(topic, sub1)) {
      for (int i = 0; i < length; i++) {
        Serial.print((char) payload[i]);
      }
      Serial.println();
      // Switch on the LED if an 1 was received as first character
      if ((char) payload[0] == '1') {

        mb.writeHreg(SLAVE_ID, 0x0001, 0x0100, cbWrite);
       delay(2500);
      } else {

        mb.writeHreg(SLAVE_ID, 0x0001, 0x0200, cbWrite); // turn off the light
        delay(2500)

      }

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 September 2021 17:37 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/12 "2021-09-26T17:37:22Z")

</div>

> [@bubuq3](#):
>
> `delay(2500);`

The issue you show in the youtube video looks like its due to the 2.5s delay - that will be blocking.

Also, as the ESP is single threaded - I believe you dont need a delay after the `Serial.print` command (or at most, [30ms will do](https://minimalmodbus.readthedocs.io/en/stable/serialcommunication.html))

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 17:38 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/13 "2021-09-26T17:38:53Z")

</div>

At first I didn't have this delay (on the video it is without the delay and when I press fast to turn on switch 1 and 2 it doesnt :D) see: [Modbus - fast clicking switches - YouTube](https://youtu.be/u5YCBk1n-FE)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 September 2021 17:43 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/14 "2021-09-26T17:43:50Z")

</div>

You will need to debug your auruino code (using serial printing) - confirm your values ACTUALLY get to `mb.writeHreg` function (e.g. are they getting blocked by `if (!mb.slave()) {` ? Are they not arriving in the MQTT `callback` function?

Also, are you certain the value is NOT being written to the relay? It may be that the fast operation of your switches are too fast to register - only logging will confirm this.

I would probably use a positive feedback by using `cbWrite` to send the result to your flow via MQTT - then use that to animate the button position.

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [26 September 2021 17:59 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/15 "2021-09-26T17:59:30Z")

</div>

Yup: got commands to read the channel state: [8 Channel Rail RS485 Relay commamd.docx - Google Docs](https://docs.google.com/document/d/1v6adliMGZ_I9XzKsD_k5ZM-1SB-5Y8pD/edit?usp=sharing&ouid=101678029615539409360&rtpof=true&sd=true)  
I gotta figure sth out ;/

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [18 October 2021 20:08 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/16 "2021-10-18T20:08:52Z")

</div>

> [@Steve-Mcl](#):
>
> se that to animate the button position.

Sorry for that late reply. What nodes would you use to animate tbe button position?  
mqtt in node to get the feedback from the modbus relay and send it via mqtt by esp 8266.  
Right now I got Home Assistant with entity node connected with mqtt out to publish the payload 1 or 0 to esp with my relay board.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c8f61597bc02dade7557b709d7c1e8ae5e0194a.png)  
in payload section I got something to change?  
What would like an example with animation button?

---

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [21 October 2021 05:33 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/17 "2021-10-21T05:33:50Z")

</div>

Wouldn't a simple `delay` node in rate limit setting solve the issue? You can toggle as much as you want, the messages will get queued up and be send with a 2s delay.

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [21 October 2021 10:21 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/18 "2021-10-21T10:21:57Z")

</div>

I managed to fix it, but I'm now struggling with animating the buttons depend on the relay state. I got to send the data from my esp to my node-red flow with mqtt in node then convert it to json and then what... ;/?

---

<div class="post-metadata">

**Author:** ![bubuq3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bubuq3/32/48671_2.png) [@bubuq3](https://discourse.nodered.org/u/bubuq3)\
**Post date:** [21 October 2021 22:06 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/19 "2021-10-21T22:06:25Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/37f9cb85ff9800ac62f12d8b461abfbb708c1482.png)  
Just for test, they are not in queue e.g. when I click 1 button and then second one to turn on and it doesn't turn on 😃 or I hasn't clicked the proper option/ connect it properly

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b72e0c18588c805b3170845a7b39915309c92c43.png)

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [16 November 2021 14:32 UTC](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542/20 "2021-11-16T14:32:13Z")

</div>

hi there, how did you connect from esp to modbus ?

[Next page](https://discourse.nodered.org/t/button-block-until-2-seconds-passes/51542.md?page=2)
