CLI Reference Guide AIO

From OpenMotics
Jump to navigation Jump to search

The Gateway has 2 computer systems built-in: A Master Controller (Microchip DSPIC33) and a Gateway Controller (Linux Based Beagle Bone). The Master controller is connected with the Gateway Controller over RS232. The Master Controller has a built-in CLI interface allowing the user to configure and control the Master controller to his full extend.

This CLI can be accessed by using the Maintenance function in the OpenMotics cloud or by using a RS232 TTL cable (Baud rate 115200, 8 databits, no parity, 1 stop bit, no flow control) that is connected directly on the Gateway on the extern RS232 connector.

Possible modes of communication:

  • Advanced Mode: API (The Master controller and Gateway controller will use Advanced mode to communicate)
  • Simple Mode: CLI (Simple Mode will be used by Maintenance mode in the cloud or when a direct RS232 connection is established)

Notes

  1. In CLI mode, characters sent through RS232 can be echoed. In API mode they are never echoed.
  2. Instructions are case sensitive.
  3. As opposed to API mode, CLI mode has a variable instruction length.
  4. Every instruction must be followed by a Carriage return (<CR>, DEC 13).
  5. Every successful instruction will return the requested information (or perform requested action) followed by OK, otherwise ERROR is returned (wrong format, wrong parameters,…). All error codes are listed in the Error Codes AIO section.
  6. An instruction will only be executed if the Master has responded with “OK”

Notation

Instruction [required parameter] {optional parameter}

Instruction description.

[param]
Parameter description


Returns
[return value]

Versioning

This document describes the available CLI commands available on the All In One CLI interface. The All In One module is not yet available and not yet in production so please use CLI Reference Guide used in the current gateway.

Gateway Module FW version
NOT IN PRODUCTION V0.03

Instruction Set

General instructions

error list

This instruction will list all configured modules, their ID's, the number off errors on this module and the status of each module (Good, Degraded1, Degraded2, Degraded3, Offline, Forced Offline)
Returns
The error list

register list

This instruction will list all processor registers and the present values
Returns
The register list

state machine list

This instruction will list all main state machines with the last, the minimum and maximum execution time
Returns
The state machine list

Input instructions

input link read [input nr]

This instruction will read, for an input, which output or action is linked to it.
[input nr]
Indicates which input that the link has to be read.
Returns
output nr or link
OK

Example:

Instruction
input link read 15
Returns
12
OK

input link write [input nr][output link nr]

This instruction will write, for an input, which output or action is linked to it.
[input nr]
Indicates which input that the link has to be written.
Returns
OK

Example: Link input 15 with output 12

Instruction
input link write 15 12
Returns
OK

input list

This instruction will display the list of inputs, the status (0-> release state, 1-> press state), the link (is an action configured or an output linked) and the name of each input
Returns
The input list

input release [input nr]

Switch input to release state for virtual modules.
[input nr]
Indicates which input that needs to be put in release state, a maximum of 480 (0 - 479) inputs can be used.
Returns
OK

Example:

Instruction
input release 28
Returns
OK

input press [input nr]

Switch input to press state for virtual modules.
[input nr]
Indicates which input that needs to be put in press state, a maximum of 480 (0 - 479) inputs can be used.
Returns
OK

Example:

Instruction
input press 28
Returns
OK

input name write [input nr][input name]

Write the name of an input, max 16 characters.
[input nr]
Indicates which input the name has to be written.
[input name]
the ascii name of the input (maximum 16 characters).
Returns
OK

Example:

Instruction
input name write 28 Bedroom parents
Returns
OK

input name read [input nr]

Read the name of an input
[input nr]
Indicates which input the name has to be displayed.
Returns
Input Name
OK

Example:

Instruction
input name read 28
Returns
Bedroom Parents
OK

input number modules read

Read the number of input modules that are programmed and active
Returns
Number Of Input Modules
OK

Example:

Instruction
input number modules read
Returns
6
OK

input number modules write [number of input modules]

Writes the number of input modules that are programmed and active. This instruction will, after the write is performed, activate the instruction eeprom activate so all values from eeprom are read and copied in RAM
[number of input modules]
Indicates the number of input modules that are active and programmed.
Returns
OK

Example:

Instruction
input number modules write 7
Returns
OK

Output instructions

output list

This instruction will display the list of outputs, the status (On or Off), the dim value, the configured timer value, the timer type (Off, , 100ms timer, 1s timer or 1m timer) and the name of each output
Returns
The output list

output on [output nr] [dimmer value*] [timer value*]

Switch ON an output. * are optional values
[output nr]
Indicates which output that needs to be switched ON, a maximum of 480 (0 - 479) outputs can be used.
[dimmer value*]
Optional parameter to set the dimmer value (0-255)
[timer value*]
Optional parameter to set the timer value (0-65535s)
Returns
OK

Examples:

Instruction
output on 127
will switch ON output 127.
Returns
OK
Instruction
output on 127 56
will switch ON output 127 with dimmer value 56.
Returns
OK
Instruction
output on 127 56 3600
will switch ON output 127 with dimmer value 56 for 3600 seconds.
Returns
OK

output off [output nr]

Switch OFF an output.
[output nr]
Indicates which output that needs to be switched OFF, a maximum of 480 (0 - 479) outputs can be used.
Returns
OK

Example:

Instruction
output off 127 will switch OFF output 127.
Returns
OK

output name write [output nr][output name]

Write the name of an output, max 16 characters.
[input nr]
Indicates which output the name has to be written.
[output name]
the ascii name of the output (maximum 16 characters).
Returns
OK

Example:

Instruction
output name write 24 Bedroom 4
Returns
OK

output name read [output nr]

Read the name of an output
[output nr]
Indicates which output the name has to be displayed.
Returns
output Name
OK

Example:

Instruction
output name read 24
Returns
Bedroom 4
OK

output number modules read

Read the number of output modules that are programmed and active
Returns
Number Of Output Modules
OK

Example:

Instruction
output number modules read
Returns
6
OK

output number modules write [number of output modules]

Writes the number of output modules that are programmed and active. This instruction will, after the write is performed, activate the instruction eeprom activate so all values from eeprom are read and copied in RAM
[number of output modules]
Indicates the number of output modules that are active and programmed.
Returns
OK

Example:

Instruction
output number modules write 7
Returns
OK

Sensor instructions

sensor list

This instruction will display the list of sensors, the temperature, the humidity, the brightness and the name of each sensor
Returns
The input list

sensor name write [sensor nr][sensor name]

Write the name of a sensor, max 16 characters.
[sensor nr]
Indicates which sensor the name has to be written.
[sensor name]
the ascii name of the sensor (maximum 16 characters).
Returns
OK

Example:

Instruction
sensor name write 12 Bedroom 1
Returns
OK

sensor name read [sensor nr]

Read the name of a sensor
[sensor nr]
Indicates which sensor the name has to be displayed.
Returns
Sensor Name
OK

Example:

Instruction
sensor name read 12
Returns
Bedroom 1
OK

sensor number modules read

Read the number of sensor modules that are programmed and active
Returns
Number Of Sensor Modules
OK

Example:

Instruction
sensor number modules read
Returns
6
OK

sensor number modules write [number of sensor modules]

Writes the number of sensor modules that are programmed and active. This instruction will, after the write is performed, activate the instruction eeprom activate so all values from eeprom are read and copied in RAM
[number of sensor modules]
Indicates the number of sensor modules that are active and programmed.
Returns
OK

Example:

Instruction
sensor number modules write 7
Returns
OK

CAN module instructions

eeprom can list

This instruction will display the list of all the CAN modules that has been programmed in the master. Following information will be returned:
* Nr: Line Nr and order in which the module has been programmed
* ID: The unique ID (ID2,ID1&ID0) of the programmed micro CAN
* Inp.link0..5: This will indicate, for the 6 inputs a micro CAN has, the link to the system input. The value between brackets is the internal input CAN numbering
* Tem.link0..1: This will indicate, for the 2 sensors a micro CAN can have, the link to the system sensor number. The value between brackets is the internal sensor CAN numbering
When 255 is used for input or sensor link means that the sensor is not in use or the input is not configured
Returns
-Nr-ID2.ID1.ID0--Inp.link0-Inp.link1-Inp.link2-Inp.link3-Inp.link4-Inp.link5-Tem.link0-Tem.link1
00 140.162.190 024(000) 255(255) 255(255) 255(255) 255(255) 255(255) 000(000) 255(255)
01 062.063.159 255(255) 255(255) 255(255) 255(255) 255(255) 025(001) 001(001) 255(255)
02 075.144.045 026(002) 255(255) 255(255) 255(255) 255(255) 255(255) 255(255) 002(002)
03 140.151.125 255(255) 027(003) 255(255) 255(255) 028(004) 255(255) 003(003) 004(004)