I fill a tank with water using Mycodo, and I stop the solenoid valve when the 2 states level sensor shows ON. But for unknown reasons, after a few seconds, it behave like the tank is full while the tank takes 9’ to fill.
I have to investigate for false contacts and so on. But in the time between, I have to deal with production.
The sensor returns 1.0 or 0.0 in the logs. Is it correct to take an avarage say on 5 values (sampling is 1 per second) and define a threshold at 4/5 = 0.8 and use this status instead of one sample?
Otherwise, what do you suggest?