miio icon indicating copy to clipboard operation
miio copied to clipboard

discovery command does not work or something's wrong with me?

Open wallride opened this issue 6 years ago • 4 comments

Hi. I don't get what's wrong. I have miio installed globally and run miio discover It writes INFO Discovering devices. Press Ctrl+C to stop. in console and that's it. Nothing happens, no devices found in about 10 minutes. Though I have plenty of devices in my network and even able to discover them via UDP 4321 port ("Green meter gateway LAN communication protocol V1.0. 9").

So, what am I doing wrong?

wallride avatar Jun 25 '18 14:06 wallride

I was just facing the same issue with nodejs v10.7.0 on windows.

I haven't yet figured out the exact reason but my feeling is that it is a bug in nodejs dgram lib (on windows at least) when you have multiple network interfaces, packets are not broadcasted to all the interfaces but only to one selected with an unknown logic.

I managed to work around the issue by forcing miio to bind on my lan interface. Then packet are properly sent over network and devices reply.

Keeping on digging....

sinopsysHK avatar Jun 25 '19 02:06 sinopsysHK

@sinopsysHK how did you manage miio to bind to a particular interface?

ReDetection avatar Aug 10 '19 08:08 ReDetection

first option was disabling all the other interfaces.

Second option was hard-coding the IP address to bind in underlying package but I do not remember which one.

sinopsysHK avatar Aug 10 '19 08:08 sinopsysHK

Cool, worked for me to hardcode in /usr/lib/node_modules/miio/lib/network.js:136. Thanks!

ReDetection avatar Aug 10 '19 08:08 ReDetection