http XML Housebot protocol

HouseBot Plugin Development Discussions.
Post Reply
Timoh
Advanced Member
Posts: 260
Joined: Thu Feb 02, 2006 12:56 pm
Location: Montreal - Canada

http XML Housebot protocol

Post 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>
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Re: http XML Housebot protocol

Post 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/
Thanks,
Scott J
aka spike5884
roussell
Advanced Member
Posts: 268
Joined: Wed Dec 15, 2004 9:07 am
Location: Pelham, AL

Re: http XML Housebot protocol

Post 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
Timoh
Advanced Member
Posts: 260
Joined: Thu Feb 02, 2006 12:56 pm
Location: Montreal - Canada

Re: http XML Housebot protocol

Post 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
edgar
Member
Posts: 95
Joined: Tue Mar 24, 2009 11:14 pm
Location: Springfield, VA

Re: http XML Housebot protocol

Post 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
Post Reply