ilcato / homebridge-Fibaro-HC2

Homebridge plugin for Fibaro Home Center 2 (and Home Center Lite ...)
Apache License 2.0
65 stars 27 forks source link

Report HC2 Unresponsive/dead accessories #148

Open lboue opened 5 years ago

lboue commented 5 years ago

Hello,

I would report unresponsive accessories to HomeKit app. For exemple if device is not powered on, the HC2 REST API reports is as dead: dead: "true",

I found explanations here on the HAP-NodeJS github Change updateValue to return not responding status #556

Explanations

We can init an err variable and then trigger an error

    var err = null; // in case there were any problems
    ...
    err = new Error("Polling failed");

Or use a boolean like the dead attribute:

    var err = null; // in case there were any problems
    var isAccReachable = false;  // Set Reachability
    isAccReachable ? err = null : err = new Error("Polling failed");

Fake Outlet hap-nodejs test

I did a test with hap-nodejs et that file: Outlet_accessory.js. If I change isAccReachable to true, the Outlet become reachable withHomeKit

pi@raspberrypi:/usr/lib/node_modules/homebridge/node_modules/hap-nodejs $ sudo nodejs Core.js 
HAP-NodeJS starting...
Are we on? No.
Are we on? No.
Are we on? No.

IMG_2153

Do you think it could be implemented? I can help for testing.

Regards

ilcato commented 5 years ago

It's in my to do list.

lboue commented 5 years ago

Hello @ilcato.

You can try with my test file here: https://github.com/lboue/HAP-NodeJS/blob/no_response/accessories/Light_accessory.js

Did you had time to work on this?

ilcato commented 5 years ago

Very busy at the moment...