# Send message only when there is a change

**URL:** <https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523>\
**Category:** General\
**Created:** [31 May 2021 20:23 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523 "2021-05-31T20:23:39Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [2 June 2021 17:24 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/21 "2021-06-02T17:24:31Z")

</div>

I want a notification when it lose X weight. Now it was sending me one every second. But I want only send it to me once.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 17:27 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/22 "2021-06-02T17:27:30Z")

</div>

So you never want a second notification? What if it goes down 2X or increases then drops again?

---

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [2 June 2021 17:32 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/23 "2021-06-02T17:32:48Z")

</div>

Sorry, you are right

I need this notifications, but only if there is a big change.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 17:52 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/24 "2021-06-02T17:52:44Z")

</div>

What do you mean by 'big'?

---

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [2 June 2021 18:20 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/25 "2021-06-02T18:20:33Z")

</div>

More than 50%

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 19:51 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/26 "2021-06-02T19:51:14Z")

</div>

So if the first reading is 300, you won’t get a notification until the next is greater than 450 and the if the value drops you won’t get a notification until the number drops below 225?  
And if it drops again, a notification will happen when the number drops by 112.5 and then when it drops by 56.25, the by 28.125, then by 14.062 ...

Notice the values are getting smaller??

---

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [2 June 2021 20:12 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/27 "2021-06-02T20:12:00Z")

</div>

Yes, of course. It is for a farm pig. And I only need the notification for request more material. Then when it is drop to 300 kg or something like that, the system send a notification to the factory. But, at the moment, the system send me a notification every minute and I only want once the weight drop below 200 or a dynamic weight.

Thanks!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 20:18 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/28 "2021-06-02T20:18:50Z")

</div>

Well then use the `rbe` node. Add a bunch of injects with different values and test it out.

---

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [2 June 2021 20:37 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/29 "2021-06-02T20:37:20Z")

</div>

Do I add the injects in the RBE or where?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 20:51 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/30 "2021-06-02T20:51:18Z")

</div>

The `inject` nodes are to act as way for you to send test data thru your flow. I would suggest placing them where the data would be entering the flow. Then you can simulate actual data while you test `your` Flow’s logic

---

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [2 June 2021 20:55 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/31 "2021-06-02T20:55:55Z")

</div>

Thanks! Now I'm trying with this and it sendme every 30 seconds. Its possible that the issue is in timestamp?  
 ![Screenshot_7](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/31234a79fa3ed96b7726a830ccd264cb90f6c2c8.png)

 ![Screenshot_6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/897d80fb5a7780db145901667670d60e8f83518d.png)

I can't see the fail

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 22:39 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/32 "2021-06-02T22:39:36Z")

</div>

Try unchecking the “Apply mode for each msg.topic seperately” option

I don’t see any injects.

---

<div class="post-metadata">

**Author:** ![arzur](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@arzur](https://discourse.nodered.org/u/arzur)\
**Post date:** [3 June 2021 14:43 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/33 "2021-06-03T14:43:43Z")

</div>

Yes, because at this moment I was try another thing.

I got it, it works perfect!

Thank you so much!!! 😊

---

<div class="post-metadata">

**Author:** ![rene\_1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rene_1/32/42935_2.png) [@rene\_1](https://discourse.nodered.org/u/rene_1)\
**Post date:** [6 June 2021 12:45 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/34 "2021-06-06T12:45:04Z")

</div>

Hi Arzur,

Can you post the final result ?

Regards,

René.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 June 2021 12:45 UTC](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523/35 "2021-06-20T12:45:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/send-message-only-when-there-is-a-change/46523.md?page=1)
