TrickleStar [z-wave] Web App for Remotely Controlling Lights from any Web Browser, even your iPhone

If you haven't already done so you need to perform the actions discussed on this page. If you don't have a TrickleStar USB Stick or a z-wave device, than you're also going to need to have those to even hack the widget to work in the following web app writeup.

There are a number of data points we have to contend with and work with to build a web app for this. One of those data points is what the pyzwave app has access to, which is more specifically oriented at the z-wave network, and not the widget. It won't contain data points like the name of the devices, or their schedules for instance. That information is in the preferences file for the widget.

To read the name of the nodes from the z-wave widget preferences, without needing to update a separate file, we'll need to convert the binary preferences file to an xml file, and then read the plist using CFPropertyList (download that and place it into /Applications/MAMP/htdocs/cfpropertylist).

You'll also want to download iui located here: http://code.google.com/p/iui/ which will give you control of the app in an iPhone like web app type interface. The same thing needs to be done with iui, that you did with the CFPropertyList tool by placing the iui files into /Applications/MAMP/htdocs/iui.

This app also makes use of jquery, which points to a CDN version of the framework on google api's (no need to download).

  1. As with almost all of my blog entries and web apps, you're going to need to download and install MAMP, and configure it to run on startup. I discuss how to do that on this blog entry
  2. Download the zLightStar Web App
    and place the files in the root of the webserver at /Applications/MAMP/htdocs
  3. Next you're going to need to modify the custom_light.js file so that it points to your modified pyzwave server. Change the IP Address on line 33 to the IP of your 'z-wave server' as mentioned in the TrickleStar Dashboard Widget Hacking blog entry
  4. Point your web browser to the MAMP server, in my case it's http://192.168.1.xxx:8888, which you can also get to on your iPhone

The zLightStar Web App Download contains 4 files:

  • index.html - which houses the basic front-end html design/layout
  • parse.php - which makes use of the CFPropertyList tool, and also contains some ecec commands to convert the preferences plist from binary to xml, it also contains an exec command to copy the binary plist preferences file to the root of the http server (if you wanted your remote dashboard widgets to stay synced, you could have them download this file and replace it using a cron job)
  • custom_light.js - which houses the javascript code to post the data, and build the list of devices
  • zlightstar.png - which is an app icon, if/when you save the bookmark to your homescreen it will appear and look like an app, with no safari address bar, or bottom buttons, it will be fullscreen (this is partly to do with the meta tags in the head of index.html)

Accessing this web app remotely

I have a VPN server running on my network that I connect to, that allows me to get into my home network to control not only this but my torrent application, my HTPC, among other things. The other option is to open up the holes on your firewall and using a Dynamic DNS service (which you'll have to do anyways even if you're using VPN), and for basic security create an .htaccess username and password, but I don't recommend doing that. I think setting up a VPN server is a far safer methodology.

Limitations

So far I've only used this with the binary intermatic light module I have, but the TrickleStar USB Stick is supposed to work with dimmer switches as well. I am wondering if a door sensor, and a thermostat could be controlled as well. It might not be available, simply because TrickleStar didn't implement the frontend UI to control or respond to those devices. Interestingly if you start the pyzwave server manually it is basically listening to the z-wave network in almost real-time. I can manually hit the button on my z-wave device, and it will appear immediately, within seconds on the dashboard widget, as well as my web app (which refreshes automatically). So one of 2 things could happen, further modification to the pyzwave server to automatically run a script when a change is noted on the network, or have a script check the network at a specific interval to trigger actions. I am mainly thinking of door sensors, which again I'm not sure even work with the TrickleStar USB Stick and pyzwave server.

Future Ideas

For the long term I'm going to keep my eye on Open Z-wave. Unfortunately I don't have the know how to implement that library into a mac compatible app, but I have high hopes that someone out there is working on it... hopefully.

For the short term, I've considered doing silly things like if/when my iPhone is close enough to my wireless network and can be pinged, that I trigger a light to go on. It could also easily trigger other things to happen too. Or if neither my wife or my iphones are close enough to be pingable or connected to the network, to shut off all z-wave devices. If either one of us aren't home there is zero reason for anything to be on.

AttachmentSize
zLightStar.zip14.42 KB

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.