# Getting kWh measurements with Watt

**URL:** <https://community.homey.app/t/getting-kwh-measurements-with-watt/59218>\
**Category:** Questions & Help\
**Created:** [January 27, 2022, 8:18am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218 "2022-01-27T08:18:05Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tukun](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tukun/32/14477_2.png) [@Tukun](https://community.homey.app/u/Tukun)\
**Post date:** [January 27, 2022, 8:18am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/1 "2022-01-27T08:18:05Z")

</div>

Hi there,

I have got some help integrating my PV inverters to Homey, however the information about the kWh is not available through the inverter so I have only got wattage. Is there anything I can use to get kWh total through the day? I thought I could use the Power by the Hour app but I can’t since there is no kWh output.

Any help would be very appreciated!

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/a/fa6201fe5c2ed9f629710c16736cf093a56d76c0.png)

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 27, 2022, 8:54am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/2 "2022-01-27T08:54:18Z")

</div>

The most future proof solution is to contact the developer and do a feature request.

Other than that, maybe you can do something with the virtual device app?

---

<div class="post-metadata">

**Author:** ![peltsi51](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peltsi51/32/12564_2.png) [@peltsi51](https://community.homey.app/u/peltsi51)\
**Post date:** [January 27, 2022, 10:49am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/3 "2022-01-27T10:49:39Z")

</div>

Make the calculation with variables.

Flow

When  
Every 1 minute

Then  
Calculate _power_/1000/60+_energy_=_energy_

---

<div class="post-metadata">

**Author:** ![Tukun](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tukun/32/14477_2.png) [@Tukun](https://community.homey.app/u/Tukun)\
**Post date:** [January 27, 2022, 12:58pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/5 "2022-01-27T12:58:18Z")

</div>

I did that:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/d/4d2e0e5486ed9c51c8089adeab910b1ca29d8fa2.png)

---

<div class="post-metadata">

**Author:** ![Tukun](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tukun/32/14477_2.png) [@Tukun](https://community.homey.app/u/Tukun)\
**Post date:** [January 27, 2022, 12:58pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/6 "2022-01-27T12:58:48Z")

</div>

Not sure if I do understand.  
Could you please share a flow I could use?

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 27, 2022, 1:19pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/7 "2022-01-27T13:19:33Z")

</div>

Yes, he is the developer of Power app but you would need to contact de developer of the solar app. The PofH app is working fine, but has some restrictions.

---

<div class="post-metadata">

**Author:** ![Tukun](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tukun/32/14477_2.png) [@Tukun](https://community.homey.app/u/Tukun)\
**Post date:** [January 27, 2022, 1:53pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/8 "2022-01-27T13:53:06Z")

</div>

But I am not using the solar app

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 27, 2022, 2:04pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/9 "2022-01-27T14:04:35Z")

</div>

Which app provides the solpanel devices?

---

<div class="post-metadata">

**Author:** ![Tukun](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tukun/32/14477_2.png) [@Tukun](https://community.homey.app/u/Tukun)\
**Post date:** [January 27, 2022, 2:32pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/10 "2022-01-27T14:32:27Z")

</div>

No app, had some help making a homey script.  
It works like this:  
Measure\_power is a property from a device that accepts Watts as value. Its a virtual device rather than a Solar panel app.  
In short the HTTP get JSONpath does the XML grab. the string goes to the tree xml and grabs array number [2] which is your watt value and inserts that in to variable in Better Logic.  
Then the flow at when variable changed (better logic) it will update the measure\_power attribute of steca 1 or 2 to that number and there you are.

It is from xml provided from the inverters. However, only watt is present and not kWh.

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 27, 2022, 2:43pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/11 "2022-01-27T14:43:07Z")

</div>

Maybe you can do some calculations in your homey script?

---

<div class="post-metadata">

**Author:** ![peltsi51](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peltsi51/32/12564_2.png) [@peltsi51](https://community.homey.app/u/peltsi51)\
**Post date:** [January 27, 2022, 4:31pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/12 "2022-01-27T16:31:20Z")

</div>

[https://homey.app/f/R-4osW](https://homey.app/f/R-4osW)

The question mark in the flow is Energy variable. Same as the calculated outcome.

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 27, 2022, 5:50pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/13 "2022-01-27T17:50:42Z")

</div>

Yes but the outcome cannot be used with power by the hour.

---

<div class="post-metadata">

**Author:** ![peltsi51](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peltsi51/32/12564_2.png) [@peltsi51](https://community.homey.app/u/peltsi51)\
**Post date:** [January 27, 2022, 7:56pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/14 "2022-01-27T19:56:55Z")

</div>

If you make a virtual device and input the power and energy that device can be used by the power by the hour app.

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 27, 2022, 9:27pm UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/15 "2022-01-27T21:27:50Z")

</div>

Yes perhaps that’s possible, I’d say it would be cleaner to solve this with the scripting, but is it works and the topic starter is okay with it 👌

---

<div class="post-metadata">

**Author:** ![Tukun](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tukun/32/14477_2.png) [@Tukun](https://community.homey.app/u/Tukun)\
**Post date:** [January 28, 2022, 8:09am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/16 "2022-01-28T08:09:40Z")

</div>

How could it be solved with a script?

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [January 28, 2022, 8:20am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/17 "2022-01-28T08:20:41Z")

</div>

Well, you created the homey script script… so you tell me

---

<div class="post-metadata">

**Author:** ![Gruijter](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gruijter/32/1973_2.png) [@Gruijter](https://community.homey.app/u/Gruijter)\
**Post date:** [January 28, 2022, 8:25am UTC](https://community.homey.app/t/getting-kwh-measurements-with-watt/59218/18 "2022-01-28T08:25:31Z")

</div>

> [@peltsi51](#):
>
> Every 1 minute
> 
> Then  
> Calculate _power_ /1000/60+ _energy_ = _energy_

Put this in your script…  
But make sure the energy is persistent after a script/homey restart 🤔
