wiki:Internal/RFSwitch

Version 2 (modified by jkol, 8 years ago) ( diff )

RF Switch

REST API

All valid calls will reply with formatted XML. The first line will be <response status="OK"> for commands that execute correctly, or <response status="ERROR"> if either the parameters passed are invalid of the call failed for some other reason (check /var/log/syslog on the relevant Pi for more information).

REST API Call Description
/RFSwitch/set_rf?switch=<int>&rf=<int> Sets the requested switch (1 to 4) to rf port (1 or 2)
/RFSwitch/status Returns status information: total number of switches and the individual switch states (what rf ports they are set to).

Example XML responses:

Response to: …/RFSwitch/set_rf?switch=1&rf=2

<?xml version="1.0" encoding="UTF-8"?>
<response status="OK">
  <action service="rf_switch" name="set_rf">
    <nodes>
      <node ip="10.3.0.28" return="0"/>
    </nodes>
  </action>
</response>

Response to: …/RFSwitch/status

<?xml version="1.0" encoding="UTF-8"?>
<response status="OK">
  <action service="rf_switch" name="status">
    <nodes>
      <node ip="10.3.0.28" mac="b8:27:eb:96:84:c8" uptime="2974" num_of_switches="4" switch1="2" switch2="1" switch3="1" switch4="1"/>
    </nodes>
  </action>
</response>

Note: See TracWiki for help on using the wiki.