# MQTT connection status

**URL:** <https://discourse.nodered.org/t/mqtt-connection-status/9139>\
**Category:** General\
**Created:** [18 March 2019 16:58 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139 "2019-03-18T16:58:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![domcsidd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domcsidd/32/5379_2.png) [@domcsidd](https://discourse.nodered.org/u/domcsidd)\
**Post date:** [18 March 2019 16:58 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/1 "2019-03-18T16:58:39Z")

</div>

Hi everyone!

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/bd6fd85e9b8b65603760b650f203b809747a0cbd.png)  
I have some problem with my solution. I have an esp8266 witch communicate with my node-red server. It sends a sensor's value and publish an "ALIVE" text if callback happens(if a msg arrive in a specified topic) . So I want to observe it ,if it's working or not . But in not specified regularity it sends me an "DEAD "sign , when it is plugged . Please watch the code , cause it is hard to explain .Thanks for your help.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/26bf858d814fdac5542658f9a96c0eded10566c8.png)

```auto
[{"id":"9c6b26c1.5aa238","type":"mosca in","z":"e7c02894.549188","mqtt_port":"1884","mqtt_ws_port":"","name":"","username":"","password":"","dburl":"","x":108,"y":32,"wires":[[]]},{"id":"f88767e0.301628","type":"mqtt out","z":"e7c02894.549188","name":"","topic":"topic/stop","qos":"","retain":"","broker":"db15ab6a.2297f8","x":454,"y":211,"wires":[]},{"id":"9c2442b0.a3e14","type":"mqtt in","z":"e7c02894.549188","name":"","topic":"topic/status","qos":"0","datatype":"auto","broker":"db15ab6a.2297f8","x":598,"y":207,"wires":[["7cc2fdbc.4dbc44"]]},{"id":"3d03d032.27fc3","type":"debug","z":"e7c02894.549188","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":559,"y":363,"wires":[]},{"id":"7cc2fdbc.4dbc44","type":"switch","z":"e7c02894.549188","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ALIVE","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":718,"y":139,"wires":[["53383026.9f427","37fe4314.d466dc"]]},{"id":"53383026.9f427","type":"trigger","z":"e7c02894.549188","op1":"DEADquest","op2":"DEAD","op1type":"str","op2type":"str","duration":"40","extend":true,"units":"ms","reset":"ALIVE","bytopic":"all","name":"","x":130,"y":200,"wires":[["9e5cc363.add56"]]},{"id":"9e5cc363.add56","type":"switch","z":"e7c02894.549188","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"DEADquest","vt":"str"},{"t":"eq","v":"DEAD","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":230,"y":280,"wires":[["f88767e0.301628"],["3d03d032.27fc3","991552b7.efc5c"]]},{"id":"5c8d9d24.758444","type":"ui_toast","z":"e7c02894.549188","position":"top right","displayTime":"28","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":758,"y":329,"wires":[]},{"id":"991552b7.efc5c","type":"change","z":"e7c02894.549188","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"NO MQTT CLIENT DETECTED","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":565,"y":327,"wires":[["5c8d9d24.758444"]]},{"id":"24ed7dc3.c6b3f2","type":"inject","z":"e7c02894.549188","name":"","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":false,"onceDelay":0.1,"x":111,"y":75,"wires":[["53383026.9f427"]]},{"id":"37fe4314.d466dc","type":"debug","z":"e7c02894.549188","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":910,"y":139,"wires":[]},{"id":"db15ab6a.2297f8","type":"mqtt-broker","z":"","name":"Laptopwifi","broker":"192.168.137.1","port":"1884","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2019 17:16 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/2 "2019-03-18T17:16:24Z")

</div>

You have the trigger set to 40 milliseconds, so 40 milliseconds after receiving an input it will send DEAD. Is that what you meant?

---

<div class="post-metadata">

**Author:** ![domcsidd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domcsidd/32/5379_2.png) [@domcsidd](https://discourse.nodered.org/u/domcsidd)\
**Post date:** [18 March 2019 17:29 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/3 "2019-03-18T17:29:30Z")

</div>

I dont know that the time beween 2 "DEAD" sign is 40msec or more ... but it shouldn't send any , if my esp is communicating . am i wrong ? ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/53ca55870575a6be46b68d0ddab3278bd21dad2c.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2019 17:33 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/4 "2019-03-18T17:33:19Z")

</div>

How often are you expecting messages in? In the flow you posted the trigger is set to 40ms so if there is a gap of 40ms between messages it will send DEAD.

---

<div class="post-metadata">

**Author:** ![domcsidd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domcsidd/32/5379_2.png) [@domcsidd](https://discourse.nodered.org/u/domcsidd)\
**Post date:** [18 March 2019 17:53 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/5 "2019-03-18T17:53:22Z")

</div>

> [@Colin](#):
>
> er is set to 40ms so if there is a gap of 40ms between m

Ok maybe the 40msec is not enough ....

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2019 17:55 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/6 "2019-03-18T17:55:30Z")

</div>

How often are you expecting messages in?

---

<div class="post-metadata">

**Author:** ![domcsidd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domcsidd/32/5379_2.png) [@domcsidd](https://discourse.nodered.org/u/domcsidd)\
**Post date:** [18 March 2019 18:01 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/7 "2019-03-18T18:01:48Z")

</div>

i changed the value to 2sec , and now it works great . I expected the temperature values in 1000msec, and i wanted to check the communication at every pubish at the (topic/stop) from the server side, but i realized that it was to high expecting from the esp side . Thnaks for your help

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2019 18:02 UTC](https://discourse.nodered.org/t/mqtt-connection-status/9139/8 "2019-03-18T18:02:16Z")

</div>

Glad to be of help.
