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

?

This instruction will list all available CLI instructions
Returns
The full list of CLI instructions

??

This instruction will list all available Basic Actions
Returns
The full list of Basic Actions

time read

This instruction will read the time of the internal Real Time Clock.
Returns
output nr or link
OK

Example:

Instruction
time read
Returns
20:13:19
OK

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
    Output------------ID---------Err---Suc/Fail------Status-------
00 (o 000->007) 111.000.000.000 00000 (000/000)   GOOD       (000)
01 (o 008->015) 111.000.000.001 00000 (000/000)   GOOD       (000)
02 (o 016->023) 111.000.000.002 00000 (000/000)   GOOD       (000)
     Input-------------ID---------Err---Suc/Fail------Status-------
00 (i 000->007) 105.000.000.000 00000 (000/000)   GOOD       (000)
01 (i 008->015) 105.000.000.001 00000 (000/000)   GOOD       (000)
02 (i 016->023) 105.000.000.002 00000 (000/000)   GOOD       (000)
03 (b 024->031) 098.000.000.003 00000 (000/000)   GOOD       (000)
     Sensor------------ID---------Err---Suc/Fail------Status-------
00 (s 000->007) 115.000.000.000 00000 (000/000)   GOOD       (000)

error clear

This instruction will delete all the errors and will start communicating again with the RS485 modules at the normal pace
Returns
OK

Example:

Instruction
error clear
Returns
OK

register list

This instruction will list all processor registers and the present values
Returns
Register---Value--|--Register---Value--|--Register---Value--|--Register---Value--
C1CTRL1    00000  |  C2CTRL1    01152  |  C1EC       00002  |  C2EC       00000
C1CTRL2    00000  |  C2CTRL2    00000  |  C1CFG1     00087  |  C2CFG1     00000
C1VEC      00064  |  C2VEC      00064  |  C1CFG2     00658  |  C2CFG2     00000
C1FCTRL    16385  |  C2FCTRL    00000  |  C1TR01CON  00128  |  C2TR01CON  00000
C1FIFO     00257  |  C2FIFO     00000  |  C1TR23CON  00000  |  C2TR23CON  00000
C1INTF     00128  |  C2INTF     00000  |  C1TR45CON  00000  |  C2TR45CON  00000
C1INTE     00003  |  C2INTE     00000  |  C1TR67CON  00000  |  C2TR67CON  00000
C1RXFUL1   00000  |  C2RXFUL1   00000  |  C1RXFUL2   00000  |  C2RXFUL2   00000
C1RXOVF1   00000  |  C2RXOVF1   00000  |  C1RXOVF2   00000  |  C2RXOVF2   00000
U1MODE     32776  |  U2MODE     32776  |  U3MODE     32776  |  U4MODE     32776
U1STA      01040  |  U2STA      01296  |  U3STA      01296  |  U4STA      01284
U1BRG      00130  |  U2BRG      00130  |  U3BRG      00130  |  U4BRG      00130
IFS0       16400  |  IFS1       00000  |  IFS2       00004  |  IFS3       00000
IFS4       00064  |  IFS5       00130  |  IFS6       00000  |  IFS8       00000
IFS9       00000  |  IEC0       06280  |  IEC1       49154  |  IEC2       00008
IEC3       00004  |  IEC4       00000  |  IEC5       00780  |  IEC6       00000
IEC8       00000  |  IEC9       00000  |  IPC0       17476  |  IPC1       17476
IPC2       17476  |  IPC3       01090  |  IPC4       17476  |  IPC5       17476
IPC6       17476  |  IPC7       09284  |  IPC8       17476  |  IPC9       17476
IPC10      17476  |  IPC11      16452  |  IPC12      17476  |  IPC13      17476
IPC14      17476  |  IPC15      01028  |  IPC16      17472  |  IPC18      16448
IPC19      00064  |  IPC20      09280  |  IPC21      16384  |  IPC22      17444
IPC23      17408  |  IPC24      17476  |  IPC35      17408  |  IPC36      17472
IPC36      17472  |  IPC37      01092  |  INTTREG    00532  |  T1CON      32768
T2CON      00000  |  T3CON      00000  |  T4CON      00000  |  T5CON      00000
T6CON      00000  |  T7CON      00000  |  T8CON      00000  |  T9CON      00000
I2C1CON    36896  |  I2C2CON    36896  |  I2C1STAT   00016  |  I2C2STAT   00016
INTCON1    00000  |  INTCON2    32768  |  INTCON3    00000  |  INTCON4    00000
OSCCON     13088  |  CLKDIV     12288  |  PLLFBD     00058  |  REFOCON    00000
RCON       00131  |  PORTA      01280  |  PORTB      05136  |  PORTC      00832
PORTD      00064  |  PORTE      00000  |  PORTF      00067  |  PORTG      00003



state machine list

This instruction will list all main state machines with the last, the minimum and maximum execution time
Returns
 #----Last----Min-----Max------Description------------------
00 03 00004ms 00002ms 01402ms  UART1 receive
01 00 00000ms 00000ms 00000ms  UART2 receive
02 00 00000ms 00000ms 00000ms  UART3 receive
03 01 00000ms 00000ms 00000ms  UART4 receive
04 00 00061ms 00001ms 00238ms  I2C1
05 00 00002ms 00001ms 00052ms  I2C2
06 02 00205ms 00202ms 00258ms  Update Time/Date
07 00 00001ms 00001ms 00016ms  Immediate Queue
08 00 00002ms 00002ms 00006ms  Timer 100ms
09 00 00001ms 00001ms 00005ms  Timer 1 second
10 00 00005ms 00001ms 00005ms  Timer 1 minute
11 00 15444ms 15444ms 15444ms  Perform eeprom activate
12 01 00387ms 00116ms 00822ms  CLI print text
13 00 00000ms 00000ms 00000ms  CLI action execute
14 05 00001ms 00001ms 00016ms  Scan modules over RS485 network
15 00 00035ms 00001ms 00063ms  RS485 modules health status check
16 00 00001ms 00001ms 00003ms  Check Error, print, store in FRAM
17 00 00001ms 00001ms 00024ms  Check input queue and actions
18 00 00000ms 00000ms 00000ms  Check input delay queue and actions
19 00 01391ms 01391ms 01391ms  CLI print registers
20 00 00002ms 00002ms 00010ms  Check CAN1 RX queue
21 00 00013ms 00001ms 00069ms  Check CAN1 TX queue
22 00 00000ms 00000ms 00000ms  Check hardware health
23 00 00000ms 00000ms 00000ms  Check leds
24 00 00001ms 00001ms 00084ms  Check internal outputs
25 00 00002ms 00001ms 00009ms  Check internal inputs
26 00 00000ms 00000ms 00000ms  Execute Group Action
27 00 00002ms 00001ms 00004ms  Execute list of actions every minute



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)

ping can list

This instruction will ping all the programmed micro CAN modules and list the response of all the CAN modules including the configuration that has been saved in the eeprom of those modules. 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. This information is retrieved from the eeprom of the master
* Inp.link0..5: This is the response of the micro CAN that indicates, 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 is the response of the micro CAN that indicates, 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
* Type: This will indicate the type of sensor that is connected:
** 0: Sensor of the DS1820 family is connected on the first output
** 1: Sensor of the DS1820 family is connected on the second output
** 2: 2 sensors of the DS1820 family are connected (on both outputs)
** 3: Honeywell Temp/humidity Sensor is connected
** 4: TSL2561 LUX sensor is connected
** 5: Honeywell Temp/humidity Sensor & TSL2561 LUX sensor are connected
** 255: No sensors are currently connected
* Firmware: This gives the firmware version that is loaded on the micro CAN module
* Delay: This value will indicate the delay between the message that has been sent to the micro CAN module and the 6 received messages from the micro CAN with the configuration.
When 255 is used for input or sensor link means that the sensor is not in use or the input is not configured. When NA is returned, the sensor is not responding.
Returns
-Nr-ID2.ID1.ID0--Inp.link0-Inp.link1-Inp.link2-Inp.link3-Inp.link4-Inp.link5-Tem.link0-Tem.link1-Type-Firmware-delay--
00 140.162.190 024(000) 255(255) 255(255) 255(255) 255(255) 255(255) 000(000) 255(255) 004 F2.0.10 010ms
01 062.063.159 255(255) 255(255) 255(255) 255(255) 255(255) 025(001) 001(001) 255(255) 000 F2.0.10 011ms
02 075.144.045 026(002) 255(255) 255(255) 255(255) 255(255) 255(255) 255(255) 002(002) 001 F2.0.10 023ms
03 140.151.125 255(255) 027(003) 255(255) 255(255) 028(004) 255(255) 003(003) 004(004) 002 F2.0.10 065ms



can config delete

This instruction will perform a factory reset of the CAN config in the master as well as in the micro CAN slaves. After this instruction, the micro CAN config is deleted from the eeprom of the master and the micro CAN slaves.
Returns
can config delete
OK

Example:

Instruction
can config delete
Returns
OK

can module number read

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

Example:

Instruction
can module number read
Returns
6
OK

can module number write [number of CAN modules]

Writes the number of CAN 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 CAN modules]
Indicates the number of CAN modules that are active and programmed.
Returns
OK

Example:

Instruction
can module number write 7
Returns
OK

can input number read

Read the number of CAN inputs that are programmed and active
Returns
Number Of CAN inputs
OK

Example:

Instruction
can input number read
Returns
12
OK

can input number write [number of CAN inputs]

Writes the number of CAN inputs 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 CAN inputs]
Indicates the number of CAN inputs that are active and programmed.
Returns
OK

Example:

Instruction
can input number write 13
Returns
OK

can sensor number read

Read the number of CAN sensors that are programmed and active
Returns
Number Of CAN sensors
OK

Example:

Instruction
can sensor number read
Returns
4
OK

can sensor number write [number of CAN sensors]

Writes the number of CAN sensors 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 CAN inputs]
Indicates the number of CAN sensors that are active and programmed.
Returns
OK

Example:

Instruction
can sensor number write 6
Returns
OK