API
Obtain and update the GPIO
The API will return the updated config as return.
When passing a empty ‘list’, the current config will be returned, no update will be made
Available in 8.1.1 or later
Input Parameters
<GPIO_obj>
Type | Notation | Mandatory | Description | |
list | Array | list of <GPIO_Obj> | optional | List of GPIO config for updating |
reference | Boolean | <boolean> | optional | +++++ |
Return JSON
Type | Notation | Mandatory | Description | ||
id | Number | <integer> | Required | ||
enable | Boolean | <boolean> | Optional | GPIO enable | |
type | String | { digital_input, digital_output, analog_input } | Optional | GPIO type | |
mode | String | { input_sensing, ignition_sensing } { wan_status } { input_sensing, voltage_measurement, analog_testing } | Optional | For type=digital_input, { input_sensing, ignition_sensing } For type=digital_output, { wan_status } For type=analog_input, { input_sensing, voltage_measurement, analog_testing } | |
delay | Number | [ 1, 3600 ] | Optional | GPIO delay ONLY for input type |
Return Parameters
Return JSON
Type | Notation | Description | |
<gpio_id> | Object | <GPIO_Obj> | GPIO information for the <gpio_id> |
order | Array | list of <gpio_id> | The order of the ids |
reference | Object | <GPIO_Ref_Map_Obj> | Provide the the support type and mode for each <gpio_id> |
<GPIO_Obj>
Type | Notation | Description | |
enable | Boolean | <boolean> | GPIO enable |
type | String | { digital_input, digital_output, analog_input } | GPIO type |
mode | String | { input_sensing, ignition_sensing } { wan_status } { input_sensing, voltage_measurement, analog_testing } | For type=digital_input, { input_sensing, ignition_sensing } For type=digital_output, { wan_status } For type=analog_input, { input_sensing, voltage_measurement, analog_testing } |
delay | Number | [ 1, 3600 ] | GPIO delay ONLY for input type |
<GPIO_Ref_Map_Obj>
Type | Notation | Description | |
<gpio_id> | Object | <GPIO_Ref_Obj> | GPIO reference for the <gpio_id> |
order | Array | list of <gpio_id> | The order of the id’s |
<GPIO_Ref_Obj>
Type | Notation | Description | |
name | String | <string> | GPIO name |
type | Array | list of { digital_input, digital_output, analog_input } | Which GPIO type support for the <gpio_id> |
mode | Object | <GPIO_Ref_Mode_Obj> | Which GPIO mode is supported for the specific GPIO type |
<GPIO_Ref_Mode_Obj>
Type | Notation | Description | |
digital_input | Array | list of { input_sensing, ignition_sensing } | Support mode for digital_input type |
digital_output | Array | list of { wan_status } | Support mode for digital_output type |
analog_input | Array | list of { input_sensing, voltage_measurement, analog_testing } | Support mode for analog_input type |
cURL Example
curl -b cookies.txt -H "Content-Type: application/json" -X POST -d '{"list": [{"id":1,"enable":true,"type":"digital_output","mode":"toggle_high"}, "id":2,"enable":true,"type":"digital_input","mode":"input_sensing","delay":3}]}' http://192.168.1.1/api/config.gpio
{ "stat": "ok", "response": { "1": { "enable": true, "type": "digital_output", "mode": "toggle_high" }, "2": { "enable": true, "type": "digital_input", "mode": "input_sensing", "delay": 3 }, "order": [ 1, 2 ] } }