Today I finished the first working sample of the new UPnP gateway I’ve been working on, a major milestone! Stepped out of .NET and changed to platform independent code and libraries. Punished myself with hardcore C, multi-threading and multi-platform all at once, but it all seems to start working now.
So what is it?
Its a Lua scripting engine, glued to the pupnp library. Lua is a small, fast and very portable dynamic scripting language and pupnp is a portable UPnP library. This creates an engine that will run on any platform (Windows, Mac, Linux, or even embedded on a NAS or your wifi router), while at the same time allowing users/developers to write code in Lua. So it takes away the need to do all the complex stuff in hardcore C, threading, platforms, etc. The Lua scripts will simply run on all platforms, unmodified.
Why create it?
This is a bit of a long-term vision I have on the subject; homeautomation is very fragmented, lots of opensource stuff and many commercial products, each can do a lot, but none can do all. Check out EventGhost, HomeSeer, Girder, and then some. That’s software, hardware is even worse, X10, HomeEasy, Zigbee, Zwave, EIB-KNX either unreliable or competing for market dominance and hence closed technology (especially Zwave). Now all server products try to implement as much hardware support as they can, so they write drivers for a lot, but still not all, hardware. Hardware vendors have to implement drivers for their products for as many products as possible as well, to be able to sell to customers who are well bought into existing hard and software.
A lot of energy is wasted here, with a sub-optimal result. So put the UPnP script engine in between, de-couple the homeautomation server and the hardware support layer. Develop 1 driver for each hardware type, using the UPnP engine. And have each homeautomation server implement 1 UPnP controlpoint. All servers will be able to get along with all hardware. Server developers can focus on implementing state-of-the-art GUI’s and compete on that without having to worry about hardware support. Hardware suppliers can focus on delivering top-notch hardware instead of wasting energy on supporting all kinds of different setups. Users can run it on any platform, even small 24×7 devices.
In the end; everybody wins!
How will this compete with existing hard and software?
Not. The gateway is solely intended to bridge proprietary hardware to generic and open UPnP. I have no intent to create anything else, no homeautomation server/GUI, nor a logic engine. Lets just make sure evereybody does what he/she does best.
Is it ready?
Nope, its a first demo. Lots needs to be done, in no particular order;
- UPnP security service has not been implemented (must have!)
- Some of the wrapper code (mutexes, waithandles and sockets) are not complete for all platforms yet, currently it only runs on Windows, but this should be limited as the wrappers themselves have all been created already
- Solid logger, as its designed to be used in the background without an interface, it must provide solid logging, even if only for troubleshooting and debugging
- Serial library; currently network connections are supported through the LuaSocket library, but serial connections must be added to (probably through ser2net, but that lacks a windows version AFAIK)
- The demo is a single Lua file (which is totally crap code), and should be replaced by a Lua side object oriented framework to access and modify UPnP devices/controlpoints
Show me the demo!
The demo is a Lua version (Windows only until the todo’s have been fixed) of the NetworkLight from the former Intel UPnP toolset, but lacking the fancy images. Download the zip file and extract it in a single folder, then start the batchfile (‘_start.bat’). Now you can use the DeviceSpy utility (also from the UPnP toolset) to inspect the variables and execute actions. If you’re not familiar with the tool;
- right-click a service and tick ‘subscribe’ to get updates
- double-click an action to set parameters and execute it
Here’s the download, at only 272Kb! (downloaded 613 times), and below a screenshot of a testrun.