Question for a device to remove out-of-bounds results from another driver?

So I thought I'd read about this somewhere, but I can't find it now.

Is there a way to subscribe to an event from another driver, do some calculations on the value compared to other values, then throw away "bad" values?

I have a humidity sensor that will return things like 55, 54, 56, 55, 55, 54, 52, then -124, then 55, 53, etc. Is there an easy way to filter the bad values? I figured a driver that reads the values, then checks them for sanity, then saves them if they are OK. Is there anything like that?

A driver doesn't have direct access to other devices--you need an app for that. If you have access to the code for the "original" device, knowledge of why it sends those values, or even better both, then I think that would be the best place to address this so you don't have to worry about it at all. As-is, I'd say the best option would be to have a virtual (or custom) device and an app that subscribes to events from the "real"/problematic device and generates only the "truthful" events on the virtual/other device by manipulating the appropriate attribute(s) when needed.

You could even do this with a virtual device and a rule, no real custom code needed.


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