RUT300 Input/Output

From Teltonika Networks Wiki
Revision as of 08:17, 12 March 2021 by LorurnA (talk | contribs) (LorurnA moved page Draft:RUT300 Input/Output to RUT300 Input/Output without leaving a redirect)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Main Page > RUT Routers > RUT300 > RUT300 Manual > RUT300 WebUI > RUT300 Services section > RUT300 Input/Output

The information in this page is updated in accordance with firmware version RUT30X_R_00.07.00.

Summary[edit source]

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 RUT300 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 "Basic" button under "Mode", which is located at the top-right corner of the WebUI.

Networking rut30x manual webui basic advanced mode.gif

Physical characteristics and I/O pin mapping[edit source]

Electrical characteristics and I/O pin mapping information are presented below.

Power Socket Pinout


Networking rutos manual input output power socket pinout configurableio 1.png

  • Power: 9-30 VDC positive (+).
  • Ground: negative/ground (-).
  • I/O: programmable input/output pins; can be set to:
    • open collector (OC) output; max 30 V;
    • digital input; 0-7.3 V is detected as logical "0"; 7.3-30 V is detected as logical "1".

Status[edit source]

The Status page displays the current states of the device's input and output pins:

Networking rut30x manual input output status.png

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[edit source]


You can also obtain the status of input and output pins via the command line (CLI or SSH). List of possible ubus values in RUT300 devices:

ioman.gpio.dio0 - Configurable input/output (PIN3)
ioman.gpio.dio1 - Configurable input/output (PIN4)

Call command ubus call value status:

root@Teltonika-RUT300:~# ubus call ioman.gpio.dio0 status
{
        "value": "0",
        "direction": "in",
        "bi_dir": false,
        "invert_input": false
}
  • dio0 is configurable input / output:
    • "value": "0" means low level state.
    • "value": "1" means high level state.
    • "direction": "in" means input state.
    • "direction": "out" means output state.

To change input settings, use the update command and specify a value:

ubus call ioman.gpio.dio0 update '{"value":"0"}'
ubus call ioman.gpio.dio0 update '{"value":"1"}'
ubus call ioman.gpio.dio0 update '{"direction":"in"}'
ubus call ioman.gpio.dio0 update '{"direction":"out"}'

Post/Get[edit source]

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 requests on or off and to set authentication parameters.

Networking rutos manual input output post get auth settings.png

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[edit source]


Use a web browser or any other compatible software to send HTTP POST/GET requests 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=dio1&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=dio1&state=on&delay=5&time=3
Change Configurable Input/Output with pin3 to Output http://192.168.1.1/cgi-bin/io_type?username=user1&password=user1&pin=dio1&type=out

Overview:

  • 192.168.1.1 - device default LAN IP address; replace it in accordance with your own configuration.
  • io_state or io_type - allows you to change IO state or type.
  • username - login name from Post/Get configuration.
  • password- password from Post/Get configuration.
  • state - turn Output on or off.
  • type - turn Configurable Input/Output to Input or Output.
  • 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[edit source]

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 or month and hours of the day. The General Configuration section is used to turn the Output Scheduler on or off.

Networking rutos manual input output scheduler general configuration.png

The Scheduler is configured in the form of Instances. A Scheduler Instance defines a time interval during which the state of an output associated with the instance will be set to "High". The Output Scheduler Instances list is empty by default. Click the 'Add' button in order to create a new Scheduler Instance:

Networking rutos manual input output scheduler add button.png

After this you should be redirected to the configuration page for the newly added Instance which should look similar to this:

Networking rutos manual input output scheduler instance configuration configurableio 1.png

Field Value Description
Enable off | on; default: off Turns the Scheduler Instance on or off.
Pin output pin; default: Configurable Input/Output (2) Output pin. The state of the selected output will be set to "High" during the time interval defined in the fields below.
Interval Type Weekdays | Month Days; default: Weekdays Selects the interval type for scheduler to use.
Start Day [Monday..Sunday] | [1..31]; default: Monday | 1 The day that marks the start of the time interval.
Start Time hh:mm ([00..23]:[00..59]); default: 12:00 The hour and minute that mark the start of the time interval.
End Day [Monday..Sunday] | [1..31]; default: Tuesday | 1 The day that marks the end of the time interval.
End Time hh:mm ([00..23]:[00..59]); default: 12:00 The hour and minute that mark the end of the time interval.
Force Last Day off | on; default: off Forces intervals to accept last day of month as a valid option if selected day does not exist during ongoing month. This field becomes visible only when 'Interval Type' is set to Month Days.

A Scheduler Instance will not work unless you turn both the the Scheduler service and the individual instance on:

Networking rutos manual input output scheduler on off slider configurableio 1.png

I/O Juggler[edit source]

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:

Networking rutos manual input output io juggler scheme condition mobile 0.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:

  1. A connected device raises the input state.
  2. This RUT300 device checks whether the current time is between 8:00 AM and 5:00 PM.
    • Yes - RUT300 sends an email.
    • No - RUT300 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:

Networking rutos manual input output io juggler scheme mobile 0.png

General[edit source]


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"*:

Networking rutos manual input output io juggler general enabled.png * Input rules for Configurable I/O will work only when the type of the pin is set to "input"

Input[edit source]


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:

Networking rutos manual input output io juggler general input add button juggler input 1.png

After this you will be redirected to the configuration page for the newly added Rule, which should look similar to this:

Networking rutos manual input output io juggler general input configuration juggler input 1.png

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[edit source]


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.

Networking rutos manual input output io juggler actions actions.png

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:

Networking rutos manual input output io juggler actions add button.png

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'):

Networking rutos manual input output io juggler actions configuration reboot.png

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[edit source]


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 → Email Accounts page.

Networking rutos manual input output io juggler actions email.png

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 → Email Accounts page.
Recipient's email address email; default: none Email address(es) of the message's receiver(s).

Type: Output[edit source]


Changes the state of a selected output pin.

Networking rutos manual input output io juggler actions output configurableio 1.png

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: Configurable Input/Output (2) 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[edit source]


Executes a HTTP POST/GET request.

Networking rutos manual input output io juggler actions http.png

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[edit source]


Executes a custom, user-written shell script.

Networking rutos manual input output io juggler actions script.png

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[edit source]


Reboots the device.

Networking rutos manual input output io juggler actions reboot.png

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[edit source]


Switches to using a specified Configuration Profile.

Networking rutos manual input output io juggler actions profile.png

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 → Profiles page.


Conditions[edit source]


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.

Networking rutos manual input output io juggler conditions.png

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.

Networking rutos manual input output io juggler conditions add button.png

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[edit source]


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.

Networking rutos manual input output io juggler conditions io configurableio 1.png

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[edit source]


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.

Networking rutos manual input output io juggler boolean group scheme true.png

In this case, if at least one condition is no longer met, the Boolean group: AND Condition is evaluated as FALSE.

Networking rutos manual input output io juggler boolean group scheme false.png


Below is an example of Condition type: Boolean group configuration.

Networking rutos manual input output io juggler conditions boolean group.png

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[edit source]


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

Networking rutos manual input output io juggler conditions date time.png

Each type can be configured in two distinct ways:

  1. 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
  2. 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