There are several problems with this – not the least that constantly storing the value in mem will quickly wear the flash memory out.
Tasmota stores the values in Wh (but displays in kWh).
Due to the wearing out of flash memory, If you have ‘numerous’ devices I think your best bet would be to persist the results in something like openHAB or a MySQL database and restoring from there.
Phil
Sent from Mail for Windows 10
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/6efac179-d5bd-42dc-8287-80860082b74en%40googlegroups.com.
The original post was saving consumption to flash on every teleperiod
From: LBuch
Sent: 04 July 2021 17:20
To: TasmotaUsers
Subject: Re: Make Sonoff POW R2 redundant to power loss
Re wearing out the flash. I thought only the Mem variables were written to the flash and not the Var variables. Was I mistaken??
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/c82cdfa1-e9b7-463a-8190-feb602630cf8n%40googlegroups.com.
Rule1
ON tele-ENERGY#Today DO backlog Var1 %value%; mult1 1000; Mem1 %Var1%
ENDON
ON Power#Boot DO
energyreset1 %Mem1% ENDON
Will see how quickly it will wear out the flash, but a teleperiod of 10mins means about 50K writes a year and a good quality flash should be able to handle 1M write/read cycles, so that's 20 years. Anyhoo, I'm willing to take the chances thanks to Sonoffs being inexpensive.
As I'm only using the TODAY value for my energy monitoring, I'm currently not concerned about the TOTAL value, but I guess it could be handled somehow by subtracting Mem1 from TOTAL at Reboot.
Thanks again, M