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

After plugging off the socket and setting it back, have to restart homebridge server

Open makstech opened this issue 6 years ago • 1 comments

Your plugin is awesome and saved my day, so thanks! But what I found, is that, if you take out the socket or it is not plugged in from beginning (homebridge launch), it will still be available in Home app and after plugging it back, it won't work at all for at least a minute (although from Mi Home App it's working right away) and then, it will just burst all those times that you've pressed in Home app that toggle switch. Is it possible to fix that?

If it is not plugged in from the beginning it will log this error:

poll update failed on 66070639 { Error: send EHOSTDOWN 192.168.8.199:54321
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at SendWrap.afterSend [as oncomplete] (dgram.js:498:11)
  code: 'EHOSTDOWN',
  errno: 'EHOSTDOWN',
  syscall: 'send',
  address: '192.168.8.199',
  port: 54321 }

And other times it send:

poll update failed on 66070639 { Error: Call to device timed out
    at retry (/usr/local/lib/node_modules/homebridge-miio/node_modules/miio/lib/device.js:225:18)
    at _ensureToken.catch.err (/usr/local/lib/node_modules/homebridge-miio/node_modules/miio/lib/device.js:238:8)
    at <anonymous> code: 'timeout' }

And also, what about adding config setting to set a name for specific ID so it would be a lot more convenient to see which device is triggered or is timing out.. Thanks

makstech avatar Jan 30 '18 21:01 makstech

hm that's odd. i thought it would mark the device unavailable after some poll failures. unplugged plugs is not a common scenario in my house. unsure what's going on with the bursting.

as for naming, i think it's possible to expose an optional name attribute over homekit, so when the device is renamed in Home app, that is transmitted to homebridge and the plugin, and could be used for debug messages. It wouldn't be a ton of work to implement, and i think it's a more reasonable way to solve that problem than hard coding device id's in to a config file on the homebridge system.

but, to be honest, i totally lack motivation to do any of this. i hate coding, and this thing does everything i need it to do. if you want to implement some cool stuff and send a pull request i'm happy to look over it, give it a test, and publish it though!

Bluebie avatar Jan 31 '18 01:01 Bluebie