# Calculate accumulated price based on power consumption

**URL:** <https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771>\
**Category:** General\
**Created:** [6 July 2022 15:36 UTC](https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771 "2022-07-06T15:36:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FSHelgeland](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fshelgeland/32/64260_2.png) [@FSHelgeland](https://discourse.nodered.org/u/FSHelgeland)\
**Post date:** [6 July 2022 15:36 UTC](https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771/1 "2022-07-06T15:36:00Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/35d8f264742f6c1860158550fcbc9c2731663aa9.png)  
I got this feed provided from Tibber, my power consumption accumulated for the last hour. I also have the price for the power. The price is without all the taxes so i added them and i then recieve the price as well. The price is updated pr 60 seconds, and the accumulated power consumption is updated every 1.5 second. My goal is to calculate the cost for every hour, and sum them as the hours pass. Example the first hour from midnight to 01.00 I have been using 3kWh, and the price was 0.50 Nok, calculated it will be 1.50, if that repeats itself the next hour then I am interesting in 1.50 NOK +1.50 NOK

Most of this is ok to do, my main problem is how to trigger the accumulated consumption every minute for one specific hour. Hope you understand my question.

Best regards Freddy.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [6 July 2022 15:47 UTC](https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771/2 "2022-07-06T15:47:53Z")

</div>

I've used this node in my home-energy monitoring system to calculate my kWh and daily consumption..

> **[node-red-contrib-watt2kwh](https://flows.nodered.org/node/node-red-contrib-watt2kwh)**
>
> A node-RED node that converts a power feed (watts) to energy (kWh).

---

<div class="post-metadata">

**Author:** ![FSHelgeland](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fshelgeland/32/64260_2.png) [@FSHelgeland](https://discourse.nodered.org/u/FSHelgeland)\
**Post date:** [6 July 2022 19:36 UTC](https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771/3 "2022-07-06T19:36:40Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/50c9ca532eb2f608e0df391773e9f657f49d1f89.png)  
I came up with this and this works. I get the values I want and they get multiplided. But the next big issue is, how can i sum all the results. Beacause in the end of the day I want to have the sum for all 24 hours. And it have to restart every day as well, as soon as one thing is solved another question pops up. Hope anyone can lead me into the right direction though.

---

<div class="post-metadata">

**Author:** ![FSHelgeland](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fshelgeland/32/64260_2.png) [@FSHelgeland](https://discourse.nodered.org/u/FSHelgeland)\
**Post date:** [6 July 2022 22:13 UTC](https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771/4 "2022-07-06T22:13:23Z")

</div>

Solved it with the [node-red-contrib-sum (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-sum) node.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 July 2022 22:14 UTC](https://discourse.nodered.org/t/calculate-accumulated-price-based-on-power-consumption/64771/5 "2022-07-20T22:14:15Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
