# How does Homey process power measurements via setCapabilityValue?

**URL:** <https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086>\
**Category:** Developers\
**Created:** [September 18, 2022, 7:13pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086 "2022-09-18T19:13:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbrattla](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sbrattla/32/47880_2.png) [@sbrattla](https://community.homey.app/u/sbrattla)\
**Post date:** [September 18, 2022, 7:13pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/1 "2022-09-18T19:13:49Z")

</div>

I’m writing an app which represents a thermostat. The thermostat measures power, and reports the power usage on a daily basis. That is, the most fine grained power measurement I can get from the thermostat is the daily consumption.

I poll the thermostat every n minutes to retrieve power measurements.

I would like to report power measurements to Homey using setCapabilityValue(‘measure\_temperature’, value’), but it is not clear to me how the measurements are handled.

What’s happening “under the hood” when I tell Homey what the current daily power measurement is?

What happens when the power measurements resets back to zero on any given day after midnight, and I report back that value to Homey?

I see no options for letting Homey know what timeframe the power measurements applies to.

---

<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 18, 2022, 9:52pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/2 "2022-09-18T21:52:43Z")

</div>

It seems strange that you want to use the ‘measure\_temperature’ for power, why not use ‘measure\_power’?  
Homey will show and log whatever value you give it, so nothing is done to accumulate the value internally.

---

<div class="post-metadata">

**Author:** ![sbrattla](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sbrattla/32/47880_2.png) [@sbrattla](https://community.homey.app/u/sbrattla)\
**Post date:** [September 19, 2022, 5:42am UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/3 "2022-09-19T05:42:47Z")

</div>

@Adrian_Rockall yes, you’re right. I used the wrong metric / capability in my post, but I did mean `measure_power`.

The “problem” is that the Thermostat reports it’s real power consumption as a daily aggregate.

However, the `measure_power` expects to receive the power usage for any given moment, and if I report a given power usage every n minutes - Homey will “extrapolate” this power usage for an entire interval.

There is also another `meter_power` capability which I am uncertain what really does.

For now, I ended up polling the thermostat every minute, and invoke `setCapabilityValue(‘measure_power’, installedEffect)` if the thermostat is in an active state. The `installedEffect` is a static value (reported by the thermostat) for whatever the heating cables (which the thermostat controls) draws in watts.

It’s not exact, because I only poll the thermostat every minute, so maybe I should enable `isApproximated` - although this option seem to be for devices where the power usage is entirely calculated by the app.

---

<div class="post-metadata">

**Author:** ![Mickel\_Luiten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mickel_luiten/32/12404_2.png) [@Mickel\_Luiten](https://community.homey.app/u/Mickel_Luiten)\
**Post date:** [September 19, 2022, 7:20am UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/4 "2022-09-19T07:20:19Z")

</div>

Got the same challenge, The used API reports the measure\_power on daily basis in block if 2 hours. So what it the best way to implement this in Homey energy consumption?

---

<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 19, 2022, 11:21am UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/5 "2022-09-19T11:21:30Z")

</div>

The meter\_power is probably better as that is in kWh rather than kW so is meant for total consumption rather than instantaneous power.

---

<div class="post-metadata">

**Author:** ![sbrattla](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sbrattla/32/47880_2.png) [@sbrattla](https://community.homey.app/u/sbrattla)\
**Post date:** [September 19, 2022, 12:52pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/6 "2022-09-19T12:52:53Z")

</div>

@Adrian_Rockall yes, but I assume `meter_power` expects a value holding the total “lifetime” consumption for the device. My thermostat returns at most a 90 day “sliding window”, so the best I can get from it is a sum of 90 days consumption.

If you can’t feed Homey with an incrementing kWh value holding the total usage for the device, I suspect that option will be no good.

---

<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 19, 2022, 1:01pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/7 "2022-09-19T13:01:47Z")

</div>

The capability can be used in whatever way suits your device and will have no negative effect on Homey. If you want you could make it a sub capability or change the name to reflect it’s meaning.

I have devices that present hourly, daily, monthly and total consumption. So I use meter\_power.hourly, meter\_power.daily, etc. I then set the title using the capabilityopton.

---

<div class="post-metadata">

**Author:** ![sbrattla](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sbrattla/32/47880_2.png) [@sbrattla](https://community.homey.app/u/sbrattla)\
**Post date:** [September 19, 2022, 6:00pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/8 "2022-09-19T18:00:38Z")

</div>

I was not aware of the concept of sub capability. I tried to look up some documentation on that, but I can only find it briefly mentioned in [Using the same capability more than once](https://apps.developer.homey.app/the-basics/devices/capabilities#using-the-same-capability-more-than-once).

Will Homey treat the `meter_power.daily` different than `meter_power`, or is it just that the associated title will give the sub capability meaning because it carries e.g. the “daily” description?

---

<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 20, 2022, 2:16pm UTC](https://community.homey.app/t/how-does-homey-process-power-measurements-via-setcapabilityvalue/69086/9 "2022-09-20T14:16:55Z")

</div>

I think you are too concerned about the way Homey treats the `meter_power` capability. Your use will not effect the way Homey works in any way. Changing the title makes it more obvious to the user what the value means and that is the only thing to consider.  
The `measure_power` capability has some other internal function as it determines what appears in the Energy tab of the app, however `meter_power` is only applicable to your device, so it can have whatever meaning you want.
