Retaining hassio data and adding after esp8266 reboots

Hello,
i am after some help please
I have a pulse counter ( flow meter) sending messages over mqqt to hassio via a esp8266.

Every time the esp8266 is rebooted , the data count resets to 0 on the esp8266 , and sends it over to hassio which also resets to 0
i want the hassio entity that is recieving the data, to keep the total, and not reset , then when the esp8266 comes back up it needs to keep adding its data count to the hassio entity. so i end up with a total amout of litres used

i would also like a way of doing daily totals, weekly , etc
thankyou in advance


this is the entity within hassio

Need a lot more info.
What firmware are you using? What are your yaml entries?.

sensor watercount:

Water counter

  • platform: mqtt
    name: “Water_used”
    state_topic: “/EASY2/Waterflow/Total”
    qos: 2
    unit_of_measurement: “ltr”

not sure why you would need the firmware ?
i just want a way of keeping and adding my data recieved at sensor.water_used
everything is being recieved ok at the hassio interface.
esp82366 does not need to retain its data as long as hassio keeps a running count

hope this helps

In the firmware the esp8266 is running on you need to add retain to topic so that if esp reboots it will keep the values

ok thankyou ,
image

do i put it in the openhab MQTT page ?

sorry new to this stuff ?

Sorry not too sure about esp easy but think that sounds about right

ok will do thankyou Paul,
will this still keep a total even if it is sent zeros from the esp8266 ?

For your daily totals etc, you could look into the following.

Checkout the forums and how to use the above.

Retain retain: true in your yaml. I deleted that post as I believe I may be wrong. If it’s your firmware that’s resetting the figure then this entry in the yaml may not fix it.
Per @Johan_Erasmus post, may need to be done via your firmware.

But you could try,l. If it fixescit then great. If not then you’re no worse off.

i have added it to esp easy , under the advanced tools (there was a tick box mqqt retain topic) ,
although after a reboot counters have reset again, i was thinking there would be a way of just adding the mqqt data to a running total entity in hassio. maybe a new entity is needed with a formulae

Try the recorder per my post above.
There is also an influxdb and grafana addon you can use.

I use influxdb with grafana to display my solar history, daily/weekly etc.

thanks Paul , just had a look and wow doesnt look at all easy that way.
hopefully some other suggestions will come through with a simpler formula .

All good. I am working on an irrigation setup, and will use flow meters as well. Keen to also hear other options.