arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.12k stars 4.79k forks source link

Store "Total, Yesterday, Today and Period" telemetry values into persistent storage #3125

Closed andreibanaru closed 6 years ago

andreibanaru commented 6 years ago

Have you look for this feature in other issues and in the wiki? Yep

Is your feature request related to a problem? Please describe. If a Sonoff Pow device restart the counters for today_kwh and others will be reset to 0.

Describe the solution you'd like Store the counters into the persistent storage.

Describe alternatives you've considered N/A

Additional context For example below between 8 AM and 12 PM I have issued a reset of the sonoff pow and the counter went to 0 after boot start.

snip

(Please, remember to close the issue when the problem has been addressed)

arendst commented 6 years ago

This question comes up now and then and always receives the same answer: Invest some time in flash usage and you'll learn that saving changes every 5 minutes will lead your pow to heaven in no time.

See other closed issues about the same "problem".

Solution: let your Home Automation tool store values like Domoticz:

image

BTW ask yourself why your pows restart that often...

andreibanaru commented 6 years ago

Theo,

The restart of the sonoff was planned. Had to work on a wire. But this might happen during power outages too. I can overcome that reset to null value during a restart throught an optimized search in Splunk. Thanks for the heads up on the flash storage.

I have a second question - Can the same thing be achieved via MQTT? Like with the LWT messages. Sonoff to publish the values inside LWT and when it comes back online after a restart take the last value stored inside the brokers database.

What do you think?

arendst commented 6 years ago

Might be possible. Interesting idea...

Problem is that after a reboot WITHOUT an updated retained message would reset to the last retained message......

andreibanaru commented 6 years ago

Yep. We lose the recording between the last retained value and power down. In my case, I have TelePeriod = 30 so losing the power consumption for 30 seconds it's not that bad.

andrethomas commented 6 years ago

I pick it up through mqtt on node-red and push the results into a database. My tele period is 60 seconds though... this way I can store usage data per device for a very long period and run all kinds of queries against the sql database.

The other reason I push it to a mysql database is to perform some scripting to get week on week, month on month, year on year statistics...

So its 10AM now... what did I use by this time yesterday? Running lower or higher than usual... do we allow geysers to switch on if we're already using more elec than the day before, or if the average weekly usage on geysers have exceeded 10kw/day... Nice things you can do once you have the data in sql... you're limited only by your imagination

andrethomas commented 6 years ago

Ever so slightly different way of using the data, thats all.

image

andrethomas commented 6 years ago

image

ascillato2 commented 6 years ago

Hi

Seems that your question has been addressed. Closing this issue. Please, reopen if needed. Thanks