# Check for value changes

**URL:** <https://discourse.nodered.org/t/check-for-value-changes/69346>\
**Category:** General\
**Created:** [20 October 2022 19:35 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346 "2022-10-20T19:35:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crashy77](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Crashy77](https://discourse.nodered.org/u/Crashy77)\
**Post date:** [20 October 2022 19:35 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/1 "2022-10-20T19:35:53Z")

</div>

Hi.

I´ve an analogue input card and sometimes the values are stucking.  
I don´t know why. The i2c bus is running and finding the card.  
The problem is on all 4 inputs. After restarting the pi it´s working again.

How can I check for value changes? If they´re stucking that I can restart the Pi automatically.

Thanks in advance,  
Thorsten

---

<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:** [20 October 2022 19:49 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/2 "2022-10-20T19:49:33Z")

</div>

Start by feeding the value through a filter node, so you will only get a message when the value changes. Then feed that into a Trigger node set to Send Nothing, then Wait for a time, Then Send your alarm message. Also select Extend Delay on new message. Then provided messages keep coming in the Trigger node will send nothing, but if the value sticks, so no messages get to the Trigger node, then after the timeout it will send the alarm message.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [21 October 2022 08:57 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/3 "2022-10-21T08:57:56Z")

</div>

I don't think restarting the Pi is the correct solution.  
It sounds to me that the i2c bus hangs for some reason it's better to have a look at the problem.  
To help you we need some more info.  
What i2c node are you using? What device(s) are on the bus with what address?  
Can you show a small schematic how it's connected.

---

<div class="post-metadata">

**Author:** ![Crashy77](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Crashy77](https://discourse.nodered.org/u/Crashy77)\
**Post date:** [21 October 2022 11:56 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/4 "2022-10-21T11:56:05Z")

</div>

Here´s my i2c flow:  
 ![i2c_bus](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/646d8988fc6c7874ec365b1d22221c251f3d43b6.jpeg)  
At the beginning it was working and I´ve changed nothing.  
I´m controlling a sewage pump and shutters.  
But in the faulty situation no shutter is moving. It´s happing most at night, sometimes during the day.

---

<div class="post-metadata">

**Author:** ![Crashy77](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Crashy77](https://discourse.nodered.org/u/Crashy77)\
**Post date:** [30 October 2022 09:49 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/5 "2022-10-30T09:49:50Z")

</div>

Any ideas ?  
I´ve enabled i2c kernel tracing.  
Maybe I can see a difference in faulty situation.

---

<div class="post-metadata">

**Author:** ![Crashy77](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Crashy77](https://discourse.nodered.org/u/Crashy77)\
**Post date:** [20 November 2022 18:50 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/6 "2022-11-20T18:50:47Z")

</div>

I´ve seen today, that node-red was the reason for the stucking.  
Restarting I2c makes no change, but restarting node-red by stop/start.  
In the log files is no reason for the stucking.  
Baud rate is 400.000. Can this cause the problem ?

---

<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:** [19 January 2023 18:51 UTC](https://discourse.nodered.org/t/check-for-value-changes/69346/7 "2023-01-19T18:51:29Z")

</div>

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