# If input doesn't change in x seconds, then return msg. Else, don't return anything

**URL:** <https://discourse.nodered.org/t/if-input-doesnt-change-in-x-seconds-then-return-msg-else-dont-return-anything/61212>\
**Category:** General\
**Created:** [13 April 2022 02:12 UTC](https://discourse.nodered.org/t/if-input-doesnt-change-in-x-seconds-then-return-msg-else-dont-return-anything/61212 "2022-04-13T02:12:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightmareside15](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nightmareside15/32/56176_2.png) [@nightmareside15](https://discourse.nodered.org/u/nightmareside15)\
**Post date:** [13 April 2022 02:12 UTC](https://discourse.nodered.org/t/if-input-doesnt-change-in-x-seconds-then-return-msg-else-dont-return-anything/61212/1 "2022-04-13T02:12:53Z")

</div>

Hello. Is there a way to make sure I could achieve this condition. I am using a proximity sensor, which is connected to raspberry pi. There are times when the raspberry give me input even though the proximity doesn't detect anything ( for many reason, I believe), but I realize it happen so fast when normally the proximity would take some times before it changed it state due to the passing product. I think I could "filter" this condition if there is a node, or a function that make me able to give a minimum time before it passing the data to the main function.

Thank you very much.

Edit: In case of raspberry actually I found out that you could use internal resistor ( pull up or Pull down ) on the said pi, to reduce unwanted pulse to the GPIO. However now I realize that the said product actually had a color that actually cannot be detected as obstacle ( BLACK) on the middle side , which result in triggering the pulse twice in one product. The node or function filter might be needed after all).

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [13 April 2022 05:06 UTC](https://discourse.nodered.org/t/if-input-doesnt-change-in-x-seconds-then-return-msg-else-dont-return-anything/61212/2 "2022-04-13T05:06:02Z")

</div>

What is it sending to Node Red - is it a simple high/low 1/0 etc ?

I would suggest look at the filter or trigger nodes as being the closest to your needs

Craig

---

<div class="post-metadata">

**Author:** ![nightmareside15](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nightmareside15/32/56176_2.png) [@nightmareside15](https://discourse.nodered.org/u/nightmareside15)\
**Post date:** [13 April 2022 06:01 UTC](https://discourse.nodered.org/t/if-input-doesnt-change-in-x-seconds-then-return-msg-else-dont-return-anything/61212/3 "2022-04-13T06:01:12Z")

</div>

Well, that was quick lol. Yes the data is either 1 or 0. The trigger nodes works like magic! Thank you very much!!!

---

<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:** [27 April 2022 06:01 UTC](https://discourse.nodered.org/t/if-input-doesnt-change-in-x-seconds-then-return-msg-else-dont-return-anything/61212/4 "2022-04-27T06:01:17Z")

</div>

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