Thanks Gordon. Slight tweak needed, as in your smart meter tutorial, you set it as a Uint32, so changing the 16 to 32 gave me a number that certainly looks like what I need (But its the total overall count I think, not for the day, so a little more work needed).
Would it be possible for you to explain, maybe in pseudo code or high level story, what you do in your example code from https://www.espruino.com/Smart+Meter?
I'm trying to figure out what it does at each step, so that I can find the best way to build historical data from it.
Looking at the Historical data part with the Counter, I was trying to see what you are doing with the years, months, days etc, but it does not make sense to me. Im totally new to storing data in byte format, so thats probably why it looks alien to me.
I get that I can just strip out all the code, and in fact just use the basic example code at the start of your tutorial, and just reset it every day, but I would like to understand how and why you took your approach.
I'm thinking btw that in node-red I would need to track the current minute and last value, and then when the value changes, note the time that happened, and then subtract the counter value from the last time it changed, to get the amount of counts for a given minute. And then store that in Firebase to build up a per minute usage. Or maybe thats overkill and it needs to be every 10 minutes. Does that sound logical to you? Again, totally new to IoT, and im a web developer, so thats where my thought process only comes from.