Fetching previous day's kWh/day via Node-RED

I’m working on a Node-RED flow to generate the send a push notification with the previous day’s kWh usage and the current day’s weather information. This is mostly working but there’s a data issue on power usage. While I have both a kWh accumulator and a kWh/day feed setup, the daily feed and standard node-red-emoncms node doesn’t quite fit my needs as I’m triggering the flow at mid-morning (local time, UTC-0700) at which point the current value is already a partial read for the current day (instead of the total value for the last day).

I could write a custom function in Node-Red, but then I have to deal with credential storage which is a bit more work than I was hoping to do. An alternative solution would be to extend the node-red-emoncms node to take msg.timestamp, though the emonCMS APIs don’t appear to have a super-straightforward way of getting an arbitrary historical entry from a feed (ranges look to be required).

Both approaches are doable, but I’d appreciate any insight from folks that may have tackled this before. Surely someone else is getting a discrete (non-graph based) report of kWh used per day for these sort of updates! :smile:

For anyone facing a similar challenge, my eventual solution to read the previous day’s total consumed kWh was to set up a flow within Node-RED to pull the value from the daily feed at 23:59 local, then store that to a file on the local emonBASE. My main flow reads that file in as part of building the mid-morning update.

I also something similar in Node Red. I use the Emon node , and then record the maximum values throughout the day and write them to MySQL table

Setup is

INJECT >>> EMON(Max Solar Watts) >>> rbe(Node that only allow for data that changes) >>> MySQL
I Record the Value and Time recorded , then I can draw a report that will show me the Max Solar Output for the day , Month and Year. But you could get any data from that. Same as @davidski at 23:58 I record the daily values as well.
Then I created a simple HTML page that shows the values in a email in the morning and also in emoncms dash.

Here is a Image of the Report.