Hi Everybody,
 
I am very new to ZebKit but I found it interesting in conjunction with an IoT Integration Solution named openHAB. With openHAB you are able to connect everything in a Smarthome from almost very manufacturer you can think of. Unfortunately the build in UI is very ugly and in terms of flexibilty a desaster. So I tried to find an alternative for that part of openHAB. 
 
I can receive data from openHAB and send commands back via the openHAB REST API, like this:
 
Get the actual status of a data point called “anel5_relais4″:
var status = zebra.io.GET(“http://localhost:8080/rest/items/anel5_relais4/state”)
 
Set the datapoint “anel5_relais4″ to status ON:
zebra.io.GET(“http://localhost:8080/CMD?anel5_relais4=OFF”)
 
So, if I load my ZebKit Test GUI I can initialize a textfield like that:

CENTER: new TextField(zebra.io.GET(“http://localhost:8080/rest/items/anel5_relais4/state”), true)

 
This works. But now I have a static view of the state at the moment of loading the page. But ZebKit is just the view. openHAB is continuesly changing states, updates temperatures and so on.
How can I update the state of let’s say the above textfield in a periodic way? I have experimented with the <meta http-equiv=”refresh” content=”1″ > HTML Tag, but this leads to a complete reload of the GUI with an ugly flash effect.
 
Is there a more elegant way to do this?
 
Regards
 
Chris

Please login or Register to Submit Answer