Skip to content
This repository has been archived by the owner on Apr 25, 2021. It is now read-only.

Report dead module in HomeKit #109

Open
lboue opened this issue Jul 22, 2018 · 2 comments
Open

Report dead module in HomeKit #109

lboue opened this issue Jul 22, 2018 · 2 comments

Comments

@lboue
Copy link
Contributor

lboue commented Jul 22, 2018

Hello,

I have one Roller Shutter 2 works (FGRM222) which is reporter as dead on HC controller:
"dead": "true",

Full HC API JSON

{  
   "id":206,
   "name":"VR Étage",
   "roomID":206,
   "type":"com.fibaro.FGRM222",
   "baseType":"com.fibaro.FGR221",
   "enabled":true,
   "visible":true,
   "isPlugin":false,
   "parentId":205,
   "remoteGatewayId":0,
   "interfaces":[  
      "energy",
      "levelChange",
      "power",
      "zwave",
      "zwaveMultiChannelAssociation",
      "zwaveProtection",
      "zwaveSceneActivation"
   ],
   "properties":{  
      "parameters":[  
         {  
            "id":3,
            "lastReportedValue":0,
            "lastSetValue":0,
            "size":1,
            "value":0
         },
         {  
            "id":10,
            "lastReportedValue":1,
            "lastSetValue":1,
            "size":1,
            "value":1
         },
         {  
            "id":12,
            "lastReportedValue":150,
            "lastSetValue":150,
            "size":2,
            "value":150
         },
         {  
            "id":13,
            "lastReportedValue":1,
            "lastSetValue":1,
            "size":1,
            "value":1
         },
         {  
            "id":14,
            "lastReportedValue":0,
            "lastSetValue":0,
            "size":1,
            "value":0
         },
         {  
            "id":17,
            "lastReportedValue":10,
            "lastSetValue":10,
            "size":1,
            "value":10
         },
         {  
            "id":18,
            "lastReportedValue":10,
            "lastSetValue":10,
            "size":1,
            "value":10
         },
         {  
            "id":22,
            "lastReportedValue":240,
            "lastSetValue":240,
            "size":2,
            "value":240
         },
         {  
            "id":29,
            "lastReportedValue":0,
            "lastSetValue":0,
            "size":1,
            "value":0
         },
         {  
            "id":30,
            "lastReportedValue":2,
            "lastSetValue":2,
            "size":1,
            "value":2
         },
         {  
            "id":31,
            "lastReportedValue":0,
            "lastSetValue":0,
            "size":1,
            "value":0
         },
         {  
            "id":32,
            "lastReportedValue":1,
            "lastSetValue":1,
            "size":1,
            "value":1
         },
         {  
            "id":33,
            "lastReportedValue":1,
            "lastSetValue":1,
            "size":1,
            "value":1
         },
         {  
            "id":35,
            "lastReportedValue":1,
            "lastSetValue":1,
            "size":1,
            "value":1
         },
         {  
            "id":40,
            "lastReportedValue":10,
            "lastSetValue":10,
            "size":1,
            "value":10
         },
         {  
            "id":42,
            "lastReportedValue":3600,
            "lastSetValue":3600,
            "size":2,
            "value":3600
         },
         {  
            "id":43,
            "lastReportedValue":10,
            "lastSetValue":10,
            "size":1,
            "value":10
         },
         {  
            "id":44,
            "lastReportedValue":0,
            "lastSetValue":0,
            "size":1,
            "value":0
         },
         {  
            "id":50,
            "lastReportedValue":0,
            "lastSetValue":0,
            "size":1,
            "value":0
         }
      ],
      "pollingTimeSec":0,
      "zwaveCompany":"Fibargroup",
      "zwaveInfo":"3,3,52",
      "zwaveVersion":"25.25",
      "RFProtectionState":"0",
      "RFProtectionSupport":"3",
      "configured":true,
      "dead":"true",
      "deviceControlType":"54",
      "deviceIcon":"87",
      "emailNotificationID":"0",
      "emailNotificationType":"0",
      "endPointId":"0",
      "energy":"0.15",
      "liliOffCommand":"",
      "liliOnCommand":"",
      "localProtectionState":"0",
      "localProtectionSupport":"5",
      "log":"",
      "logTemp":"",
      "manufacturer":"",
      "markAsDead":"true",
      "model":"",
      "nodeId":"18",
      "parametersTemplate":"721",
      "power":"0.00",
      "productInfo":"1,15,3,2,16,0,25,25",
      "protectionExclusiveControl":"0",
      "protectionExclusiveControlSupport":"false",
      "protectionState":"0",
      "protectionTimeout":"0",
      "protectionTimeoutSupport":"false",
      "pushNotificationID":"0",
      "pushNotificationType":"0",
      "remoteGatewayId":"0",
      "saveLogs":"true",
      "sceneActivation":"0",
      "serialNumber":"",
      "showEnergy":"true",
      "smsNotificationID":"0",
      "smsNotificationType":"0",
      "useTemplate":"true",
      "userDescription":"",
      "value":"99"
   },
   "actions":{  
      "close":0,
      "open":0,
      "reconfigure":0,
      "reset":0,
      "sceneActivationSet":0,
      "setValue":1,
      "setValue2":1,
      "startLevelDecrease":0,
      "startLevelIncrease":0,
      "stop":0,
      "stopLevelChange":0
   },
   "created":1531288244,
   "modified":1531288244,
   "sortOrder":97
}

Is there a way to report it as dead/unreachable in Homekit too ?

Regards,
Ludovic

@lboue
Copy link
Contributor Author

lboue commented Jul 22, 2018

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

@vvsokolov
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants