# How to identify bad data

**URL:** <https://discourse.nodered.org/t/how-to-identify-bad-data/97485>\
**Category:** General\
**Created:** [8 June 2025 15:53 UTC](https://discourse.nodered.org/t/how-to-identify-bad-data/97485 "2025-06-08T15:53:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [8 June 2025 15:53 UTC](https://discourse.nodered.org/t/how-to-identify-bad-data/97485/1 "2025-06-08T15:53:22Z")

</div>

I use node red to run my heating. I have two sensors hooked to esp8266 running mqtt. I average the readings together. Several weeks ago one sensor quit and the heater went full blast as one sensor was zero and the other wasn't. Lesson learned as I now check to make sure data is coming in. But... and I have pondered this a long while, how can I ensure it's good data? If one starts reading high or low, how would you know? I can check for crazy high or low by imposing limits but say it's only 10 degrees or so? Maybe it's just not reasonable and I accept the risk.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [8 June 2025 16:00 UTC](https://discourse.nodered.org/t/how-to-identify-bad-data/97485/2 "2025-06-08T16:00:34Z")

</div>

The principle is to have a data comparison. Let's imagine your temperature probe sends data every minute. What you need is to compare the received value with the 5 previous values ​​(5 minutes for example). If the comparison value does not exceed a certain threshold, it means the measurement is good, otherwise it is a false measurement (and therefore ignored).

Another principle: let's imagine that you turn the heating on at 18°C and off at 21°C. You will have a timeout (minimum duration), i.e. if you have 20°C at time x then 15°C at time x+1 then 20°C at time x+2..., your bad data (15°C) will be ignored because you only had 15° for 1 minutes instead of 5 (5 for example)

---

<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:** [8 June 2025 16:09 UTC](https://discourse.nodered.org/t/how-to-identify-bad-data/97485/3 "2025-06-08T16:09:29Z")

</div>

And you can use the smooth node to help with this. Send a copy of your inputs via the smooth node and saved to a flow variable.

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [8 June 2025 18:05 UTC](https://discourse.nodered.org/t/how-to-identify-bad-data/97485/4 "2025-06-08T18:05:28Z")

</div>

Got it, thanks

---

<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:** [22 June 2025 18:05 UTC](https://discourse.nodered.org/t/how-to-identify-bad-data/97485/5 "2025-06-22T18:05:48Z")

</div>

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