All new UPnP gateway concept; a scriptable UPnP engine

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.

[ad name=”468×60 Banner”]

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

[ad name=”468×60 Banner”]

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 1178 times), and below a screenshot of a testrun.

[ad name=”468×60 Banner”]


3 thoughts on “All new UPnP gateway concept; a scriptable UPnP engine

    • Keep the good work and post updates

      Well; just did :), see

      The problem with the Vera box is that its most of all, broken. It won’t publish its own devices (unless they recently fixed a long standing, but very low prioritized) issue. And they keep the device itself as a controller in the loop.
      Most of all, I want to decouple the hardware from the controllers/UIs, this is the biggest step the home automation community has to make. The Vera only does that to a limited extent.

  1. Pingback: Update to the UPnP – Lua gateway engine - Tieske

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe without commenting