Is adding capabilities after pairing possible?
Closed this issue · 9 comments
Hi,
I am trying to add some more features to the com.hue.zigbee app. One of them is monitoring the battery level on dimmer switches. I have added this.registerCapability("measure_battery", "batteryPercentageRemaining", ...) to the device's onMeshInit and included "measure_battery" in the app.json capabilities list, but I don't see the battery level in the dimmer's info popup on the devices screen.
When I added support for the motion sensor, I had the same issue, and ended up unpairing and pairing the sensor a good number of times - basically whenever I had modified anything in onMeshInit. I hope that won't be necessary, since that ruins existing flows.
Hi!
You should check some other zigbee apps on our athombv organisation. I think "batteryPercentageRemaining" should be changed to "genPowerCfg" the cluster which reports it.
Generally you can not change the capabilities after you have paired the device by the way.
And did you add it to the app.json, and after that re-included it?
@RobinBol D'oh, yes, you are right about that. I fixed that, but now I get this message in the log:
(node:9088) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: invalid_capability
(node:9088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
If it wasn't clear from my initial question, I had paired this dimmer switch to Homey before adding the measure_battery capability.
Do I really need to unpair+pair the dimmer to add the new capability?
@caseda By re-include do you mean unpair and then pair the device again? If that is the case, then that is exactly what I want to avoid, since that would ruin a lot of flows.
Yes, to add another capability after you already included, you need to re-include (so yes, remove and add again)
@caseda I see. That could lead to some annoyances down the road: If somebody creates an app for a device, and later add new capabilities, users would have to re-include all affected devices, and recreate flows? Or is it possible to re-include an already paired device?
In the future it will be possible, but until that the developer just needs to make sure to add all capabilities, been that way from the start
OK, I can live with that for a (short) while ;-) Thank you both for your fast responses.
For posterity: The answer to my question is "No" for the time being.
If you re-pair 1 then search your flows for "broken" you can at least see which flows it was in, saves some headache