# Calculate hourly consumption

**URL:** <https://discourse.nodered.org/t/calculate-hourly-consumption/25035>\
**Category:** General\
**Created:** [17 April 2020 21:14 UTC](https://discourse.nodered.org/t/calculate-hourly-consumption/25035 "2020-04-17T21:14:44Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [18 April 2020 15:29 UTC](https://discourse.nodered.org/t/calculate-hourly-consumption/25035/13 "2020-04-18T15:29:06Z")

</div>

> [@Mrfox](#):
>
> To do the calculations in Node Red means that you for example use functions like Context?

Yes. I firstly convert the power reading (watts) into energy units (joules), then using context create a running total, which is set to zero at midnight.  
It's easily done with `node-red-contrib-watt2kwh`, but not hard to code in a function node.

> [@Mrfox](#):
>
> Are you getting energy in consumption from the meter or do you just get a meter stand like I do?

I built a device probably 5 years ago, that uses Current Transformer clamps on the power feeds (non-invasive) to measure usage, solar generation, diversion & mains voltage.  
The device uses a ATmega328p processor, runs constantly and feeds data to my Pi via RF.

I have created my dashboards in node-RED, and then imported the Grafana charts into it, so I never have to touch Grafana as all the queries are controlled from within node-RED. See [Contextmenu location - #45 by Paul-Reed](https://discourse.nodered.org/t/contextmenu-location/22780/45)

---

_[View the full topic](https://discourse.nodered.org/t/calculate-hourly-consumption/25035)._
