Creating a Simply HTML on/off panel with status

Situation: small museum with ~30 z-wave module controlled exhibits. A few staff members have access to the main Vera UI, for maintaining the system. However – for other staff members who might just need to turn something on or off, I have a very minimalist control UI. This other UI is a very simple web page hosted on a separate local web server that I use to give general staff access to individual controls. It consists of various descriptions of individual z-wave modules, with an “ON” and “OFF” link for each one.

The Vera2 is running UI5, and has a static IP assigned.

An example of an individual control link is:

<li><b>Theremin:</b>    <a href="#" onclick="miosExecute(12,1)">On</a> <a href="#" onclick="miosExecute(12,0)">Off</a></li>

miosExcute() is a javascript function defined within the section of my webpage:

<script type="text/javascript">
	function miosExecute(DeviceNum,Requested) {
		$.get("http://10.46.1.6:3480/data_request?id=action&output_format=xml&DeviceNum="+DeviceNum+"&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue="+Requested);
	
	return false;
	}
</script>

This works - and is useful for staff that don’t need all of the control details that the regular UI offers … but still on occasion need to turn individual items on and off.

What I would now like to add is a simple status indicator of ON/OFF for each individual module. I’m pretty sure what I’m looking for is contained within: http://wiki.micasaverde.com/index.php/UI_Notes#Building_a_control-only_UI_for_Vera - but I’m having trouble distilling it down to just exactly what I need to parse in order to get the status variable out of the rather long JSON or XML data strings that are returned. Ideally, I’d like to have a function that I can call with the DeviceNum variable, and have it return status 0/1 that I can then use to display an on/off graphic.

This interface does not have to be fancy. It does not need to provide a continuously updating polling of devices. Rather - it should provide a snapshot of how things were when the page was loaded.

Use case:

  1. A staff member needs to check why the Theremin isn’t working, so they pull up this web page.
  2. The web page loads, and as it does so, checks status on all 30 or so Z-Wave modules in use, displaying on/off indicators
  3. The staff notices that the Theremin shows OFF, so they click the corresponding “ON” button.
  4. The page then waits a small delay, say 5 seconds allowing the ON action to take place, and then reloads the page checking status, hopefully now displaying ON for the Theremin.

Right now this is what happens - with the exception that there is no delay/feedback that anything worked or didn’t work. It just reloads the page. In theory, one can then walk over check in person if the device was in fact turned on, but it would be nice to be able to provide a minimal ON/OFF status indicator.

If anyone can help distil the examples, to extract the status of a given DeviceNum - I’d be grateful.

Thanks,
-Eric

Have a look at the Smartphone Plugin. This basically creates a page just like you need it and it also includes the staus of the devices. I am sure you can pull some examples from there. I adjusted it to run from an usbstick plugged into my vera…

Any luck on this? I am trying to do something very similar for a custom Android app. After deciphering what works for other types of devices I was able to get this working:

http://VERA_IP:3480/data_request?id=lu_variableget&DeviceNum=171&serviceId=urn:upnp-org:serviceId:SwitchPower1&Variable=Status

That returns the 0 or 1 status.

Then, for a Thermostat, you have to explore the types of properties you want to check. For example, getting just the current temperature can be achieved like so:

http://VERA_IP:3480/data_request?id=lu_variableget&DeviceNum=161&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature

To find the other variables and serviceIds to build up your UI, try playing around with the messages returned in this type of query:

http://VERA_IP:3480/data_request?id=lu_status&DeviceNum=160

For Web Based apps I would recommend setting up the Dashboard for the devices that people need access … This is the default page when you connect to Vera (on UI5).

For Smart Phone Apps, I would use existing Apps, most have some way off setting up favorites and/or hiding devices.

It’s a LOT of work to do one of these applications in a reliable/robust manner.
Leverage off of what is already done.

HTTP Requests for individual devices will turn into a nightmare after more than a handful of devices are used.