Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Background on xAP ====== The best way to start understanding xAP is to read the [[http://www.xapautomation.org/index.php?title=Basic_Status_and_Control_Schema|Basic Status and Control message]] schema. A tool to help you view the endpoint control hierarchy - [[http://www.xapautomation.org/index.php?title=xFx_Viewer|xAP Message Viewer]] Here you can see all the endpoints on the Livebox Controller that can be directly addressed using the xAP protocol. There are many top level systems being hosted by the Livebox: [[:livebox:xap_adapter|Controller]], [[:livebox:xap_currentcost|CurrentCost]], [[:livebox:pachube|Pachube]], [[:livebox:sms|SMS]] {{:livebox:xfx-viewer.png|}} The preferred language for creating scripts to handle xAP messages is Lua. These scripts run in the [[:livebox:hah_plugboard_v2|Plugboard]] environment on the HAH. For information about programming the Livebox with xAP and Python see [[:livebox:hah_xap_python]] ===== xAPBSC.cmd ===== Using the xAPBSC.cmd class we can define actions. Turn on RF relay 1. <code> xAP-header { v=12 hop=1 uid=FF123400 class=xAPBSC.cmd source=acme.my.controller target=dbzoo.livebox.controller:rf.1 } output.state.1 { id=* state=on } </code> Display the string "Hello World" on the LCD display <code> xAP-header { v=12 hop=1 uid=FF123400 class=xAPBSC.cmd source=acme.my.controller target=dbzoo.livebox.controller:lcd } output.state.1 { id=* text=Hello World } </code> ===== xAPBSC.info / .event ===== Messages in xAPBSC.info and .event are sent to indicate the current state of an Input or Output. This sample message is telling us that Channel 1 of the CurrentCost device is using 576 watts of power.\\ A **.event** will be triggered as soon as a data value changes. <code> xAP-header { v=12 hop=1 uid=FF00DC01 class=xAPBSC.event source=dbzoo.livebox.CurrentCost:ch1.0 } input.state { level=576 } </code> **.info** messages are sent every couple of minutes to show the current state of the system. If we waited until events were sent, programs such as the [[http://www.xapautomation.org/index.php?title=xFx_Viewer|xAP Viewer]] would not be able to automatically figure out what is out there. <code> xAP-header { v=12 hop=1 uid=FF00DB0E class=xAPBSC.info source=dbzoo.livebox.Controller:rf.4 } output.state { state=off } </code> ===== xAPBSC.query ===== To get an immediate .INFO response from an end point we can direct a .query message to an endpoint or set of endpoints. For each target that matches, an .info response will be generated. <code> xap-header { v=12 hop=1 uid=FF00DB00 class=xAPBSC.query source= ACME.Controller.Central target= dbzoo.livebox.controller:relay } request { } </code> livebox/xap_getting_started.txt Last modified: 2012/06/19 15:26by minerva9