Ignore Input if out of bounds before adding it to Feed

Is there a way I can check if an Input is within certain bound before I add it to a feed? Every now and then my temperature sensor gives me a weird reading and I want to ignore anything that is say outside of -50C to +50C

Is it one of the ‘fault’ values - 85 °C or ≥300 °C ? If so, then depending on the sketch, the number should give some indication of the actual fault.

Yes it is. But when I get that value, how do I ignore it from being added to a feed?

As your error values are large and positive, you could add -50 (i.e. subtract 50), allow negative, then add 50.

It implies that it will block a positive (i.e. the number you first thought of is greater than 50), but a quick test on emoncms.org shows that ‘allow negative’ actually clips a positive to zero, rather than not passing any value forwards. Therefore, your error values will be clipped at 50. As far as I know, that’s the best it will do.

@TrystanLea, @glyn.hudson
It could be helpful to clarify this in the notes.

So a 300C will instead be reported as 50C? Maybe an Input validation engine
may not be such a bad idea then. Should be fairly easy to implement, all
you need to do is check if an Input is within two numbers before accepting
it. Otherwise ignore it. @TrystanLea
https://community.openenergymonitor.org/u/trystanlea, @glyn.hudson
https://community.openenergymonitor.org/u/glyn.hudson

Have you tried using ‘Conditional - user value’ as a input process, for example;

skip

I’m sure with a bit more thought, upper and lower boundaries could be applied, especially using the GOTO input process.

Paul

Edit > Just advised by @Robert.Wall that those processes have for some reason not yet been added to emoncms.org yet, thanks Robert.

But isn’t the real problem that those error codes are being generated in the first place? They are usually an indication of a wiring fault on the One-wire bus.

I’ve seen 2 of those errors in 2 years of an untouched emon. And it’s doing a measurement every 10 seconds. So I didn’t think it was anything to do with the wiring. Also it’s usually quite a long time later that you realise that you have one of these. But a single one of these errors, causes the entire graph scales to go off. Hence wanted to avoid them all together.

Wouldn’t such a feature also be useful for ignoring any small valued inputs (noise) that appear on the CT inputs.