CLI

The library comes with a CLI tool called rctclient that offers some useful subcommands.

The tool is only installed if the click module's present. If installing from pip, the requirement can be pulled in by specifying rctclient[cli].

For certain parameters, the tool supports shell completion. Depending on your version of Click, there are different ways to enable the completion:

  • <  8.0.0: eval "$(_RCTCLIENT_COMPLETE=source_bash rctclient)" (e.g. Debian 11, Ubuntu 20.04)

  • >= 8.0.0: eval "$(_RCTCLIENT_COMPLETE=bash_source rctclient)" (e.g. Arch, Fedora 35+, Gentoo)

Read more about this at the click documentation.

rctclient

rctclient toolbox. Please help yourself with the subcommands.

rctclient [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

-d, --debug

Enable debug output

--frame-debug

Enables frame debugging (requires --debug)

read-value

Sends a read request. The request is sent to the target "<host>" on the given "<port>" (default: 8899), the response is returned on stdout. Without "verbose" set, the value is returned on standard out, otherwise more information about the object is printed with the value.

Specify either "--id <id>" or "--name <name>". The ID must be in th decimal notation, such as "0x959930BF", the name must exactly match the name of a known object ID such as "battery.soc".

The "<name>" option supports shell autocompletion (if installed).

If "--debug" is set, log output is sent to stderr, so the value can be read from stdout while still catching everything else on stderr.

Timeseries data and the event table will be queried using the current time. Note that the device may send an arbitrary amount of data. For time series data, The output will be a list of "timestamp=value" pairs separated by a comma, the timestamps are in isoformat, and they are not altered or timezone-corrected but passed from the device as-is. Likewise for event table entries, but their values are printed in hexadecimal.

Examples:

rctclient read-value --host 192.168.0.1 --name temperature.sink_temp_power_reduction
rctclient read-value --host 192.168.0.1 --id 0x90B53336
param ctx:

Click context

param port:

The port number.

param host:

The hostname or IP address, passed to socket.connect.

param id:

The ID to query. Mutually exclusive with name.

param name:

The name to query. Mutually exclusive with id.

param verbose:

Prints more information if True, or just the value if False.

rctclient read-value [OPTIONS]

Options

-p, --port <port>

Port at which the device listens, default 8899

-h, --host <host>

Required Host address or IP of the device

-i, --id <ID>

Object ID to query, of the form "0xXXXX"

-n, --name <name>

Object name to query

-v, --verbose

Enable verbose output

simulator

Starts the simulator. The simulator returns valid, but useless responses to queries. It binds to the address and port passed using "<host>" (default: localhost) and "<port>" (default: 8899) and allows up to five concurrent clients.

The response values (for read queries) is read from the information associated with the queried object ID if set, else a sensible default value (such as 0, False or dummy strings) is computed based on the response data type of the object ID.

param port:

The port to bind to, defaults to 8899.

param host:

The address to bind to, defaults to localhost.

param verbose:

Enables verbose output.

rctclient simulator [OPTIONS]

Options

-p, --port <port>

Port to bind the simulator to, defaults to 8899

-h, --host <host>

IP to bind the simulator to, defaults to localhost

-v, --verbose

Enable verbose output