Closed RoadXY closed 1 year ago
@RoadXY For me, it's impossible to use this feature. It's at the "driver" level and cannot be overwritten at the device level.
This kind of feature just cannot be used with "generic" driver.
In my opinion, the cumulative should be handled in the ESPhome configuration. Or a virtual device from another app.
The only other solution would be the ability to add a convert function to a capability.
On reception of a new value, the device would execute this function:
processNewStateValue(currentValue, newStateValue, processingFunction) {
return eval(processingFunction);
}
By default, processingFunction would be:
"newStateValue"
But you could overwrite it (through a dedicated capability option in the wizard):
"currentValue + newStateValue"
I suppose this function should only be available for number capability. At least for your need, but why not apply it to anything ...
@RoadXY For me, it's impossible to use this feature. It's at the "driver" level and cannot be overwritten at the device level.
This kind of feature just cannot be used with "generic" driver.
In my opinion, the cumulative should be handled in the ESPhome configuration. Or a virtual device from another app.
It's only a sort of tag to tell Homey it is an device which has a value which is cumulative. So Homey does not add it up with all the other devices using power.
@RoadXY Ok so I don't understand how it works. It's a driver level parameter and cannot be modified by the user. It will change the behaviour of ALL ESPhome devices. So I'm worried about it!
It will only affect the Homey device it has been set on. Should be an checkbox during pairing somewhere here.
@RoadXY Based on the description it's at driver level, not device:
Same problem as the battery, ... cannot make it "device" specific
I had it with a checkbox in the pairing wizard and only when checked that device was 'cumulative'...
@RoadXY You mean with your version of the app? before I take it over?
I cannot see anything related in the code, so I'm unsure what you refer to
Have been searching and you're right. It wasn't on my Github just yet.
Ronny has this as an setting and he's able to set the cumulative in code so not every device is affected by it: https://github.com/search?q=repo%3ARonnyWinkler%2Fio.home-assistant.community%20cumulative&type=code
Nice catch, there are 2 functions on Device object: https://apps-sdk-v3.developer.homey.app/Device.html#getEnergy https://apps-sdk-v3.developer.homey.app/Device.html#setEnergy
Meaning at driver level, it's for "default" values, but we can modify it per Device ...
await this.setEnergy({
"cumulative": value
}
I suppose it's possible to modify the batteries too ... but that's another subject :)
I will not implement it in the current version, but only in #30 improved-ui.
@RoadXY Can you just describe what it does exactly? I'm annoyed because even at "device" level, it will impact all the capabilities of the device. I'd prefer to be able to configure it individually for each capability!
If it just add up everytime a new value is received, it's very simple to implement, no need of that "battery.cumulative" setting.
This will tell Homey it is a device which has a total/cumulative representation of the power and/or energy used by your house. This way Homey won't treat this device as a power using device (like it does now). See here: https://apps.developer.homey.app/the-basics/devices/energy#measuring-devices
It should be under 'slimme meters' (smart meters)
Now Homey is just adding the total house usage like it was a single device using energy right now! (Currently negative because I have solar panels producing power right now)
@RoadXY I would go for what Adrian said in the following post: 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.
For me, if you want the value to be excluded from energy panel, just use meter_power instead of measure_power.
The cumulative setting draw too much issues not in line with the spirit of ESPhome. The setting apply to ALL the capabilities of the device, so you cannot have measure_power.instant and measure_power.cumulative. Use measure_power (for instant), and meteer_power (for cumulative) !
I would like to close this issue :)
Yes, but then Homey does not know how much power is drawn by the house but only knows how much individual devices use. I do get what you're saying about the spirit of ESPhome.
Maybe add an check for the number times measure_power is being used and display an error message when more then 1 is specified?
However I do get it will be an edge case. If the issue pops up for more users it might end back up your ToDo list 😉
Describe the solution you'd like Some devices, such as example a P1 meter or current clamp, can measure the total energy usage of a home or power group. For this to work you should be able to set the cumulative property to true.
See here: https://apps.developer.homey.app/the-basics/devices/energy#measuring-devices