I am feeding readings from my smart-power-meter into HA using the DSMR component, and it works nicely. For some time now I have sent myself a notification at midnight to send the meter readings, so that I can add those to a spreadsheet keeping track of daily power usage totals and do some calculations with them.
However, I am lazy and/of forgetful, so the spreadsheet remains largely empty. It must be possible to do something like this in home automation completely and write a line to file or a google doc, or some other form of output, but I do not know how to keep track of the meter readings as they were at 00:00:00 of a given day and compare/calculate the difference with the meter readings 24 hours later.
I have two meters,
Meter 1: measures from 7 am until 11 pm.
Meter 2: measures from 11pm until 7 am
There are different tariffs for each meter.
So, I am thinking:
At everyday at midnight, store the values of meter 1 and meter 2 in separate variable. Then, at 23:59:59 read those meter values again.
Then, subtract the two values for each meter so that whats left is the consumed power in the past 24 hours.
And finally I would like to end up with a file or spreadsheet or something where every day a new line is appended in the following format:
<consumed pwr meter 1><cost consumed power meter 1><consumed pwr meter 2><cost consumed power meter 2>
Is that possible in an automation, or should I make a script or something? Once I have all those values, I can figure out a way to use ifttt to write it to a google sheet, but I do not know how to keep track of those readings for 24 hours…
Any tips in the right direction is welcome!