Saving last known good state, but not in EEPROM

  • I'm working on a low cost energy meter for my heat pump. This meter would be similar to the meter on one's house, but for one device only.

    Currently my problem is storing the cummulative kWh in the likely event of a power outage. A quick search yields a heat pump can consume 2,000kWh a month. I don't wnat to live in such a place, but this is worst case. If I store each integer change in EEPROM, and the EEPROM is good for 100,000 writes, would mean about every 5 years and I have to replace the Arduino. At half that, I'd have to remember to replace the Arduino when the heat pump is replaced. This is not acceptable to me.

    I also have a water meter that suffers from this same challenge.

    My controller is Home Assistant (HA) and I am looking to see how I would have HA store this data and then the Arduino request it upon boot.

    I have experimented with storing the data on the MQTT broker, but have not done so sufficiently to determine if this method is viable. The mosquitto MQTT broker will restore retained data upon reboot, but, apparently not subscriptions. (I hope I am wrong on this.)

    OK, MySensors Universe, "Is there someone out there that has resolved this issue?|"


  • When you define a utility meter in home assistant, you can choose the last option: regular reset or something like this (my installation is in german, it says "Regelmässiges Zurücksetzen". If you activate this, the utility meter continues counting when the counter of the measuring device is reset to zero.

  • I have only an counter running on my water node increasing with each pulse. When counter changed, sending value to controller. Controller evaluates delta between current and last receive and adds delta to "water meter". No problem if either controller or sensor looses power.

  • I have considered this @karlheinz2000. In a typical case, both lose power at the same time. Then both do not know the count. 😞

    Thanks for the input!


  • @eiten said in Saving last known good state, but not in EEPROM:

    utility meter in home assistant

    This is exactly what I am seeking! Thank you!

    PS I truly enjoy reverse translating! It teaches me how to better understand my first language and it gives me alternate words to use in searches. So a second thank you!

    "Regelmässiges Zurücksetzen" would be best translated to English in this context as "Periodic Reset". In the English version of Home Assistant it is called "Meter reset cycle" (I remember seeing "keep dry" translated as "do not take in shower with you" 😉

Log in to reply

Suggested Topics