# Calculate energy usage

**URL:** <https://discourse.nodered.org/t/calculate-energy-usage/78827>\
**Category:** General\
**Tags:** function-node\
**Created:** [30 May 2023 22:45 UTC](https://discourse.nodered.org/t/calculate-energy-usage/78827 "2023-05-30T22:45:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Espene](https://avatars.discourse-cdn.com/v4/letter/e/258eb7/32.png) [@Espene](https://discourse.nodered.org/u/Espene)\
**Post date:** [30 May 2023 22:45 UTC](https://discourse.nodered.org/t/calculate-energy-usage/78827/1 "2023-05-30T22:45:35Z")

</div>

Hi

I have solar panels who generate more power than I use.  
I have a node who gives me the value of produced power from solar panels, and a node who gives me the value of exported power to the grid. I want to calculate power usage of the house from these values.

Any ideas?

I have tried to put the values in context variables, but i cant seem to get it to work.

thx

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 May 2023 23:19 UTC](https://discourse.nodered.org/t/calculate-energy-usage/78827/2 "2023-05-30T23:19:52Z")

</div>

Can you provide the output from both of the nodes, use a debug to capture it.

---

<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:** [29 July 2023 23:20 UTC](https://discourse.nodered.org/t/calculate-energy-usage/78827/3 "2023-07-29T23:20:21Z")

</div>

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