PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 44 forks source link

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

Closed sander1988 closed 1 year ago

sander1988 commented 3 years ago

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?

PatchworkBoy commented 3 years ago

Go for it...

sander1988 commented 3 years ago

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

sander1988 commented 3 years ago

@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 ;-)

PatchworkBoy commented 3 years ago

Eve and Home+ by @brutella