# How to spot a static change properly? (noob question)

**URL:** https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313
**Category:** General
**Tags:** function-node
**Created:** [16 February 2023 20:28 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313 "2023-02-16T20:28:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)
#### Post date: [16 February 2023 20:28 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313/1 "2023-02-16T20:28:41Z")

</div>

for a number of Zigbee devices, I check if the device is offline, if offline - send a notification.  
My method today is:

 ![Screenshot from 2023-02-16 21-21-08](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ecfcfb3cbae0c989e742b5769890873c8c79ae2d.png)  
 ![Screenshot from 2023-02-16 21-20-32](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c059d6351098c81c997642c94ee0f3890570682.png)

The "problem" is that I really would like the logic to be for each device:  
if (offline\_time \> 24h) then notify.  
I guess the answer is not to duplicate the function node for each element and program the logic into it like I did?  
if there another node I should use that can do the:  
if (msg.payload === "offline" and its\_bee\_offline\_for \> 24h) then ....

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [16 February 2023 21:35 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313/2 "2023-02-16T21:35:47Z")

</div>

I think that this is what you want?

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

~~Just not quite certain it will handle things in the right order without trying.~~ OK, just tested and it does indeed do exactly what you want.

Also, you may not need multiple MQTT inputs, you may be able to use wildcards.

---

<div class="post-metadata">

### Author: ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)
#### Post date: [17 February 2023 21:44 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313/3 "2023-02-17T21:44:06Z")

</div>

It seems this "trigger node" must be insterted after my "function node"?

- or can my "function node" somehow be simplified/moved into something simpler?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 February 2023 22:03 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313/4 "2023-02-17T22:03:26Z")

</div>

No, I don't believe you need a function node at all. The trigger node does everything.

---

<div class="post-metadata">

### Author: ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)
#### Post date: [17 February 2023 23:08 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313/5 "2023-02-17T23:08:54Z")

</div>

Thank you

---

<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: [3 March 2023 23:09 UTC](https://discourse.nodered.org/t/how-to-spot-a-static-change-properly-noob-question/75313/6 "2023-03-03T23:09:00Z")

</div>

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