Command line tool

skycharge-cli is a command line tool allowing remote monitoring and management of your Skycharge system. Skycharge-cli can be invoked from the system's Linux OS, from a Linux computer connected to the same LAN of the system, and from the cloud.

For example, the following command will show all the charging process information:

$ skycharge-cli monitor --pretty

Timestamp:       2021-11-17 10:29:54.706
Dev state:       SCANNING
Voltage:         19.197V
Current:         0.000A
Power:           0.000W
Energy:          0.000Wh
Charge:          0.000Ah
Source temp:     26C
Sink temp:       0C
Charging:        00h:00m:00s

To remote manage the system, you can append the charging device address or the Skycharge broker server address to the end of each command. Example:

$ skycharge-cli monitor --pretty broker.skycharge.de

List of all commands

Usage:
    skycharge-cli list-devs                     [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli monitor [(--pretty | --json)] [--link-stat] [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli show-dev-params [--json]      [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli set-dev-param <key> <value>   [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli set-dev-params <key-value-pairs-string> [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli stop-scan                     [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli resume-scan                   [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli open-droneport                [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli close-droneport               [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli show-droneport-state          [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli show-charging-state [(--no-pretty | --json)] [--link-stat] [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli dev-info                      [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli sink-info                     [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli show-sink-params [--json]     [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli set-sink-param <key> <value>  [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli set-sink-params <key-value-pairs-string> [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli sink-start-charge             [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]
    skycharge-cli sink-stop-charge              [(--id <dev-id>)] [(--conffile <conff>)] [(<addr> [<port>])]

Options:
    --id <dev-id> - short ID of the device, is used when 'list-devs' command outputs many devices
    --conffile    - path to the configuration file, default path is /etc/skycharge.conf
    --pretty      - outputs in pretty human readable format.
    --no-pretty   - the opposite of 'pretty', when 'pretty' is default.
    --json        - outputs in json format.
    --link-stat   - includes data link statistics in the output.

Description:
    Skycharge console client communicates with local and remote devices.
    Almost each command has non obligatory <addr> and <port> to execute
    command remotely on a server.  If <addr> and <port> are not specified
    local device will be used.

list-devs

Shows a list of all the systems owned by the user. If the address of the broker server is used, the "user-uuid" value specified in the configuration file uniquely identifies the user. Example:

$ skycharge-cli list-devs
Found sky devices:
          DEV-ID     TYPE  DEV-NAME      FW      HW
        49C2B3F4  MUX-HW2  abbysavo  v1.0.0  v1.1.0

show-charging-state [(--no-pretty | --json)] [--link-stat]

The command outputs the Source board state in a human-readable format. In order to parse the output using a script '--no-pretty' or '--json' options can be used. If the '--no-pretty' option is specified, the command outputs the charging state in a tab separated values. If the '--json' options is specified, the output is in JSON. If the '--link-stat' option is specified, the command adds data link counters which can be useful to debug the 'PLC' detect mode, understanding for example how many bytes or packages are sent/received, and how many errors are generated on the data link.

$ skycharge-cli show-charging-state
Timestamp:       2021-11-24 17:55:38.663
Dev state:       SCANNING
Voltage:         12.008V
Current:         0.000A
Power:           0.000W
Energy:          0.000Wh
Charge:          0.000Ah
Source temp:     27C
Sink temp:       0C
Charging:        00h:00m:00s

monitor [(--pretty | --json)] [--link-stat]

The command is similar to the 'show-charging-state' command, but it does not quit and continues outputting the charging state to the console, fetching a new state from the Source board each second.

show-dev-params [--json]

The command outputs the settings list of the Source board. For a detailed description, please see the Source board settings page. The command supports the '--json' option, which allows you to output settings in JSON format and easily parse them with any script. Example:

$ skycharge-cli show-dev-params 
Source has the following parameters:
        psu-type                           RSP-750-48 (0x01)
        detect-mode                        CAPACITY (0x02)
        psu-fixed-voltage-mv               0
        psu-fixed-current-ma               0
        psu-use-fixed-v-i                  false
        nr-bad-heartbeats                  20
        ignore-inval-charging-settings     false
        ignore-low-batt-voltage            true
        error-indication-timeout-secs      5
        keep-silence                       false
        ignore-voltage-on-output           true
        min-sense-current-ma               50
        repeat-charge-after-mins           10
        sense-voltage-calib-point1-mv      15000:15000
        sense-voltage-calib-point2-mv      50000:50000
        sense-current-calib-point1-ma       1000:1000
        sense-current-calib-point2-ma      10000:10000
        psu-voltage-calib-point1-mv        10000:10000
        psu-voltage-calib-point2-mv        20000:20000
        psu-current-calib-point1-ma         1000:1000
        psu-current-calib-point2-ma         5000:5000

set-dev-param <key> <value>

The command updates the configuration parameter with the of the charge source. The configuration parameter is written to the charge source EEPROM and the change becomes immediately effective.

🚧

Updating the configuration with set-dev-param

If you update a parameter with set-dev-param and in the configuration file /etc/skycharge.conf the parameter has a different value, on the next skycharged restart the charge source configuration will be overwritten with the one stored in /etc/skycharge.conf.
Likewise, if you update a parameter in the configuration file /etc/skycharge.conf the change won't become effective until skycharged is restarted.

To make the configuration persistent, please update the configuration file with the corresponding value and manually restart skycharged with the following command:

systemctl restart skycharged
$ skychare-cli set-dev-param detect-mode capacity

set-dev-params <key-value-pairs-string>

The command is similar to the 'set-dev-param' command, but it simultaneously updates a Source board configuration parameters' batch. The configuration parameter 'key' is separated from the 'value' with the colon ':' sign, key-value pairs are separated with the comma ',' sign. Example:

$ skycharge-cli set-dev-params psu-type:rsp-750-48,detect-mode:capacity

resume-scan

The command resumes the scanning operation, which can be indicated by the blinking 'SCAN' led and the 'SCANNING' state in the charging state output (see 'monitor' or 'show-charging-state' commands). The command should be invoked after the scanning operation has been suspended by the 'stop-scan' command.

stop-scan

The command suspends the scanning operation, which can be indicated by the blinking of all status LEDs and the 'STOPPED' charging state in the charging state output (see 'monitor' or 'show-charging-state' commands).

open-droneport

The command opens the Skyport cover.

close-droneport

The command closes the Skyport cover.

show-droneport-state

The command shows the Skyport's current state.

Example:

$ skycharge-cli show-droneport-state
Skycharge Drone Port:
   IS READY      yes
   IS OPENED      no
   IS CLOSED     yes
   IN PROGRESS    no
   LANDING ERROR  no

dev-info

The command outputs the Source board information: firmware version, hardware version, PLC protocol version and unique ID of the Source board. Example:

$ skycharge-cli dev-info
Source info:
   FW:        v1.0.3
   HW:        v1.1.0
   PLC proto: v1.0.0
   UID:       05d0ff363234584743125232

sink-info

The command outputs information about the Sink board if the 'detect-mode' is set to 'plc' and the data link with the Sink board PLC is established. The information includes: firmware version, hardware version, PLC protocol version and unique ID of the Sink board.

$ skycharge-cli sink-info
Sink info:
   FW:        v1.0.0
   HW:        v1.0.0
   PLC proto: v1.0.0
   UID:       003c001a2031393200007f30

show-sink-params [--json]

The command outputs the Sink board settings list. For a detailed description, please see the sink board settings page. The command supports the '--json' option, which allows you to output settings in JSON format and easily parse them with any script.

🚧

Be aware

If the 'detect-mode' is set to 'plc' the command will only work if the data link with the Sink board is successfully established. If the 'detect-mode' is set to 'capacity' the command outputs the Sink board settings which belong to the Source board.

Example:

$ skycharge-cli show-sink-params
Sink has the following parameters:
        capabilties                        PLC_WHILE_CHARGING (0x01)
        batt-type                          Li-Po (0x00)
        batt-capacity-mah                  5000
        batt-min-voltage-mv                18000
        batt-max-voltage-mv                25200
        charging-max-current-ma            15000
        cutoff-min-current-ma              500
        cutoff-timeout-ms                  5000
        precharge-current-ma               1000
        precharge-delay-secs               0
        precharge-secs                     0
        total-charge-secs                  3600
        user-data1                         0x00000000
        user-data2                         0x00000000
        user-data3                         0x00000000
        user-data4                         0x00000000

set-sink-param <key> <value>

The command updates the charge sink configuration parameter with the .
If the 'detect-mode' is set to 'plc' and the data link is established, the configuration parameter is written to the charge sink EEPROM.
If the 'detect-mode' is set to 'capacity' the parameter is written to the charge source EEPROM.

🚧

Updating the configuration with set-sink-param

If you update a parameter with set-sink-param and in the configuration file /etc/skycharge.conf the parameter has a different value, on the next skycharged restart the charge source configuration will be overwritten with the one stored in /etc/skycharge.conf.
Likewise, if you update a parameter in the configuration file /etc/skycharge.conf the change won't become effective until skycharged is restarted.

To make the configuration persistent, please update the configuration file with the corresponding value and manually restart skycharged with the following command:

systemctl restart skycharged

📘

Updating the configuration

The sink board settings can be only updated from the configuration file if the 'detect-mode' is set to 'capacity'.

$ skycharge-cli set-sink-param batt-max-voltage-mv 25200

set-sink-params <key-value-pairs-string>

The command is similar to the 'set-sink-param' command, but updates simultaneously batch of configuration parameters of the Sink board ('detect-mode' is 'plc') or the Source board ('detect-mode' is 'capacity'). The configuration parameter 'key' is separated from the 'value' with the the colon ':' sign, key-value pairs are separated with the comma ',' sign. Example:

$ skycharge-cli set-sink-params batt-max-voltage-mv:25200,batt-min-voltage-mv:18000

sink-start-charge

If the state of the Source board is 'CHARGING_FINISHED' the command starts charging and switches the Source board to the 'CHARGING' or 'PRECHARGING' state (depends on the Sink board configuration settings). In all other Source board states, the command does nothing.

sink-stop-charge

If the state of the Source board is 'CHARGING', 'PRECHARGING' or 'PRECHARGING_DELAYED' the command stops charging and switches the Source board to the 'CHARGING_FINISHED' state. In all other Source board states, the command does nothing.


What’s Next