Open kristi5 opened 3 months ago
As far as I know, since I've been using it with custom sensor - it doesn't measure under 20 cm. Why it shows unknown under 25 instead of just showing 20 when under 20, I don't know. But yeah, it's an issue.
There several revisions and datasheets for this sensor. According to them the minimum range is from 20cm up to 25cm. However as long as the checksum is OK I believe we should allow lower values between 20 and 25 cm. @jesserockz should I make a PR for this?
Last minute update: in my case sensors sometimes throws a value lower than 25cm when there is an issue w/ measurement (garbage, echo etc). So for me, 25cm limit works just fine, so I withdraw the idea of PR.
According to me its not invalid data as the log msg suggest while the checkum is OK.
My water tank has highest level around 20cm from the top where the sensor is located. My experience is that sensors are returning 20cm for whatever shorter measurement which is still OK but no measurement at all is not ok.
In my case i will not get any measurement from the sensor (in HA its reported as unknown) and it may last for days or months unless the level in the tank drops below 25cm or more from the top.
So when i will not get any measurement from the sensor then i do not know if the tank is full or sensor stop working or is unavailable.
Any suggestion how to handle this no-measurement state in esphome?
If sensor sometimes throws wrong measurement (but with correct checksum) due to some echoes or unstable water level then filtering those values is task for sensor filters. The esphome sensor component jsn_sr04t should provide any valid (CRC OK) value anytime it is received from the hardware. Rest should be handled by the user inside yaml file.
The problem
I am using jsn_sr04t in mode 1 (continous measurement via serial) to measure water level in tank.
Shortest measured range in my sensor is around 220mm but any measurement below 250mm is not reported by the component. Instead the log contains lot of lines with
Invalid data read from sensor
.The component should consider any measurement which passed checksum control as valid and the measurement should be provided to HA.
Which version of ESPHome has the issue?
2024.4.2
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP8266
Board
esp01_1m
Component causing the issue
jsn_sr04t
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
Checked the code and there is fixed constant limiting that all measurements below 250 are considered as invalid.
Why the measurement is considered as invalid when the checksum control passed?