Open lboue opened 6 years ago
I found an implementation exemple in homebridge-hue plugin source code:
homebridge-hue doesn't report an accessory as unreachable, but sets Status Fault when a device is reported unreachable by the Hue bridge. This is because the bridge sometimes/often reports a device as unreachable while it's working perfectly. If homebridge-hue were to announce the device as unreachable to HomeKit, like the Hue bridge, you could no longer control it in this case.
So to do that you need to add an OptionalCharacteristic called Characteristic.StatusFault. https://github.com/ebaauw/homebridge-hue/search?q=.reachable&unscoped_q=.reachable
if (this.type === 'light') {
this.service.addOptionalCharacteristic(Characteristic.StatusFault)
this.checkReachable(this.obj.state.reachable)
if (this.bridge.config.nativeHomeKitLights) {
this.service.addOptionalCharacteristic(my.Characteristic.UniqueID)
this.service.getCharacteristic(my.Characteristic.UniqueID)
.updateValue(this.obj.uniqueid)
}
}
HueLight.prototype.checkReachable = function (reachable) {
if (this.obj.state.reachable !== reachable) {
this.log.debug(
'%s: %s reachable changed from %s to %s', this.name, this.type,
this.obj.state.reachable, reachable
)
this.obj.state.reachable = reachable
}
const hkFault = this.obj.state.reachable ? 0 : 1
if (this.hk.fault !== hkFault) {
if (this.hk.fault !== undefined) {
this.log.info(
'%s: set homekit status fault from %s to %s', this.name,
this.hk.fault, hkFault
)
}
this.hk.fault = hkFault
this.service.getCharacteristic(Characteristic.StatusFault)
.updateValue(this.hk.fault)
if (this.config.wallSwitch) {
this.checkOn(this.obj.state.on)
}
}
}
Regards, Ludovic
add an OptionalCharacteristic called Characteristic.StatusFault.
I think that it will be great feature of the homebridge-Fibaro-HC2. Sometimes devices in FibaroHC is out of the network and this status of corresponding homebridge device is very useful.
Hello,
I have one Roller Shutter 2 works (FGRM222) which is reporter as dead on HC controller:
"dead": "true",
Full HC API JSON
Is there a way to report it as dead/unreachable in Homekit too ?
Regards, Ludovic