Difference between revisions of "Template:Networking rutos manual input output"
(87 intermediate revisions by 14 users not shown) | |||
Line 1: | Line 1: | ||
− | {{Template: | + | {{Template:Networking_rutos_manual_fw_disclosure |
− | | | + | | fw_version = {{{series}}}_R_00.02.05.1 |
− | + | | series = {{{series}}} | |
− | |||
− | |||
− | |||
− | |||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Summary== | ==Summary== | ||
Line 23: | Line 13: | ||
}} | }} | ||
− | == | + | {{#switch: {{{series}}} |
+ | | RUTX = | ||
+ | ==Power Socket Pinout== | ||
+ | |||
+ | The router's input/output pins can be found inside the power socket: | ||
+ | |||
+ | [[File:Networking_rutos_manual_input_output_power_socket_pinout_configurableio_{{{configurableio}}}.png]] | ||
+ | ---- | ||
+ | The electric characteristics for the input and output pins are as follows: | ||
+ | <ul> | ||
+ | <li><b>Power</b>: 9-50 VDC positive (+).</li> | ||
+ | <li><b>Ground</b>: negative/ground (-).</li> | ||
+ | <li><b>Input</b>: digital non-isolated input. | ||
+ | <ul> | ||
+ | <li><i>logical low level:</i> 0 - 5 V;</li> | ||
+ | <li><i>logical high level:</i> 8 - 40 V.</li> | ||
+ | </ul> | ||
+ | </li> | ||
+ | <li><b>Output</b>: digital open collector (OC) output; 30 V, 300 mA.</li> | ||
+ | </ul> | ||
+ | | TRB1 = | ||
+ | {{#ifeq:{{{name}}}|TRB141 | ||
+ | | | ||
+ | ==Characteristics== | ||
− | + | TRB141 has eighteen input/output pins, two of them can be found inside the power socket and the rest sixteen are on the side of the device. A list of Input/Output electric characteristics inherent in TRB141 devices can be found below. | |
− | + | ===Power Socket Pinout=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
---- | ---- | ||
− | [[File: | + | [[File:Networking_rutos_manual_input_output_power_socket_pinout_configurableio_{{{configurableio}}}.png]] |
<ul> | <ul> | ||
− | <li><b> | + | <li><b>Power</b>: 9-30 VDC positive (+).</li> |
+ | <li><b>Ground</b>: negative/ground (-).</li> | ||
+ | <li><b>I/O</b>: programmable input/output pins; can be set to: | ||
<ul> | <ul> | ||
− | <li>< | + | <li><i>open collector (OC) output;</i> max 30 V;</li> |
− | <li>< | + | <li><i>digital input;</i> 0-7.3 V is detected as logical "0"; 7.3-30 V is detected as logical "1".</li> |
</ul> | </ul> | ||
</li> | </li> | ||
− | + | </ul> | |
− | + | ||
− | + | ===Input/Output Connector Pinout=== | |
− | <li><b> | + | ---- |
+ | [[File:Networking_trb141_manual_input_output_input_output_connector_pinout.png]] | ||
+ | |||
+ | *'''DI1''' and '''DI2''' are DRY/WET configurable inputs. WET: 0-1.9 V is detected as logical "0", 1.9-3.8 V is detected as logical "1". DRY: Logical "0" is detected when input is shorted to GND, otherwise input is detected as logical "1". | ||
+ | *'''NC<sub>1</sub> C<sub>1</sub>''' and '''NO<sub>1</sub>''' are respectively Normally Closed, Common and Normally Open contacts of internal Non-Latching Relay. Maximum relay ratings: 0.5A at 60 VDC/70 VAC, 1A at 30 VDC/VAC. | ||
+ | *'''NC<sub>2</sub> C<sub>2</sub>''' and '''NO<sub>2</sub>''' are respectively Normally Closed, Common and Normally Open contacts of internal Latching Relay. Maximum relay ratings: 0.8A at 70 VDC, 0.9A at 70 VAC, 2A at 30 VDC/VAC. | ||
+ | *'''A''' is ADC input. Analog voltage range 0 - 30 V. Input can be configured for 4-20mA sensor protocol as current measurement of 0 - 30 mA. | ||
+ | *'''l''' and '''⏚''' are isolated input contacts. 0-7.3 V is detected as logical "0", 7.3-71 V is detected as logical "1". | ||
+ | *'''+''' is power output connected directly to gateway's power supply input pin. This Output can be used for powering external 4-20 mA current sensor. | ||
+ | *'''3.8''' is 3.8V power output which can be used to power 1-Wire sensors when needed. | ||
+ | *'''1W''' 1-Wire protocol input/output. | ||
+ | *'''⏚''' is GND contact. | ||
+ | |||
+ | | | ||
+ | |||
+ | ==Characteristics== | ||
+ | |||
+ | {{{name}}} input/output pins can be found inside the power socket: | ||
+ | |||
+ | ===Power Socket Pins=== | ||
+ | ---- | ||
+ | [[File:Networking_rutos_manual_input_output_power_socket_pinout_configurableio_{{{configurableio}}}.png]] | ||
+ | |||
+ | <ul> | ||
+ | <li><b>Power</b>: 9-30 VDC positive (+).</li> | ||
+ | <li><b>Ground</b>: negative/ground (-).</li> | ||
+ | <li><b>I/O</b>: programmable input/output pins; can be set to: | ||
<ul> | <ul> | ||
− | <li>0- | + | <li><i>open collector (OC) output;</i> max 30 V;</li> |
− | + | <li><i>digital input;</i> 0-5 V is detected as logical "0"; 8-40 V is detected as logical "1".</li> | |
</ul> | </ul> | ||
</li> | </li> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</ul> | </ul> | ||
− | | | + | }} |
+ | |||
+ | | TRB2XX = | ||
+ | |||
+ | | | ||
+ | }} | ||
+ | |||
+ | ==Status== | ||
+ | |||
+ | The <b>Status</b> page displays the current states of the device's input and output pins: | ||
+ | |||
+ | {{#ifeq: {{{name}}} | TRB141 | ||
+ | | [[File:Networking_trb141_manual_input_output_status.png|border|class=tlt-border]] | ||
+ | | [[File:Networking_{{lc:{{{series}}}}}_manual_input_output_status.png|border|class=tlt-border]] | ||
+ | }} | ||
+ | You can invert an Input pin by clicking the on/off slider under the "Inversion" column or switch the state of an Output pin by clicking the on/off slider under the "State" column. | ||
+ | |||
+ | {{#switch:{{{series}}} | ||
+ | | TRB2 = ===Status from command line=== | ||
---- | ---- | ||
− | + | You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices: | |
+ | |||
+ | ioman.adc.adc0 | ||
+ | ioman.gpio.dio0 | ||
+ | ioman.gpio.dio1 | ||
+ | ioman.gpio.dio2 | ||
+ | |||
+ | Call command <b>ubus call <u>value</u> status </b>: | ||
+ | root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dio0 status | ||
+ | { | ||
+ | "value": "0", | ||
+ | "direction": "out", | ||
+ | "bi_dir": true, | ||
+ | "invert_input": false | ||
+ | } | ||
<ul> | <ul> | ||
− | <li><b> | + | <li><b>dio0</b> is configurable input / output: |
<ul> | <ul> | ||
− | <li>0 | + | <li>"value": "<b>0</b>" means low level state.</li> |
− | <li>1. | + | <li>"value": "<b>1</b>" means high level state.</li> |
</ul> | </ul> | ||
− | <li>< | + | </li> |
+ | <li><b>adc0</b> is analog input: | ||
<ul> | <ul> | ||
− | <li> | + | <li>"value": "<b>0.54</b>" means 0.54V.</li> |
− | |||
</ul> | </ul> | ||
− | + | </li> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</ul> | </ul> | ||
+ | | TRB1 = {{#ifeq:{{{name}}}|TRB141 | ||
+ | | ===Status from command line=== | ||
---- | ---- | ||
− | < | + | You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices: |
− | + | ioman.acl.acl0 | |
− | + | ioman.adc.adc0 | |
− | + | ioman.dwi.dwi0 | |
− | + | ioman.dwi.dwi1 | |
− | + | ioman.gpio.dio0 | |
+ | ioman.gpio.dio1 | ||
+ | ioman.gpio.iio | ||
+ | ioman.gpio.onewire | ||
+ | ioman.relay.relay0 | ||
+ | ioman.relay.relay1 | ||
+ | |||
+ | In order to read value use '''''status''''' command. | ||
+ | |||
+ | ubus call ioman.gpio.dio0 status | ||
+ | ubus call ioman.relay.relay0 status | ||
+ | |||
+ | To change input settings use '''''update''''' command and write the value. | ||
+ | |||
+ | ubus call ioman.gpio.dio0 update '{"value":"0"}' | ||
+ | ubus call ioman.gpio.dio0 update '{"value":"1"}' | ||
+ | |||
+ | To change relay settings use '''''update''''' command and write state. | ||
+ | |||
+ | ubus call ioman.relay.relay0 update '{"state":"open"}' | ||
+ | ubus call ioman.relay.relay0 update '{"state":"closed"}' | ||
+ | |||
+ | ===Reading I/O values from directory=== | ||
+ | ---- | ||
+ | |||
+ | You can also collect I/O values straight from directories in your device. | ||
+ | |||
+ | ====Digital inputs, Relay outputs==== | ||
+ | ---- | ||
+ | |||
+ | Following is a list of I/O directories in '''''/sys/class/gpio/''''': | ||
+ | |||
+ | dwi1(dry wet) input 14; toggle 12 (to read value refer to gpio14, to change state dry/wet refer to gpio12) | ||
+ | dwi2(dry wet) input 15; toggle 38 (to read value refer to gpio15, to change state dry/wet refer to gpio38) | ||
+ | relay open 20; closed 22; (turn off gpio20 set to 0, turn on gpio22 set value to 1; and visa versa) | ||
+ | latching relay open 23; close 21 (turn off gpio23 set to 0, turn on gpio21 set value to 1; and visa versa) | ||
+ | dio0 (power socket) input 13; output 16 (direction can be changed, to read input use gpio13, to control output use gpio16) | ||
+ | dio1 (power socket) input 17; output 78 (direction can be changed, to read input use gpio17, to control output use gpio78) | ||
+ | iio (isolated input) input 1021 (to read value refer to gpio1021) | ||
+ | |||
+ | In order to read digital input value use '''''cat''''' command. | ||
+ | |||
+ | cat /sys/class/gpio/gpio14/value | ||
+ | cat /sys/class/gpio/gpio15/value | ||
+ | cat /sys/class/gpio/gpio1021/value | ||
+ | |||
+ | To change input state use '''''echo''''' command where "1" is "dry" state and "0" is "wet" state. | ||
+ | |||
+ | echo 0 > /sys/class/gpio/gpio12/value | ||
+ | echo 1 > /sys/class/gpio/gpio38/value | ||
+ | |||
+ | When one Relay output is open, other one is closed, so turning on/off the output you will have to change value on both pins. For that '''''echo''''' command is used. Same principle applies to Latching Relay output. | ||
+ | |||
+ | echo 1 > /sys/class/gpio/gpio20/value & echo 0 > /sys/class/gpio/gpio22/value | ||
+ | echo 1 > /sys/class/gpio/gpio23/value & echo 0 > /sys/class/gpio/gpio21/value | ||
+ | |||
+ | ====ADC (Analog Input)==== | ||
+ | ---- | ||
+ | |||
+ | ADC (Analog input) can be read from different directory, '''''/sys/devices/qpnp-vadc-8/mpp4_vadc''''' also using '''''cat''''' command, but received Result value has to be divided by 126582 to get number in volts. | ||
+ | |||
+ | cat /sys/devices/qpnp-vadc-8/mpp4_vadc | ||
− | + | ====One-wire==== | |
− | + | ---- | |
− | + | To read one-wire sensor data you will need to follow these steps: | |
− | + | Set one-wire sensor '''''value''''' to '''''1''''' using '''''ubus''''' command. | |
− | + | ubus call ioman.gpio.onewire update '{"value":"1"}' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | After that list out connected one-wire devices in directory '''''/sys/bus/w1/devices''''' with '''''ls''''' command. | |
− | + | ls /sys/bus/w1/devices | |
− | + | Choose sensor that you want to know values off and using '''''cat''''' command read them from '''''/sys/bus/w1/devices/<device_name>/w1_slave''''' directory. | |
− | |||
− | |||
− | |||
− | ''' | ||
− | + | cat /sys/bus/w1/devices/<device_name>/w1_slave | |
− | |||
− | |||
− | |||
− | |||
+ | | <!-- For TRB1 --> | ||
===Status from command line=== | ===Status from command line=== | ||
---- | ---- | ||
− | You can also obtain the status of input | + | You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices: |
− | + | ioman.gpio.din1 | |
− | + | ioman.gpio.dout1 | |
− | + | ||
− | + | Call command <b>ubus call <u>value</u> status </b>: | |
− | + | root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dout1 status | |
− | + | { | |
+ | "value": "0", | ||
+ | "direction": "in", | ||
+ | "bi_dir": false, | ||
+ | "invert_input": false | ||
+ | } | ||
+ | |||
+ | <ul> | ||
+ | <li><b>din1</b> is the input: | ||
+ | <ul> | ||
+ | <li>"value": "<b>0</b>" means low level state.</li> | ||
+ | <li>"value": "<b>1</b>" means high level state.</li> | ||
+ | </ul> | ||
+ | </li> | ||
+ | <li><b>dout1</b> is the output: | ||
+ | <ul> | ||
+ | <li>"value": "<b>0</b>" means low level state.</li> | ||
+ | <li>"value": "<b>1</b>" means high level state.</li> | ||
+ | </ul> | ||
+ | </li> | ||
+ | </ul> | ||
}} | }} | ||
+ | | <!-- For RUTX --> | ||
+ | ===Status from command line=== | ||
+ | ---- | ||
+ | You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices: | ||
+ | |||
+ | ioman.gpio.dio0 | ||
+ | ioman.gpio.dio1 | ||
+ | |||
+ | Call command <b>ubus call <u>value</u> status </b>: | ||
+ | root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dio0 status | ||
+ | { | ||
+ | "value": "0", | ||
+ | "direction": "in", | ||
+ | "bi_dir": false, | ||
+ | "invert_input": false | ||
+ | } | ||
− | + | <ul> | |
− | + | <li><b>din1</b> is the input: | |
− | + | <ul> | |
+ | <li>"value": "<b>0</b>" means low level state.</li> | ||
+ | <li>"value": "<b>1</b>" means high level state.</li> | ||
+ | </ul> | ||
+ | </li> | ||
+ | <li><b>dout1</b> is the output: | ||
+ | <ul> | ||
+ | <li>"value": "<b>0</b>" means low level state.</li> | ||
+ | <li>"value": "<b>1</b>" means high level state.</li> | ||
+ | </ul> | ||
+ | </li> | ||
+ | </ul> | ||
}} | }} | ||
==Post/Get== | ==Post/Get== | ||
− | Enabling <b>Post/Get</b> provides the possibility to control the state of an output via HTTP POST/GET requests. The figure below is an example of the Auth Settings section of the Post/Get page. It is used to turn Post/Get | + | Enabling <b>Post/Get</b> provides the possibility to control the state of an output via HTTP POST/GET requests. The figure below is an example of the Auth Settings section of the Post/Get page. It is used to turn Post/Get on or off and to set authentication parameters. |
− | [[File: | + | [[File:Networking_rutos_manual_input_output_post_get_auth_settings.png|border|class=tlt-border]] |
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 153: | Line 307: | ||
<tr> | <tr> | ||
<td>Enable</td> | <td>Enable</td> | ||
− | <td>off | + | <td>off | on; default: <b>off</b></td> |
<td>Turns Post/Get on or off.</td> | <td>Turns Post/Get on or off.</td> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 177: | Line 326: | ||
</tr> | </tr> | ||
</table> | </table> | ||
− | |||
− | |||
===Post/Get examples=== | ===Post/Get examples=== | ||
---- | ---- | ||
− | Use a web browser or any other compatible software to | + | It is possible to turn the output on and off by using a valid HTTP POST/GET syntax. Use a web browser or any other compatible software to submit HTTP POST/GET strings to the device. |
− | + | Below is a table containing syntax examples of this usage: | |
− | |||
− | |||
<table class="nd-othertables_2"> | <table class="nd-othertables_2"> | ||
Line 193: | Line 338: | ||
<th style="width: 900px">POST/GET URL</th> | <th style="width: 900px">POST/GET URL</th> | ||
</tr> | </tr> | ||
− | + | {{#ifeq:{{{configurableio}}}|1| | |
<tr> | <tr> | ||
<td>Turn Output state to high</td> <!-- another ifeq to change ip subnet according to trb14x... --> | <td>Turn Output state to high</td> <!-- another ifeq to change ip subnet according to trb14x... --> | ||
− | <td><nowiki>http://192.168.</nowiki>{{# | + | <td><nowiki>http://192.168.</nowiki>{{#ifeq:{{{series}}}|TRB1|2|1}}.1/cgi-bin/<span style="color: #0054a6;"><b>io_state</b></span><nowiki>?username=user1&password=user1&pin=</nowiki>{{#ifeq:{{{series}}}|RUTX|dout1|dio1}}<span style="color: #0054a6;"><b><nowiki>&state=on</nowiki></b></span></td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Turn Output state to low after 5 seconds for 3 seconds</td> | <td>Turn Output state to low after 5 seconds for 3 seconds</td> | ||
− | <td><nowiki>http://192.168.</nowiki>{{# | + | <td><nowiki>http://192.168.</nowiki>{{#ifeq:{{{series}}}|TRB1|2|1}}.1/cgi-bin/<span style="color: #0054a6;"><b>io_state</b></span><nowiki>?username=user1&password=user1&pin=</nowiki>{{#ifeq:{{{series}}}|RUTX|dout1|dio1}}&state=on<span style="color: #0054a6;"><b><nowiki>&delay=5</nowiki></b></span><span style="color: #3232ff;"><b><nowiki>&time=3</nowiki></b></span></td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
− | <td> | + | <td>Change Configurable Input/Output with pin3 to Output</td> |
− | <td><nowiki>http://192.168.</nowiki>{{# | + | <td><nowiki>http://192.168.</nowiki>{{#ifeq:{{{series}}}|TRB1|2|1}}.1/cgi-bin/<span style="color: #0054a6;"><b>io_type</b></span><nowiki>?username=user1&password=user1&</nowiki><span style="color: #0054a6;"><b>pin=dio1</b></span><span style="color: #3232ff;"><b><nowiki>&type=out</nowiki></b></span></td> |
</tr> | </tr> | ||
+ | | | ||
<tr> | <tr> | ||
− | + | <td>Turn Output state to high</td> | |
− | + | <td><nowiki>http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1</nowiki><span style="color: #0054a6;"><b><nowiki>&state=on</nowiki></b></span></td> | |
</tr> | </tr> | ||
− | |||
<tr> | <tr> | ||
− | + | <td>Turn Output state to low after 5 seconds for 3 seconds</td> | |
− | + | <td><nowiki>http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on</nowiki><span style="color: #0054a6;"><b><nowiki>&delay=5</nowiki></b></span><span style="color: #3232ff;"><b><nowiki>&time=3</nowiki></b></span></td> | |
</tr> | </tr> | ||
− | + | }} | |
− | + | ||
</table> | </table> | ||
<b>Overview</b>: | <b>Overview</b>: | ||
<ul> | <ul> | ||
− | <li>192.168.{{# | + | <li>192.168.{{#ifeq:{{{series}}}|TRB1|2|1}}.1 - device default LAN IP address; replace it in accordance with your own configuration.</li> |
− | {{#ifeq:{{{configurableio}}}|1|<li>io_state | + | {{#ifeq:{{{configurableio}}}|1|<li>io_state or io_type - allows you to change IO state or type.</li>}} |
<li>username - login name from Post/Get configuration.</li> | <li>username - login name from Post/Get configuration.</li> | ||
<li>password- password from Post/Get configuration.</li> | <li>password- password from Post/Get configuration.</li> | ||
<li>state - turn Output on or off.</li> | <li>state - turn Output on or off.</li> | ||
{{#ifeq:{{{configurableio}}}|1|<li>type - turn Configurable Input/Output to Input or Output.</li>}} | {{#ifeq:{{{configurableio}}}|1|<li>type - turn Configurable Input/Output to Input or Output.</li>}} | ||
− | |||
<li>delay - defines a delay (in seconds) after which the specified action will be performed.</li> | <li>delay - defines a delay (in seconds) after which the specified action will be performed.</li> | ||
<li>time - defines a window of time during which the action will take place. For instance, if you post an <i>on</i> action while specifying <i>time=5</i>, the output will turn on and stay on for 5 seconds before turning off.</li> | <li>time - defines a window of time during which the action will take place. For instance, if you post an <i>on</i> action while specifying <i>time=5</i>, the output will turn on and stay on for 5 seconds before turning off.</li> | ||
Line 238: | Line 382: | ||
<b>Examples:</b> | <b>Examples:</b> | ||
− | + | <ul> | |
− | + | <li><b>Switch output to High:</b><br><pre>curl -X GET "http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on"</pre></li> | |
− | + | <li><b>Switch output to Low after delay:</b><br><pre>curl -X GET "http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=off&delay=5"</pre></li> | |
− | + | </ul> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Scheduler== | ==Scheduler== | ||
− | The output <b>Scheduler</b> can be used to configure a timetable of when an output should be turned on or off, based on days of the week | + | The output <b>Scheduler</b> can be used to configure a timetable of when an output should be turned on or off, based on days of the week and hours of the day. Below is an example of the Scheduler section. |
− | [[File: | + | [[File:Networking_rutos_manual_input_output_scheduler_configure_scheduler_configurableio_{{{configurableio}}}.png|border|class=tlt-border]] |
− | + | Each field represents a day of the week and an hour of the day. The Scheduler table itself is interactive; click on different fields to set the state of an output for a specific window of time. For example: | |
− | [[File: | + | [[File:Networking_rutos_manual_input_output_scheduler_configure_scheduler_example_configurableio_{{{configurableio}}}.png|border|class=tlt-border]] |
− | + | The Scheduler is turned off by default. To turn it on set the 'Enable' slider to "on". | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==I/O Juggler== | ==I/O Juggler== | ||
Line 349: | Line 403: | ||
The <b>I/O Juggler</b> is a feature that provides the possibility to create automated rules that perform certain actions based on Input state changes and other conditions. The operating sequence of I/O Juggler can be visualized as such: | The <b>I/O Juggler</b> is a feature that provides the possibility to create automated rules that perform certain actions based on Input state changes and other conditions. The operating sequence of I/O Juggler can be visualized as such: | ||
− | [[File:Networking_rutos_manual_input_output_io_juggler_scheme_condition_mobile_{{{mobile}}}.png | + | [[File:Networking_rutos_manual_input_output_io_juggler_scheme_condition_mobile_{{{mobile}}}.png]] |
When an Input Trigger occurs, the Input check to see if user-specified conditions are also met. If so, it executes a user-specified action. | When an Input Trigger occurs, the Input check to see if user-specified conditions are also met. If so, it executes a user-specified action. | ||
Line 452: | Line 506: | ||
Sends an email to specified recipients. Requires an existing email account configuration on the device. Email accounts can be configured in the System → Administration → Recipients → [[{{{name}}}_Administration#Email_Accounts|Email Accounts]] page. | Sends an email to specified recipients. Requires an existing email account configuration on the device. Email accounts can be configured in the System → Administration → Recipients → [[{{{name}}}_Administration#Email_Accounts|Email Accounts]] page. | ||
− | + | [[File:Networking_rutos_manual_input_output_io_juggler_actions_email.png|border|class=tlt-border]] | |
− | |||
− | |||
− | |||
− | |||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 478: | Line 528: | ||
<td>positive integer; default: <b>none</b></td> | <td>positive integer; default: <b>none</b></td> | ||
<td>A period of time (in seconds) which has to pass after a trigger event before the action is executed.</td> | <td>A period of time (in seconds) which has to pass after a trigger event before the action is executed.</td> | ||
− | </tr> | + | </tr> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<tr> | <tr> | ||
<td>Email account</td> | <td>Email account</td> | ||
Line 496: | Line 540: | ||
</tr> | </tr> | ||
</table> | </table> | ||
+ | {{#ifeq: {{{mobile}}} | 1 | | ||
+ | ====Type: SMS==== | ||
+ | ---- | ||
+ | Sends an SMS message to specified recipients. | ||
+ | |||
+ | [[File:Networking_rutos_manual_input_output_io_juggler_actions_sms.png|border|class=tlt-border]] | ||
+ | <table class="nd-mantable"> | ||
+ | <tr> | ||
+ | <th>Field</th> | ||
+ | <th>Value</th> | ||
+ | <th>Description</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Text message</td> | ||
+ | <td>string; default: <b>none</b> </td> | ||
+ | <td>SMS body text. Below this field you can find special codes that begin with the '%' sign. Each code represents a piece information related to the status of the device. Include these codes in the Text message for dynamic information reports.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Execution delay</td> | ||
+ | <td>positive integer; default: <b>none</b></td> | ||
+ | <td>A period of time (in seconds) which has to pass after a trigger event before the action is executed.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Recipients</td> | ||
+ | <td>Single number {{!}} Group; default: <b>Single number</b></td> | ||
+ | <td>Defines whether the SMS message will be sent to a single number or multiple numbers included in a user-configured Phone group. Phone groups can be configured in the System → Administration → Recipients → [[{{{name}}}_Administration#Phone_Groups|Phone Groups]] page.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Recipient's phone number {{!}} Phone group</td> | ||
+ | <td>phone number {{!}} phone group; default: <b>none</b></td> | ||
+ | <td>Phone number of a single recipient or a Phone group of multiple recipients. The name and selection type of this field depends on the value set in the 'Recipients' field.</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |}} | ||
====Type: Output==== | ====Type: Output==== | ||
---- | ---- | ||
Line 516: | Line 594: | ||
<tr> | <tr> | ||
<td>Control</td> | <td>Control</td> | ||
− | <td>output; default: <b>{{#ifeq:{{{configurableio}}}|1|Configurable Input/Output ( | + | <td>output; default: <b>{{#ifeq:{{{configurableio}}}|1|Configurable Input/Output (2)|Output (4)}}</b></td> |
<td>Selects the output controlled by this Action.</td> | <td>Selects the output controlled by this Action.</td> | ||
</tr> | </tr> | ||
Line 546: | Line 624: | ||
</table> | </table> | ||
− | ==== | + | ====HTTP==== |
---- | ---- | ||
− | Executes | + | Executes at HTTP Post/Get action. |
− | [[File: | + | [[File:Networking_rutos_manual_input_output_io_juggler_actions_http.png|border|class=tlt-border]] |
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 557: | Line 635: | ||
<th>Value</th> | <th>Value</th> | ||
<th>Description</th> | <th>Description</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Execution delay</td> | ||
+ | <td>positive integer; default: <b>none</b></td> | ||
+ | <td>A period of time (in seconds) which has to pass after a trigger event before this Action is executed.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 574: | Line 657: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
− | <td | + | <td>Parameters</td> |
− | |||
− | |||
− | |||
− | |||
− | |||
<td>string; default: <b>none</b></td> | <td>string; default: <b>none</b></td> | ||
<td>Parameters that are to be included the Post/Get request. Select a parameter (right drop-down box) and enter a custom name for it (left text box).</td> | <td>Parameters that are to be included the Post/Get request. Select a parameter (right drop-down box) and enter a custom name for it (left text box).</td> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</tr> | </tr> | ||
</table> | </table> | ||
Line 604: | Line 667: | ||
Executes a custom, user-written shell script. | Executes a custom, user-written shell script. | ||
− | + | [[File:Networking_rutos_manual_input_output_io_juggler_actions_script.png|border|class=tlt-border]] | |
− | |||
− | |||
− | |||
− | |||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 680: | Line 739: | ||
</tr> | </tr> | ||
</table> | </table> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{#ifeq: {{{dualsim}}} | 1 | | {{#ifeq: {{{dualsim}}} | 1 | | ||
− | ====Type: SIM | + | ====Type: Change SIM==== |
---- | ---- | ||
Switches to using the specified SIM card. | Switches to using the specified SIM card. | ||
− | [[File: | + | [[File:Networking_rutos_manual_input_output_io_juggler_actions_change_sim.png|border|class=tlt-border]] |
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 838: | Line 761: | ||
<td>off {{!}} on; default: <b>off</b></td> | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>When set to 'on', switches to the opposite SIM card (the that is currently NOT in use). This can be used instead of selecting a specific SIM card to switch to.</td> | <td>When set to 'on', switches to the opposite SIM card (the that is currently NOT in use). This can be used instead of selecting a specific SIM card to switch to.</td> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 848: | Line 766: | ||
<td>SIM1 {{!}} SIM2; default: <b>SIM1</b></td> | <td>SIM1 {{!}} SIM2; default: <b>SIM1</b></td> | ||
<td>Selects a SIM card to switch to. This field is visible only when the 'Flip' field is set to 'off'.</td> | <td>Selects a SIM card to switch to. This field is visible only when the 'Flip' field is set to 'off'.</td> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</tr> | </tr> | ||
</table> | </table> | ||
Line 938: | Line 796: | ||
<tr> | <tr> | ||
<td>I/O</td> | <td>I/O</td> | ||
− | <td>inputs/outputs; default: <b>Output( | + | <td>inputs/outputs; default: <b>Output(4)</b></td> |
<td>Specifies the I/O pin to which this Condition is listening to.</td> | <td>Specifies the I/O pin to which this Condition is listening to.</td> | ||
</tr> | </tr> |
Revision as of 09:27, 4 November 2020
Template:Networking rutos manual fw disclosure
Summary
Inputs and outputs are used for monitoring and controlling a connected device or receiving signals from that device in order to trigger certain events.
This chapter of the user manual provides an overview of the Input/Output section for {{{name}}} devices.
If you're having trouble finding this page or some of the parameters described here on your device's WebUI, you should turn on "Advanced WebUI" mode. You can do that by clicking the "Advanced" button, located at the top of the WebUI.
Status
The Status page displays the current states of the device's input and output pins:
[[File:Networking_{{{series}}}_manual_input_output_status.png|border|class=tlt-border]] You can invert an Input pin by clicking the on/off slider under the "Inversion" column or switch the state of an Output pin by clicking the on/off slider under the "State" column.
Status from command line
You can also obtain the status of the input or output from the command line. List of ubus possible values in {{{name}}} devices:
ioman.gpio.dio0 ioman.gpio.dio1
Call command ubus call value status :
root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dio0 status { "value": "0", "direction": "in", "bi_dir": false, "invert_input": false }
- din1 is the input:
- "value": "0" means low level state.
- "value": "1" means high level state.
- dout1 is the output:
- "value": "0" means low level state.
- "value": "1" means high level state.
Post/Get
Enabling Post/Get provides the possibility to control the state of an output via HTTP POST/GET requests. The figure below is an example of the Auth Settings section of the Post/Get page. It is used to turn Post/Get on or off and to set authentication parameters.
Field | Value | Description |
---|---|---|
Enable | off | on; default: off | Turns Post/Get on or off. |
Username | string; default: none | Username used for authentication in POST/GET queries. |
Password | string; default: none | Password used for authentication in POST/GET queries. |
Confirm password | string; default: none | Repeat the password for confirmation. |
Post/Get examples
It is possible to turn the output on and off by using a valid HTTP POST/GET syntax. Use a web browser or any other compatible software to submit HTTP POST/GET strings to the device.
Below is a table containing syntax examples of this usage:
Action | POST/GET URL |
---|---|
Turn Output state to high | http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on |
Turn Output state to low after 5 seconds for 3 seconds | http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on&delay=5&time=3 |
Overview:
- 192.168.1.1 - device default LAN IP address; replace it in accordance with your own configuration.
- username - login name from Post/Get configuration.
- password- password from Post/Get configuration.
- state - turn Output on or off.
- delay - defines a delay (in seconds) after which the specified action will be performed.
- time - defines a window of time during which the action will take place. For instance, if you post an on action while specifying time=5, the output will turn on and stay on for 5 seconds before turning off.
Delay and time parameters can be used together. For example, if delay is 10, time is 5, action is on, then 10 seconds after the execution of the command, the output will switch to on (or stay in on state if it was already that way), then after 5 more seconds it will switch to off state. In this case the overall command execution time is 15 seconds.
To use Post/Get via SSH instead of a browser, you may want to use the curl -X command. Simply add the same URL command in between quotes and specify the HTTP method.
Examples:
- Switch output to High:
curl -X GET "http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=on"
- Switch output to Low after delay:
curl -X GET "http://192.168.1.1/cgi-bin/io_state?username=user1&password=user1&pin=dout1&state=off&delay=5"
Scheduler
The output Scheduler can be used to configure a timetable of when an output should be turned on or off, based on days of the week and hours of the day. Below is an example of the Scheduler section.
[[File:Networking_rutos_manual_input_output_scheduler_configure_scheduler_configurableio_{{{configurableio}}}.png|border|class=tlt-border]]
Each field represents a day of the week and an hour of the day. The Scheduler table itself is interactive; click on different fields to set the state of an output for a specific window of time. For example:
[[File:Networking_rutos_manual_input_output_scheduler_configure_scheduler_example_configurableio_{{{configurableio}}}.png|border|class=tlt-border]]
The Scheduler is turned off by default. To turn it on set the 'Enable' slider to "on".
I/O Juggler
The I/O Juggler is a feature that provides the possibility to create automated rules that perform certain actions based on Input state changes and other conditions. The operating sequence of I/O Juggler can be visualized as such:
[[File:Networking_rutos_manual_input_output_io_juggler_scheme_condition_mobile_{{{mobile}}}.png]]
When an Input Trigger occurs, the Input check to see if user-specified conditions are also met. If so, it executes a user-specified action.
For example, if we configure the I/O Juggler like this:
- Trigger - input state rising.
- Condition - 8:00 AM - 5:00 PM.
- Action - send email.
The operating sequence would look like this:
- A connected device raises the input state.
- This {{{name}}} device checks whether the current time is between 8:00 AM and 5:00 PM.
- Yes - {{{name}}} sends an email.
- No - {{{name}}} doesn't send an email.
You can specify multiple actions and multiple conditions for any I/O Juggler rule. Selecting conditions is optional. If there are no set or configured I/O Juggler conditions, the operating sequence is as such:
[[File:Networking_rutos_manual_input_output_io_juggler_scheme_mobile_{{{mobile}}}.png]]
General
The General section is used to Input Trigger rules, which can perform a specified user-configured action when the Input state changes and when certain other user-configured conditions are met (conditions are optional).
Before you can use the I/O Juggler, you must turn it on first (off by default). This can be done by setting the 'Enable' slider to "on":
Input
The Input is used to create Input Rules. An Input Rule is triggered by a user-specified input state change. When this trigger occurs, the device executes a specified command if certain specified conditions are met (conditions are optional).
The Input list is empty by default. To create a new Input Rule, look to the Add Input section at the bottom of the page; select an input and click the 'Add' button:
[[File:Networking_rutos_manual_input_output_io_juggler_general_input_add_button_juggler_input_{{{juggler_input}}}.png|border|class=tlt-border]]
After this you will be redirected to the configuration page for the newly added Rule, which should look similar to this:
[[File:Networking_rutos_manual_input_output_io_juggler_general_input_configuration_juggler_input_{{{juggler_input}}}.png|border|class=tlt-border]]
Field | Value | Description |
---|---|---|
Enabled | off | on; default: off | Changes current profile to specified one when action triggers. |
Trigger interval | integer [0..99999999]; default: 1 | The shortest amount of time (in seconds) between two triggers. If the input is triggered more than once in a time period shorter than the value specified in this field, the device will react to the first trigger. |
Trigger | Rising | Falling | Both; default: Rising | Input state change that will trigger this rule. |
Add actions | i/o juggler action(s); default: none | Actions that will be executed by this rule when the specified trigger and conditions (optional) occur. |
Add conditions | i/o juggler conditions; default: none | Conditions that have to be met for the rule to take action. Conditions are optional. |
Actions
The Actions section is used to manage and create new Actions that can be executed by the I/O Juggler Rules. The figure below is an example of the Actions section, which is empty by default.
To create a new Action, look to the Add an Action section at the bottom of the page; enter a custom name, select an action type and click the 'Add' button:
After this you will be redirected to the configuration page for the newly added Action, which should look similar to this (example for action 'Type: Reboot'):
Action configuration depends on the selected action 'Type'. Each Action can have one or multiple user-defined Conditions assigned to it. Actions that have Conditions assigned to them are executed only if the Conditions are met (a trigger occurrence is not enough to set off these actions). Assigning to Actions is optional.
You will find descriptions of each different action Type described on the sections below.
Type: Email
Sends an email to specified recipients. Requires an existing email account configuration on the device. Email accounts can be configured in the System → Administration → Recipients → [[{{{name}}}_Administration#Email_Accounts|Email Accounts]] page.
Field | Value | Description |
---|---|---|
Subject | string; default: none | Subject of email. |
Text message | string; default: none | Email body text. Below this field you can find special codes that begin with the '%' sign. Each code represents a piece information related to the status of the device. Include these codes in the Text message for dynamic information reports. |
Execution delay | positive integer; default: none | A period of time (in seconds) which has to pass after a trigger event before the action is executed. |
Email account | email account; default: none | Email account used to send the email. Email accounts can be configured in the System → Administration → Recipients → [[{{{name}}}_Administration#Email_Accounts|Email Accounts]] page. |
Recipient's email address | email; default: none | Email address(es) of the message's receiver(s). |
Type: Output
Changes the state of a selected output pin.
[[File:Networking_rutos_manual_input_output_io_juggler_actions_output_configurableio_{{{configurableio}}}.png|border|class=tlt-border]]
Field | Value | Description |
---|---|---|
Execution delay | positive integer; default: none | A period of time (in seconds) which has to pass after a trigger event before this Action is executed. |
Control | output; default: Output (4) | Selects the output controlled by this Action. |
Revert | integer; default: 0 | After how many seconds the state will revert. If left as 0 or empty the state will not revert. |
Maintain | off | on; default: on | When set to 'on', the output maintains its new state after reboot (the state is changed in the config file as well). |
Invert | off | on; default: off | Inverts the state of the selected output, i.e., switches the output pin to a state that is opposite to its current one (high-to-low or low-to-high). This can be used instead of specifying a static state. |
State copying | off | on; default: off | Copies the state from the selected input and applies it to the selected output. This can be used instead of specifying a static state. |
State | High | Low; default: High | Specifies the state of the output pin that will be set by this Action. |
HTTP
Executes at HTTP Post/Get action.
Field | Value | Description |
---|---|---|
Execution delay | positive integer; default: none | A period of time (in seconds) which has to pass after a trigger event before this Action is executed. |
Method | Get | Post; default: Get | HTTP method to be used by this Action. |
URL | string; default: none | URL to send the HTTP Post/Get request to. |
Verify | off | on; default: off | Verifies the validity of certificates; only used with HTTPS. |
Parameters | string; default: none | Parameters that are to be included the Post/Get request. Select a parameter (right drop-down box) and enter a custom name for it (left text box). |
Type: Script
Executes a custom, user-written shell script.
Field | Value | Description |
---|---|---|
Execution delay | positive integer; default: none | A period of time (in seconds) which has to pass after a trigger event before this Action is executed. |
Specify path | Upload a script |Specify path; default: Upload a script | Specifies whether the script should be uploaded from an external file or a path to an internal (on this device) script file should be specified. |
Custom script | Script file | -(interactive button) | filepath | Shows file upload window on click or provides the possibility to specify a path to an internal script file. The name and selection type of this field depends on the value set in the 'Specify path' field. |
Arguments | string; default: none | Optional arguments which can be provided for the script. You can include device information with values given below this input field. |
Type: Reboot
Reboots the device.
Field | Value | Description |
---|---|---|
Execution delay | positive integer; default: none | A period of time (in seconds) which has to pass after a trigger event before this Action is executed. |
Type: Profile
Switches to using a specified Configuration Profile.
Field | Value | Description |
---|---|---|
Execution delay | positive integer; default: none | A period of time (in seconds) which has to pass after a trigger event before this Action is executed. |
Profile | profile; default: default | Configuration Profile that will be applied by this Action. Configuration Profiles can be defined in the System → [[{{{name}}}_Profiles|Profiles]] page. |
Conditions
The Conditions section is used to manage and created Conditions for I/O Juggler Actions. The figure below is an example of the Conditions section, which is empty by default.
To create a new Condition, look to the Add a Condition section; enter a custom name, select the Type of the Condition and click the 'Add' button.
After this you should be redirected to the configuration page of the newly added Condition. You will find descriptions of each different Condition type described on the sections below.
Condition type: I/O
I/O Condition type tracks the state of a selected input or output pin and considers the Condition as MET if that pin is in a user-specified state.
[[File:Networking_rutos_manual_input_output_io_juggler_conditions_io_configurableio_{{{configurableio}}}.png|border|class=tlt-border]]
Field | Value | Description |
---|---|---|
I/O | inputs/outputs; default: Output(4) | Specifies the I/O pin to which this Condition is listening to. |
State | High | Low; default: High | Specifies in what state the pin has to be in in order for the Condition to be met. |
Condition type: Boolean group
Boolean Group will evaluate two or more existing conditions based on selected Boolean type. A Boolean Group condition will considered as MET based on the outcome of the evaluation performed along with one of the available Boolean types:
- AND - all selected conditions evaluate as TRUE.
- NAND - at least one selected condition evaluates as FALSE.
- OR - at least one selected condition evaluates as TRUE.
- NOR - none of the selected conditions evaluate as TRUE.
For example, if we have two time Conditions (hour and minute) and a third Condition of Boolean group: AND, both Conditions 1 & 2 have to be met for Condition 3 to be evaluated as TRUE.
In this case, if at least one condition is no longer met, the Boolean group: AND Condition is evaluated as FALSE.
Below is an example of Condition type: Boolean group configuration.
Field | Value | Description |
---|---|---|
Boolean type | AND | NAND | OR | NOR; default: AND | Type of boolean condition. |
Add conditions | conditions; default: none | Specifies conditions which have to be met for action to occur. |
Condition types: Date/Time
Lastly, you can configure Conditions based on date and time. Date/time Conditions can be configured based on:
- Minute of the hour
- Hour of the day
- Day of the Week
- Day of the Month
- Day of the Year
Each type can be configured in two distinct ways:
- Specific time - configured as a single value which defines the exact time when the Condition is considered as TRUE. e.g.:
- Hour: 8
- Day of Month: 1
- Time interval - configured with a start and an end value which define a window of time during which the Condition is considered as TRUE. e.g.:
- Hours: 8-12
- Days of Month: 1-12
[[Category:{{{name}}} Services section]]