vurgen.blogg.se

Wemo pc application
Wemo pc application





Var tasks = addresses.SelectMany(CheckWemoDevice) Var addresses = GetAddresses().Where(a => a.Type = "Dynamic") Public event WemoDeviceFound OnWemoDeviceFound Public delegate void WemoDeviceFound(WemoDevice device) Anyway, here's the class that does all the magic: public class WemoScanner It's kind of a brute-force method, but all requests are made async and in parallel, so we get a response rather quickly.

wemo pc application

This method does work for me on a Windows 10 pc. Else, other devices made by Belkin might show up. It does kind of work, but we should be parsing the UDN to determine model, and friendlyName to show to the end-user. In this sample, I just made a simplified parsing, just checking if it contains the word "Belkin". When we get a proper response, it contains all the upnp device info, which we can then parse for anything we'd like to know about the device. Then we try to access the setup.xml on the different ports that we know the wemo devices can run on. It's a little hacky, and doesn't really use the upnp protocol (as I was unable to get that working at all on Windows 10).īasically, what we're doing is making use of a netsh command to get a list of devices, and their addresses. 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? By replacing the "upnp:rootdevice" in the code above with the value from in the xml (I believe it was "urn:Belkin:device:controllee:1"), I came up with 0 results from the UPnPDeviceFinder. 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.Īfter a bit more Googling, I found this article which allowed me to figure out how to query the 'setup.xml' for each device. Var devices = finder.FindByType(deviceType, 1) įoreach (UPnPDevice upnpDevice in devices)

wemo pc application wemo pc application

The relevant bit of code is pasted below. I've followed the code samples and directions given by Bernacules here. I'm trying to create a C# app for controlling WeMo devices.







Wemo pc application