I’ve started work on developing a plugin for the Philips Hue lights, after having had a look at the comms protocol (which is quite simple).
Interestingly, the Hue hub reports itself as a uPnP device and can be added to Vera, even though you’ll not get more from it than just the IP and MAC address. But even that can be useful, for example to track the device as it changes IP address (it expects DHCP and doesn’t have a fixed address).
Is it possible to exploit uPnP routines in Vera to keep track of a device that changes IP address? Similar to the way Foscam camera’s are tracked, I suppose.
I did Already have all details on the Hue protocol. What I am after is a library call for handling generic uPnP discovery messages; I expected one to exist as Vera does uPnP discovery as well.
I tried to dig into the vera upnp myself wihtout any luck. I did stumble over som elua upnp discovery libs via some simple google search, but did not look into it. From what I saw there are some upnp discovery libs in lua out there…
Actually, the upnp discovery message in that bit of code isn’t fully correct. I noticed when I tried discovering all devices on my network. As it turns out, some devices (like that Samsung remote, apparently) are a bit naughty and respond even when the discovery message is malformed. Some devices are really naughty and spit out a response regardless of what message appears on the uPnP channel. The Philips Hue is like this.
For completeness, the correct discovery message is below:
local ssdpPacketTable = {
[1] = “M-SEARCH * HTTP/1.1\r\n”,
[2] = “HOST:239.255.255.250:1900\r\n”,
[3] = “MAN:"ssdp:discover"\r\n”,
[4] = “MX:4\r\n”,
[5] = “ST:urn:schemas-upnp-org:device:Basic:1\r\n\r\n”
}
Notice the \r\n breaks and the mandatory quotes around “ssdp:discovery”
(And yes, the Philips Hue hub announces itself as a basic device)
Best Home Automation shopping experience. Shop at Ezlo!