jimmywarting / wemo-client

JavaScript client library for controlling and subscribing to Wemo Devices
MIT License
132 stars 40 forks source link

Discovery of known devices by mac address / some other unique identifier #21

Closed InsidersByte closed 8 years ago

InsidersByte commented 8 years ago

I have got a couple of wemo switches and I want to be able to store their location so that I can find them again later, without having to do a discovery.

The issue is that I cannot call the load method as the devices ip addresses and ports change, the ports more so than the ip address.

I was wondering if there was a way to find a device by some unique identifier like mac address, instead of having to rediscover to find the device again?

timonreinhard commented 8 years ago

Would you mind sharing the firmware version of your devices? (deviceInfo.firmwareVersion) I'm asking because I can not reproduce this behavior. All my Wemo devices listen on port 49153 and don't change their IP address while being powered.

But to answer your question: I'm not aware of any (reasonable) way other than UPnP to auto-discover Wemo devices in a local network.

ghost commented 8 years ago

I noticed the same behavior - ports more often than IP changes; usually, in my scenario, last digit. My fw version is WeMo_WW_2.00.10062.PVT-OWRT-LS

timonreinhard commented 8 years ago

Do they even change while the wemo client has subscribed to events?

ghost commented 8 years ago

It didn't appear to the be the case. My hypotesy was that for some reason they might reboot/crash due to timing and rediscovery (without removing power). But I haven't been able to rule that out with an exact sequence though.

InsidersByte commented 8 years ago

I have seen my devices switch between port 49153 and 49154. If you google around you do find that this is common with wemo devices.

timonreinhard commented 8 years ago

True, there are some reports on this issue, ports may increase to larger numbers (https://discuss.ninjablocks.com/t/wemo-problems/1463/7). This is currently unhandled and yet to be fixed. I'm not going to implement something that tries to guess the new IP/port, though. That's what SSDP is for.