homebridge-edomoticz icon indicating copy to clipboard operation
homebridge-edomoticz copied to clipboard

HAP Warning: Characteristic undefined not in required or optional characteristics for service XXXXXXXXX. Adding anyway.

Open sander1988 opened this issue 5 years ago • 4 comments

My HomeBridge is showing a lot of HAP warnings (logged by this line of code): https://github.com/homebridge/HAP-NodeJS/blob/master/src/lib/Service.ts#L301) from Domoticz devices. For example a wind sensor. It's caused by the custom characteristics from this plugin.

These call there parent class (like https://github.com/PatchworkBoy/homebridge-edomoticz/blob/master/lib/services.js#L180) with the UUID param. But this param is never stored: https://github.com/homebridge/HAP-NodeJS/blob/master/src/lib/Characteristic.ts#L411

The warning is gone when setting the UUID in the services file like this (added the last line):

...
eDomoticzServices.WindSpeed = function() {
    var charUUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41';//'9331096F-E49E-4D98-B57B-57803498FA36'; //UUID.generate('eDomoticz:customchar:WindSpeed');
    Characteristic.call(this, 'Wind Speed', charUUID);
    this.setProps({
        format: Characteristic.Formats.FLOAT,
        perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY],
        unit:'m/s',
        minValue:0,
        maxValue:360,
        minStep:0.1
    });
    this.value = this.getDefaultValue();
};
eDomoticzServices.WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41';
...

@PatchworkBoy - Do you agree? Do want me to create a merge requests with this fix for all custom characteristics?

sander1988 avatar Aug 16 '20 23:08 sander1988

Go for it...

PatchworkBoy avatar Aug 20 '20 15:08 PatchworkBoy

Ok. I will include it in a future pull request for issue #217.

sander1988 avatar Aug 22 '20 16:08 sander1988

@PatchworkBoy - Do you use a specific iOS app to see those custom services? I have implemented the change using two helper functions. I want to test this. The "HAP Warning" is gone, that's for sure ;-)

sander1988 avatar Aug 22 '20 17:08 sander1988

Eve and Home+ by @brutella

PatchworkBoy avatar Aug 22 '20 19:08 PatchworkBoy