hugokernel / esphome-water-meter

Measurement of water consumption directly from your water meter with a TCRT5000 like sensor and ESPHome.
MIT License
64 stars 10 forks source link

Wich counter to use and how to set it #9

Closed acca84 closed 7 months ago

acca84 commented 7 months ago

Hi, My physical water counter gives me the consumption 777365Liters I'd like one counter to be equal to this number in order to check my measurements Which one should I use (main or primary) And how can i set it please ? Thanks

acca84 commented 7 months ago

I answer myself, if it could help someone : I added an api service "set_main_counter" to my water meter yaml :

api:
    services:
    - service: reset_main_counter
      then:
        - script.execute: reset_main_counter
    - service: reset_secondary_counter
      then:
        - script.execute: reset_secondary_counter
    - service: set_main_counter
      variables:
        my_count: int
      then:
        - globals.set:
            id: main_counter_pulses
            value: !lambda 'return my_count;'

after reflashing the esp32, the service is published to home assistant and can be called using developper tools