Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waterlezer: update to pulse_meter and add device_class #10

Open
dewi-ny-je opened this issue Apr 5, 2024 · 4 comments
Open

Waterlezer: update to pulse_meter and add device_class #10

dewi-ny-je opened this issue Apr 5, 2024 · 4 comments

Comments

@dewi-ny-je
Copy link

dewi-ny-je commented Apr 5, 2024

Hi, I think it's worth to update the waterlezer with the improved platform "pulse_meter", see https://esphome.io/components/sensor/pulse_meter.html

Something like (please check!)

  - platform: pulse_meter
    pin: 
      number: 5
      mode:
        input: true
        pullup: true #v3.5 aanzetten
    id: watermeter_pulse
    name: "Watermeter flow"
    state_class: measurement
    device_class: "volume_flow_rate"
    update_interval: 5s # generates one reading per 5s, no need to spam HA, to be passed to filters (if I got it it right)
    internal_filter: 500ms # at max flow, one pulse every 800ms anyway
    timeout: 1min
    accuracy_decimals: 0
    unit_of_measurement: 'L/min'
    filters:
        - delta: 0 # pass through the value only if something changed, delta ">" 0
        - heartbeat: 300s # at least ping a value every 5 min
    total:
        name: "Watermeter total"
        state_class: "total_increasing"
        device_class: "water"
        icon: mdi:water
        update_interval: 5s
        unit_of_measurement: L
        accuracy_decimals: 0
        filters:
            - delta: 0.1 # avoid sending identical readings. One pulse = 1, so pass anything ">=" 0.1
            - multiply: 0.001
            - heartbeat: 300s

api:
  services:
    - service: set_total
      variables:
        new_total: int
      then:
        - pulse_meter.set_total_pulses:
            id: sensor_pulse_meter
            value: !lambda 'return new_total * 1000;' # untested, still waiting for your device to arrive

and no globals needed to be updated via lambda (or maybe needed for restoring from flash?)

@mhendriks
Copy link
Owner

thanks for the hints. I tried it before but there was a problem with the total counter when using the pulse_meter. I will try it again with the config above.

@dewi-ny-je
Copy link
Author

It's untested. As soon as I get mine I'll test it.

@mhendriks
Copy link
Owner

I am curious , any test results?

@dewi-ny-je
Copy link
Author

I installed it but I'm using almost only the total counter, so given the number of projects I have in the queue the priority for improving the realtime flow indicator is low and I haven't touched it. In fact, I still have to hot-glue the white holder to ensure reliable readings, which comes first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants