# Unknown power to tag

**URL:** <https://community.homey.app/t/unknown-power-to-tag/69593>\
**Category:** Questions & Help\
**Created:** [September 29, 2022, 5:34am UTC](https://community.homey.app/t/unknown-power-to-tag/69593 "2022-09-29T05:34:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Techniman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/techniman/32/8654_2.png) [@Techniman](https://community.homey.app/u/Techniman)\
**Post date:** [September 29, 2022, 5:34am UTC](https://community.homey.app/t/unknown-power-to-tag/69593/1 "2022-09-29T05:34:02Z")

</div>

Does anyone know if its possible to get the “unknown power” into a variable or tag?

I have most of my plugs monitored with the exception of the stove and pump, I’d like to calculate /guesstimate the draw of these items but I really don’t want to manually add all the known items together…

While writing this I’m thinking there might be a homeyscript solution for this, any help is appreciated.

 ![Screenshot_20220929-072526_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/5/d51e883c7586241c1d4db325e721db1f33da9dc8.jpeg)

---

<div class="post-metadata">

**Author:** ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)\
**Post date:** [September 29, 2022, 7:08am UTC](https://community.homey.app/t/unknown-power-to-tag/69593/2 "2022-09-29T07:08:01Z")

</div>

The top value is all the values added together for the selected zone, which in the image above is Home, so the whole house.  
So, the simple calculation is to subtract the measured power total (on the top) from the smart meter power (on the bottom), 4kW - 2.84kW = 1.16kW.  
Sorry it doesn’t answer your question about getting the values into variables.

---

<div class="post-metadata">

**Author:** ![Techniman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/techniman/32/8654_2.png) [@Techniman](https://community.homey.app/u/Techniman)\
**Post date:** [September 29, 2022, 7:18am UTC](https://community.homey.app/t/unknown-power-to-tag/69593/3 "2022-09-29T07:18:29Z")

</div>

> [@Adrian\_Rockall](#):
>
> m t

Thanks Adrian, I’m aware what the calculation would be, I was hoping for a ready-made solution to get this information instead of calculating it myself.

---

<div class="post-metadata">

**Author:** ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)\
**Post date:** [September 29, 2022, 7:29am UTC](https://community.homey.app/t/unknown-power-to-tag/69593/4 "2022-09-29T07:29:27Z")

</div>

Using the Web API, you can get the values with `Homey.energy.getLiveReport();`  
If you go to [Homey Developer Tools](https://tools.developer.homey.app/tools/api-playground) and enter that line in the Request box, then click on Run you will see the returned data.

---

<div class="post-metadata">

**Author:** ![Techniman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/techniman/32/8654_2.png) [@Techniman](https://community.homey.app/u/Techniman)\
**Post date:** [September 29, 2022, 8:22am UTC](https://community.homey.app/t/unknown-power-to-tag/69593/5 "2022-09-29T08:22:58Z")

</div>

I’ll have a look at that one, in the meantime ive created a homeyscript and running it every 15 seconds

```auto
let devices = await Homey.devices.getDevices();
let tmp = 0 ;
let dv = "" ;
let p1 = 0 ;

//for ech device
Object.values(devices).forEach(device => {

//set name to var
dv = device.name;

//if name matches P1 e.g. the device that registers the powerdraw set the p1 variable otherwise add it to the tmp variable
if(dv!="P1 Meter"){
tmp = tmp + device.energyObj.W ;
}
else{
p1 = device.energyObj.W ;
}
});

//calculate the known usage from the total
let missing = (p1 - tmp ) ;
//todo add some rounding
//missing = missing * 100 ;
//missing = missing

console.log("totaal verbruik : " + p1);
console.log("totaal gemonitored : " + tmp);
console.log("totaal gemist : " + missing );
await tag('unknown power', missing);
return true ;
```

edit, it seems your “livereport” suggestion is much quicker, created this one now  
Thanks!

```auto
let power = await Homey.energy.getLiveReport();
console.log(power.totalConsumed.W) ;
console.log(power.totalCumulative.W) ;
let missing = (power.totalCumulative.W - power.totalConsumed.W)
console.log(missing) ;
await tag('unknown power', missing);
return true ;
```

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [September 29, 2022, 12:55pm UTC](https://community.homey.app/t/unknown-power-to-tag/69593/6 "2022-09-29T12:55:13Z")

</div>

Take a look at the Power by the Hour app. To me it is way more convenient and ‘usable’.

> [@\[APP\]\[Pro\] Power by the Hour: Insights per hour, day, month and year](https://community.homey.app/t/app-pro-power-by-the-hour-insights-per-hour-day-month-and-year/20535):
>
> Appstore stable version: [Power by the Hour App for Homey | Homey](https://homey.app/a/com.gruijter.powerhour) Appstore test version: [Power by the Hour App for Homey | Homey](https://homey.app/a/com.gruijter.powerhour/test)Power by the Hour Get data from a Homey power/gas/water meter device, and show the usage / production per hour, per day, per month and per year. Know the monetary value and use dynamic tariffs. Know how much your Always-on appliances are using and safe hundreds of Euros per year! This app can be used for instance together with the Enelogic and Youl…

---

<div class="post-metadata">

**Author:** ![Techniman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/techniman/32/8654_2.png) [@Techniman](https://community.homey.app/u/Techniman)\
**Post date:** [September 30, 2022, 8:34am UTC](https://community.homey.app/t/unknown-power-to-tag/69593/7 "2022-09-30T08:34:33Z")

</div>

Thanks but thats not what i’m looking for, I have PBtH already installed.  
I want to see if i can come up with some logic to keep track of the pump/boiler and the stove.  
e.g. between 17.00 and 19.00 if the “missed” power is higher than 2K it’s likely someone is cooking
