# Node-red repeat msg.payload in dashboard

**URL:** <https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804>\
**Category:** General\
**Created:** [4 May 2019 12:20 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804 "2019-05-04T12:20:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![florent](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@florent](https://discourse.nodered.org/u/florent)\
**Post date:** [4 May 2019 12:20 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804/1 "2019-05-04T12:20:08Z")

</div>

Good evening,

I don't understand why.  
Node-red repeat many times each msg.payload message in my dashbord.  
eg:

_Function_  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a2f418a9dd64e196bec6815a77d27e8df875e4cb.png)

```auto
d = new Date() 
p = msg.payload.event
i = msg.payload.nodeid
// t = msg.payload.uuid
/* t = msg.topic */

if(p===0 && i == "4"){
    o = "Porte fermée";
}
if(p===255 && i == "4"){
    o = "Porte ouverte";
}
if(p===0 && i == "9"){
    o = "Aucun liquide detecte";
}
if(p===255 && i == "9"){
    o = "Liquide detecte";
}

msg.payload = o + " " + d;

return msg

```

And the result in Dashboard is:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8662095b764cd189c6d04cf05a4874b8099041c6.png)

Somebody could help me ?  
Thank you

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [4 May 2019 12:24 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804/2 "2019-05-04T12:24:53Z")

</div>

Add a debug to your zwave node to check that you aren’t getting duplicate messages.

You can also give your debug nodes a name to make it easier to see where they are coming from.

---

<div class="post-metadata">

**Author:** ![florent](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@florent](https://discourse.nodered.org/u/florent)\
**Post date:** [4 May 2019 12:32 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804/3 "2019-05-04T12:32:28Z")

</div>

you're right..  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b1da60e7ef2ff3a52049be06deb6159ea01ce740.png)

Give..

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f29b008240c7e281a4915df00c358140211d4f79.png)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [4 May 2019 12:39 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804/4 "2019-05-04T12:39:11Z")

</div>

If you change the debug to display the complete message object you should be able to filter the messages based on msg.topic and part of the msg.payload.object using switch nodes

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 May 2019 14:51 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804/5 "2019-05-04T14:51:44Z")

</div>

If they are exact duplicates then the RBE node will remove the extra ones for you.

---

<div class="post-metadata">

**Author:** ![florent](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@florent](https://discourse.nodered.org/u/florent)\
**Post date:** [5 May 2019 15:02 UTC](https://discourse.nodered.org/t/node-red-repeat-msg-payload-in-dashboard/10804/6 "2019-05-05T15:02:30Z")

</div>

Thank you ukmoose and dceejay for your help, it's appreciate

ukmoose:  
I tried that, but msg.topic and msg.payload.object seem to be identical between the detector of open/close door and the detector of water.

dceejay  
Good suggestion, i didn't know that, but I have found another solution that seem to work.  
I modified my function like:

d = new Date()  
p = msg.payload.event  
i = msg.payload.nodeid

if(p===0 && i == "4"){  
o = "Porte fermée le " + d;  
msg.payload = o;  
return msg;  
}  
if(p===255 && i == "4"){  
o = "Porte ouverte le " + d;  
msg.payload = o;  
return msg;  
}  
if(p===0 && i == "9"){  
o = "Aucun liquide detecte le " + d;  
msg.payload = o;  
return msg;  
}  
if(p===255 && i == "9"){  
o = "Liquide detecte " + d;  
msg.payload = o;  
return msg;  
}

And it works well 😉
