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?|"
OSD
-
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!
OSD
-
@eiten said in Saving last known good state, but not in EEPROM:
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"
-
@OldSurferDude jus request counter states from controller on each reset, worked fine with Domoticz...
or save in eeprom but increase location every write, on power up/reset search eeprom for largest value stored and carry on from that location, one long integer will fit 256 times in atmega328(p) eeprom, is that long enough for you?
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Home Assistant/MySensors quirks
Development • 12 days ago • OldSurferDude 12 days ago -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
PJON and Minicore not working
Development • 7 days ago • Trand 7 days ago -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59