ESPHome, Filter out bad dallas temp readings

Well that reply was of no help.

But for anyone looking for a way to only send data within a range here’s what I was able to come up with

  - platform: dallas
    address: 0x130516A1A2C9FF28
    name: "Pool Temperature"
    unit_of_measurement: "°F"
    filters:
    - lambda: |-
        float MIN_VALUE = 1.0;
        float MAX_VALUE = 50.0;
        if (MIN_VALUE <= x && x <= MAX_VALUE) return x * (9.0/5.0) + 32.0 + 0.1;
        else return {};

I used “* (9.0/5.0) + 32.0 + 0.1” only convert to Fahrenheit, so just remove that calculation.

3 Likes