Bluebie / homebridge-miio

Xiaomi Mi Home Plugin for Homebridge
112 stars 26 forks source link

Triggers crashing bug in Debian Jessie on Raspberry Pi in some IPv6 environments #11

Closed biogerm closed 7 years ago

biogerm commented 7 years ago

Hi,

I'm new to your miio project. Just installed it through npm and it crashes every time. Log is here:

events.js:160 throw er; // Unhandled 'error' event ^

Error: getaddrinfo -3008 at errnoException (/usr/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:199:11) at getaddrinfo_complete (/usr/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:112:10) at GetAddrInfoReqWrap.oncomplete (/usr/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:120:9)

BR Ryan

Bluebie commented 7 years ago

This has to do with the system's DNS service. What platform are you running on, and if it's linux, what mDNS service are you using? (avahi?)

Bluebie commented 7 years ago

I found this: https://github.com/agnat/node_mdns/issues/130

biogerm commented 7 years ago

@Bluebie I'm running it on a rpi, yes it's running on jessie. Any ideas how to solve the issue?

Bluebie commented 7 years ago

It's an issue with the raspberry pi platform and debian's IPv6/DNS/mDNS stack on that platform. the issue i linked has more information. You can work around the issue by breaking the IPv6 support in the homebridge-miio library or the mdns npm library in these ways. I'm not sure hacky work arounds like this belong in a crossplatform library. Really, Debian should fix this.

biogerm commented 7 years ago

maybe the support is already there. I will try the work around first to see if it can fix the problem. Otherwise i will make the respbian is up to date and see if the issue is gone...

biogerm commented 7 years ago

the only thing i know for now is only apply the workaround to miio is not enough :)

giving this: Error: dns service error: unknown at MDNSService.on_resolver_done (/usr/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:19:30) at SocketWatcher.MDNSService.self.watcher.callback (/usr/lib/node_modules/homebridge-miio/node_modules/mdns/lib/mdns_service.js:18:40)

biogerm commented 7 years ago

somehow i can't make it go any further than this error...

astrojetson8 commented 7 years ago

@biogerm @Bluebie i migrated to Pi tonight, and i came across similar issue.

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo -3008
    at errnoException (/usr/local/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:199:11)
    at getaddrinfo_complete (/usr/local/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:112:10)
    at GetAddrInfoReqWrap.oncomplete (/usr/local/lib/node_modules/homebridge-miio/node_modules/mdns/lib/resolver_sequence_tasks.js:120:9)
Bluebie commented 7 years ago

this should be resolved by version 0.2.0 which no longer uses mdns at all.

astrojetson8 commented 7 years ago

yes, all good on pi too! same error log for unsupported devices but it all works good.

biogerm commented 7 years ago

@Bluebie @astrojetson8 wow....it worked....

biogerm commented 7 years ago

and it works for both v1 and v2 plugs

bluefoxlee commented 7 years ago

@Bluebie Thanks. This plugin works well with v1 plug. not with power strip at moment. Let me know if you need a sample to work on.

BTW, will it help, if you have a chance to look at HomeKit plugin for Xiaomi-Router? I had clone 0.3 files few months ago, it looks like very like homebridge. However I am not a programer, not 100% sure.

Bluebie commented 7 years ago

It couldn't hurt, but i doubt it would have anything useful in it.

biogerm commented 7 years ago

Big thanks @Bluebie

bluefoxlee commented 7 years ago

@Bluebie 1.1.3 HomeKit for Xiaomi router zip can be download from here.