esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Mopeka Pro Check Discarding Data #4145

Open dejab opened 1 year ago

dejab commented 1 year ago

The problem

The Mopeka component is not reporting a tank level when the reading quality is 33%. The data is still present and valid in logs, but ESPHOME is not returning the value. The component should only report a null value for the tank level once the reading quality is 0%. This is different from the behavior of the Mopeka app as it reports the data when the reading quality is 33%.

The sensor code discards data from the Mopeka Sensor that is marked as QUALITY_LOW (1 Star) The Mopeka App accepts and displays 1-star data quality.

Which version of ESPHome has the issue?

2022.12.8

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.2.3

What platform are you using?

ESP32-IDF

Board

No response

Component causing the issue

esphome/components/mopeka_pro_check/mopeka_pro_check.cpp

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Lines 73 - 80 of mopeka_pro_check.cpp

if (quality_value < QUALITY_HIGH) {
  ESP_LOGW(TAG, "Poor read quality.");
}
if (quality_value < QUALITY_MED) {
  // if really bad reading set to 0
  ESP_LOGW(TAG, "Setting distance to 0");
  distance_value = 0;
}
phurth commented 1 year ago

I'll second this. The current code appears to discard any reading with less than 2 out of 3 quality "stars". I don't know if there are 3 or 4 possible quality readings (where zero stars would be the 4th). Assuming there are, it might be better if the code were something like "if (qualityvalue < QUALITYLOW)...". Even better would be to not update the sensor to 0 if you get a bad reading - just don't update it at all. That way you'd just retain whatever the last value was and usually these quality drops are transient. That appears to be what the native Mopeka app does.

thenotoriousdrr commented 1 year ago

I too have this issue. Nothing much to contribute, just trying to bump the thread.

spbrogan commented 10 months ago

I will try to find some time to review this PR again and get it ready to merge. https://github.com/esphome/esphome/pull/4928

deon-dup commented 1 week ago

Read about this issue, and thought it has been resolved. I agree with the data quality being available, so one can perhaps override the reset to zero, if data quality is low. I don get readings, have applied the sensor correctly as the App indicates as such, but through my ESP32Dev, I cannot get readings, because it is reset to zero. Any advice?