Esphome intergration restoring its value

Hello,

i have a esphome device that measure my water usage.
it give me 2 values, 1 liter/min and a total water usage counter.

but when the device is restartet the total counter value is lost.
Can’t figure out how to restore this value or how to do this in home assistant.

this is what i have in hass

  - platform: pulse_counter
    name: "Flow rate"
    pin: GPIO5
    update_interval: 10s
    accuracy_decimals: 1
    filters:
    - lambda: return (x /380);
    unit_of_measurement: "L/min" 
    id: my_flow_meter


  - platform: integration
    name: "TotalWater verbruik"
    sensor: my_flow_meter
    time_unit: min 
    accuracy_decimals: 1
    unit_of_measurement: "L"

What type of esp board (ESP32 or 8266)?

sorry forget to mention, it’s an ESP32

i’m know looking to do it within home assistant with

  - platform: integration
    source: sensor.flow_rate
    name: total_water_usage_hass
    unit_time: min

but the value from ha and esphome aren’t the same :frowning:

  - platform: integration
    name: "TotalWater verbruik"
    sensor: my_flow_meter
    time_unit: min 
    accuracy_decimals: 1
    unit_of_measurement: "L"
    restore: true
  • restore ( Optional , boolean): Whether to store the intermediate result on the device so that the value can be restored upon power cycle or reboot. Warning: this option can wear out your flash. Defaults to false .

And is the value automaticly reloaded at startup, and jow often is it stored to memory.

Non of that information is stated in the manual.

It does answer your first question:

As to your second question, it is stored every time the state changes. This can be an issue for the esp8266 as it uses the limited flash available in the RTC and this can wear out fast. Not an issue for the ESP32.

Hey Tom,

I’m having this same issue with the HA integration not equaling ESPhome. I’m running it on a wemos D1 mini. It sounds like maybe I should upgrade to an ESP32 and just use the restore function?