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:
- A staff member needs to check why the Theremin isn’t working, so they pull up this web page.
- 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
- The staff notices that the Theremin shows OFF, so they click the corresponding “ON” button.
- 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