aholstenson / miio

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
1.86k stars 354 forks source link

miio discover nothing #84

Closed cissusnar closed 6 years ago

cissusnar commented 6 years ago

I have 3 xiaomi devices on my local nat, when I run miio --discover, it'll stay in "INFO Discovering devices. Press Ctrl+C to stop." and no any other result return.

cissusnar commented 6 years ago

did I need a root privileges to run this command ?

Bluebie commented 6 years ago

Local Discovery doesn't interact with NAT. What matters is that they're on the same subnet. You shouldn't need root. Most likely there's some firewall stuff going on with your computer? Or a very hostile network router/access point that doesn't allow broadcast traffic at all?

Can you discover other things on your network, like windows file shares? like mdns or upnp/netbios stuff?

Bluebie commented 6 years ago

what are the xiaomi devices? not all of them support local networking I think.

cissusnar commented 6 years ago

sorry that "NAT", I mean is subnet, these xiaomi devices at subnet 192.168.2.xxx

cissusnar commented 6 years ago

Two Mi Smart Socket Plug and one Air Purifiers 2 My router is a gentoo linux, and no firewall rules on my subnet. I can access any computer and any port on this subnet. I run "miio --discover" on my router. did miio detect all subnet or only follow default route table ?

aholstenson commented 6 years ago

Thank you for opening an issue! Miio uses a UDP broadcast that the Xiaomi devices reply too. In some networks setups the UDP broadcast are blocked.

Does your router have Avahi and mDNS-capabilities? Devices should announce themselves using _miio._udp as well.

Do you have any other computer where you could test running the miio --discover command to see if works?

cissusnar commented 6 years ago

hi @aholstenson My router running Avahi as mDNS provider(used by shairport-sync that is a AirPlay service). and iptables allow all input, output and forward by default. Did miio has a verbose mode or debug mode? I'll try running miio --discover on another computer later.

thanks for reply

cissusnar commented 6 years ago

2017-12-27 10 27 10 miio --discover success on another computer, but it's still no response running on my router. I think miio does not find the right subnet, or should detect all subnet. I have three subnet interface on my router.

flaff commented 6 years ago

same here. When I discover device using other computer and then try --inspect on router itself it says "could not find device". Router in my case is in two networks (192.168.1. eth, 192.168.3. wlan0)

On router the device is visible when doing "arp -a" command, but can't connect to it through miio.

EDIT: used workaround by moving purifier to subnet in which nodejs host is not a router.

aholstenson commented 6 years ago

Closing this issue, moving all discovery issues into #92.