athombv / homey-apps-sdk-issues

This issue tracker is for Homey Developers using the Apps SDK.
21 stars 4 forks source link

MAC discovery relies on broadcast pings that not all devices respond to #148

Open robertklep opened 4 years ago

robertklep commented 4 years ago

From what I know, MAC Address discovery relies on broadcast pings to find devices on the local subnet (at least for firmware up to v5, I don't know if this has changed in v5).

This depends on devices responding to these pings in order to be found, but there are plenty of devices that don't respond to them. In my local network, devices that don't respond include a Synology NAS, Ubiquiti Edgerouter, Sony Bravia TV, Android STB and ESP8266-based devices (Shelly, Wemos D1 Mini).

It would be useful for developers to note this in the documentation (including an explanation on how they can find out if a device responds to broadcast pings, by using ping -b XX.XX.XX.255) so they don't spend a lot of time implementing a discovery strategy that's not going to work anyway.

WeeJeWel commented 4 years ago

Homey indeed does a broadcast ping, then looks at the ARP table.

What would be a solution that would work for those devices too?

xristiaan commented 4 years ago

Just want to second that, I just spend two days trying to get MAC discovery to work until I found out (thanks Robert) that it does NOT work with ESP8266.

robertklep commented 4 years ago

@weejewel all the aforementioned devices respond to regular pings (ping-subnet), or use specialised tools like arp-scan, arpping or nmap.

WeeJeWel commented 4 years ago

I assume these modules brute-force ping x.x.x.{1-254}? I'm not sure how routers will respond to that behavior when it happens continuously, that requires extensive testing.

robertklep commented 4 years ago

For regular pings, it will indeed ping every single IP address on the local subnet. The arp* tools will send ARP requests for each IP-address.

I don't think routers really care (otherwise I would have expected them to have issues with broadcast pings too), but indeed it would warrant some testing.

robertklep commented 4 years ago

FWIW, some routers mistake the broadcast pings for Smurf attacks.