Page 1 of 1

http XML Housebot protocol

Posted: Mon Jun 13, 2011 12:28 pm
by Timoh
Hi folks,
I'm at the point with my browser HB client project where I will developing the HB communications between the browser and web serve.
As a result I'm looking for suggestions, wish-lists, ideas, of what HB users would like to see in an XML communication protocol with the HB (web) server.

In it's simplest form I'm looking to send xml back and forth containing device names, property names, property values, task names and task status. I plan on providing at least two methods for getting data... An "all" request which will essentially grab everything it can and return it via xml, and a "specific" request that will return one or more values based on your request.

The requests & response format will be very similar in XML structure. However, a request will have no value or a blank value specified. If a value is specified, the server will interpret that as value change.

I think this feedback is important, as I suspect folks will use the xml protocol for other reasons than just the browser client.

Thanks
Tim

Example of pseudo protocol below:
To request all values...
<HBcom Type="Request-All"/>

Response from server to client...
<HBcom Type="Response-All">
<Devices>
<Device="Kitchen Light" Property="State">On</Device>
<Device="Amplifier" Property="Volume">11</Device>
</Devices>
<Tasks>
<Task="Get Weather">Running</Task>
</Tasks>
</HBcom>

Requesting a value(s) from the server...
<HBcom Type="Request">
<Devices>
<Device="Kitchen Light" Property="State"></Device>
</Devices>
<Tasks>
<Task="Get Weather"></Task>
</Tasks>
</HBcom>

Would yield something like this...
<HBcom Type="Response-Request">
<Devices>
<Device="Kitchen Light" Property="State">On</Device>
</Devices>
<Tasks>
<Task="Get Weather">Running</Task>
</Tasks>
</HBcom>

Setting a value would be something like...
<HBcom Type="Request">
<Devices>
<Device="Kitchen Light" Property="State">Off</Device>
</Devices>
</HBcom>

With a response back like...
<HBcom Type="Response-Request">
<Devices>
<Device="Kitchen Light" Property="State" Successful="Yes">Off</Device>
</Devices>
</HBcom>

Re: http XML Housebot protocol

Posted: Mon Jun 13, 2011 9:49 pm
by spike5884
Instead of XML, you might want to look into JSON. It is sort of XML like, but not as 'bloated'. According to our web developer at work, it mixes nicely with the JavaScript for their websites.

http://www.json.org/

Re: http XML Housebot protocol

Posted: Tue Jun 14, 2011 10:00 am
by roussell
I second the use of JSON. I use it a good bit in place of XML, a lot less 'fluff' in the data but still human-readable when needed.

As an example, here is some JSON from my thermostat (Filtrete WiFi from Home Depot) :

Code: Select all

{"temp":76.00,"tmode":2,"fmode":0,"override":0,"hold":1,"t_cool":76.00,"tstate":0,"fstate":0,"time":{"day":1,"hour":8,"minute":58},"t_type_post":0}
Terry

Re: http XML Housebot protocol

Posted: Tue Jun 14, 2011 1:11 pm
by Timoh
Well after two votes, JSON it is! ;)

There are some c++ libraries for JSON, which I hope are a heck of lot easier to use than the xml libraries, and it looks it's obviously well supported in JS.

No doubt after I've got it finished and working, someone will want xml. :s

Tim

Re: http XML Housebot protocol

Posted: Tue Jun 14, 2011 10:55 pm
by edgar
Glad to hear that too Timoh!
JSON is used by both XBMC and Eventghost both of which i use quite a bit with my House/Media. I have not worked with it much but it seems to be quite popular.

v/r

Kevin