Search code examples
c#upnp

Find Belkin WeMo devices with UPnP.FindByType


I'm trying to create a C# app for controlling WeMo devices. I've followed the code samples and directions given by Bernacules here.

The relevant bit of code is pasted below.

private void GetAllDevices()
{
    var finder = new UPnPDeviceFinder();
    var foundDevices = new List<UPnPDevice>();

    var deviceType = "upnp:rootdevice";
    var devices = finder.FindByType(deviceType, 1);

    foreach (UPnPDevice upnpDevice in devices)
    {
        if (upnpDevice.Type.StartsWith("urn:Belkin:"))
        {
            ....
        }
    }
}

When I iterate the devices found by UPnPDeviceFinder, I come up with all sorts of things, my media server, some app running on my Android phone, my Chromecast, but no WeMos, nothing that even remotely had Belkin in the urn.

After a bit more Googling, I found this article which allowed me to figure out how to query the 'setup.xml' for each device. By replacing the "upnp:rootdevice" in the code above with the value from <DeviceType> in the xml (I believe it was "urn:Belkin:device:controllee:1"), I came up with 0 results from the UPnPDeviceFinder. I'm guessing Belkin has recently changed their configuration, but can someone with a bit more network saaviness clue me in on what value I can use for 'deviceType' which will find my WeMos?


Solution

  • What version of windows are you using?

    My UPnP scanner finds the Wemo just fine on Windows 7 but it doesn't work on Windows 8.1

    On Windows 8.1 all my other UPnP devices show up, but the Wemo does not appear at all.