Replies: 3 comments 2 replies
-
As (temp)sensor drivers are written by different people they tend to implement their drivers differently as you noticed. The first assumption is the correct one; it should drop from JSON if SENSOR_MAX_MISS is reached. |
Beta Was this translation helpful? Give feedback.
-
There is no single "right" way of dealing with sensor read failures. Ideally, I'd prefer a single read error to invalidate current value, but in the real world this may not always be very practical, and the intent may actually have been that "last known good" is better than nothing, as most sensors are in slow-acting scenarios where some slop is no issue. I can't really recommend Tasmota for process control where some failure could be very expensive, as there may be requirements for certification to have insurance, or other legalese roadblocks. |
Beta Was this translation helpful? Give feedback.
-
This has been addressed in #19298 How do we add a build to the CI checks that includes some key compile directives eg USE_THERMOSTAT USE_PID and some of the sensors, because changes to this code isn't being checked in any of the current ones (I think) |
Beta Was this translation helpful? Give feedback.
-
All the temperature sensors' code have the similar but different approaches to marking a sensor as essentially dead - they compare a counter/flag to
SENSOR_MAX_MISS
and then the json code is supposed not to include that sensor anymore.I'm using an HDC1080 and when I disconnect to simulate a fault it is still be marked in json with valid data. The data is valid but incorrect - it's the previous reading. Definitely not the intent.
This is bad news in process control because drivers like the thermostat or PID controlled are trying to drive an output (heater for example) to get that sensor to a set point. Best case it's a waste of money trying to heat a room to 20C when it's constantly ay 16C. Worst case it's dangerous as the heater is on 100%
I think the logic is each sensor increments a count of invalid reads. After a good reading it resets to 0. When this gets to
SENSOR_MAX_MISS
(5) then it shouldn't include the sensor in it's output.Sound right?
If I've got this right I'm going to do some further debugging and submit a PR to fix it.
Beta Was this translation helpful? Give feedback.
All reactions