athombv / homey-web-api-issues

This issue tracker is for Homey Developers using the Web API.
4 stars 1 forks source link

HomeyAPI.ManagerDevices.Device.CapabilityInstance setValue() triggers listeners function #6

Closed specialcircumstances closed 3 years ago

specialcircumstances commented 5 years ago

SDKv2. Latest stable Homey.

Documentation indicates:

listener | function | A function to invoke when the capability is changed by anything other than the returned capabilityInstance

When I use the setValue() method of the returned capabilityInstance the listener function is triggered.

Creation of instance:

device['cInst']['target_temperature'] = device.makeCapabilityInstance('target_temperature', function(device) {
                this.stateChange(device);
            }.bind(this, device));

Trigger of method:

await thisDevice.cInst.target_temperature.setValue(targetTemp);

Result is that "stateChange(device)" is triggered.

WeeJeWel commented 3 years ago

Well, yes, the value is changed!

specialcircumstances commented 3 years ago

Lol... that was a long time ago... I think the point I was querying was that the documentation indicates " when the capability is changed by anything other than the returned capabilityInstance " It was so long ago I can't really remember the details...

WeeJeWel commented 3 years ago

Aha, thanks, we'll add that in a future release :)