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.
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.
@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.
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?
The meter_power is probably better as that is in kWh rather than kW so is meant for total consumption rather than instantaneous power.
@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.
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.
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.
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?
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.