seeking advice on system architecture for custom, responsive UI
OK, thanks to you kind folks, I no longer consider myself a complete Z-wave newbie; I have a small network which has been functioning properly for days now. Now I'm ready to get serious about the long-term plan, and I'm looking for a bit more advice.
Our goal is to have an LCARS-style UI, complete with an interactive floor plan of our home, available on our phones and iPads as well as at several wall-mounted tablets around the house. These should be responsive in the sense that when somebody flips a (smart) switch, the displays update immediately. (Things like temperature and humidity can be polled less frequently.)
I don't believe such a UI is available off-the-shelf, so I'm planning to write it. I'm a software engineer by trade, so that part doesn't worry me. Each of the displays will be a thin client, told by a central server to display various images and text at various points at the screen, and which of these should be interactive, and they will call back to the server when the user taps something. (I'm glossing over details here but that gives the general idea.)
So, now we come to the question:
Should I plan on keeping some off-the-shelf controller, like Vera or Domoticz, in between my central LCARS server and the Z-wave network? Or should I just use the OpenZWave library with an Aeon Zstick to speak to the Z-wave devices directly?
I'm trying to resist reinventing the nail here as much as I can... but my intuition is that figuring out how to interface with some off-the-shelf controller, and especially to get immediate notification when something changes, is likely to be as much work as just writing my own controller software with OpenZWave. And given the huge pile of code I'm going to have to write to manage my fancy UI, the actual Z-wave part of it seems fairly minor in either case.
But there are folks here with far more experience in this stuff than me... what do you think?
Domoticz has a web-based interface, i think this can be remade pretty much as you want it.
This is an example: https://github.com/robgeerts/Dashticz
I dont know the limits though, but maybe worth to investigate.
If you write your own, i know you can use json commands to and from domoticz.
I doubt a web-based interface could be as responsive as I like; the whole basis of HTTP is that the server knows nothing of the clients, but only responds to requests. That means the clients would have to poll very frequently in order to find out if anything has changed. That's why I'm planning a more terminal-style persistent connection; when something happens, the server can then simply update all the clients immediately.
It is possible to use iRule (http://www.iruleathome.com/irule-builder/the-software) for your poject, it has support for zwave devices and a cloud based builder - but not cheap.
I do have some experience with the Vera UI protocol. This interface is also HTTP based and only polls the controller once every 60 seconds, but reacts immediately when a device changes state. Vera does this via AJAX calls on which the headers are sent immediately but the "page content" (JSON) not yet as if your dealing with a very slow network connection. This content is sent when either a device changes state or after 60 second (and new AJAX call is sent immediately by the GUI).
The Vera protocol can be found in the Micasa Verde wiki under UI Simple and can be used for all type of user interface. Myself once developed a UI for a media PC application called MediaPortal , this was done in .Net. (It also merges multiple Vera controllers in one UI)
BTW There is a LCARS MediaPortal template
It's possible to do this with HTTP as well. For example use websockets (http://socket.io/) to keep the connection between the client and the server open. Then the server can push device state changes to your clients in real time without the client having to pull every x seconds.
Here's a blog post on using websockets in native Android and iOs apps. http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps
Domoticz has a good REST Api you can use but you'll need to implement the websockets part yourself.
A thin client architecture seems heavy. You'll need a decent server to connect all the clients that's on 24/7 and you have to work with VPN connections when you're not on your local network.
Thanks for the info about the Vera protocol and delayed AJAX calls. That seems evil but functional.
I'm still not entirely convinced that Vera is actually saving me much at that point; I find it extremely fiddly (when not outright buggy) to work with, and from looking over the OpenZWave API, that looks refreshingly straightforward.
But yes, @BartE, this would mean I dedicate a machine to being the ZWave (as well as thin client) server. I have several older Mac Minis lying around, as well as several more Raspberry Pis, any of which ought to be up to the job. They (plus an Aeon Zstick) would simply replace the Vera in my setup.
But I come here looking for advice, and I hear what you're saying, so I will be patient and give the Vera UI protocol an honest try. It may indeed save me a lot of time not having to write the server (and there's certainly appeal in having other controller apps available whenever mine is down for maintenance).
Since the Zstick is already on order, I will probably also play around a bit with Domoticz and OpenZWave... in a month or two I guess I'll have a good idea which is the path of least pain!
Just to follow up, I tried out the Verde UI protocol, and it works great! I was able to throw together this little demo:
...and it is quite responsive, in both directions (flipping the wall switch quickly updates the display, and tapping the on-screen button quickly switches the light).
I like Verde much better now that I've discovered its web service API. Thank you @BartE!
If I was to write something like this right now. I would probably use the MEAN stake.
With NodeJS and express you can have it do your api then add AngulerJS and Web Sockets to those two and you will have a very resonsive Web based UI.
Here is were it gets interesting. Python, C++, or C#. Python works with Nodejs very well. Windows 10 under the hood has some big changes which will make it very interesting for development. The new Windows Universal is really new (it is not even released) and very interesting. I have seen it called Core and Windows IoT. I'm right now toying around with Windows IoT on a Raspberry PI and attempting to create a MySensors gateway. I have had some adventures, and am close to putting it away for now until the next build, but it could be very Interesting.
I would set it up to use the Vera http API first and then add support for Z-Wave, MySensors, then Insteon.