Skip to content

CLI Commands

This page lists every command available in the pydoover CLI, organised by subsection. All commands follow the pattern:

pydoover <subsection> <command> [positional_args] [--optional_args]

Platform Commands

The platform subsection communicates with the Platform Interface container for hardware I/O and system operations.

I/O Operations

CommandDescription
fetch_di <pin...>Read one or more digital input values. Returns True/False.
fetch_ai <pin...>Read one or more analogue input values. Returns float (typically mA).
fetch_do <pin...>Read current digital output values.
set_do <do> <value>Set a digital output pin to a value. Accepts pin/value as int or list.
schedule_do <do> <value> <in_secs>Schedule a digital output change after a delay in seconds.
fetch_ao <pin...>Read current analogue output values.
set_ao <ao> <value>Set an analogue output to a value.
schedule_ao <ao> <value> <in_secs>Schedule an analogue output change after a delay in seconds.
fetch_di_events <di_pin> <edge>Fetch digital input events for a pin, filtered by edge type. Optional --include_system_events and --events_from flags.

System Information

CommandDescription
fetch_system_voltageGet the system input voltage.
fetch_system_powerGet the system input power in watts.
fetch_system_temperatureGet the system temperature (CM4 temperature on Doovits).
fetch_locationGet the device GPS location.
fetch_io_tableFetch the full I/O table showing all pin configurations.
fetch_immunity_secondsGet the current shutdown immunity period in seconds.

Device Control

CommandDescription
test_commsSend an echo message to verify gRPC connectivity. Optional --message flag.
rebootReboot the device.
shutdownShut down the device.
set_immunity_seconds <immunity_secs>Set the shutdown immunity period in seconds.
schedule_shutdown <time_secs>Schedule a shutdown after a delay in seconds.
sync_rtcSynchronise the hardware real-time clock with the system time.

Examples

Reading digital inputs:

# Read digital input 1
pydoover platform fetch_di 1

# Read digital inputs 1, 2, and 3
pydoover platform fetch_di 1 2 3

Reading analogue inputs:

# Read analogue input 0 (e.g. a 4-20mA sensor)
pydoover platform fetch_ai 0

Setting a digital output:

# Turn on digital output 1
pydoover platform set_do 1 1

# Schedule digital output 1 to turn off after 60 seconds
pydoover platform schedule_do 1 0 60

Checking system status:

# Check system voltage and temperature
pydoover platform fetch_system_voltage
pydoover platform fetch_system_temperature

Device Agent Commands

The device_agent subsection communicates with the Device Agent container for channel and message operations.

Status

CommandDescription
get_is_dda_availableCheck if the Device Agent service is reachable.
get_is_dda_onlineCheck if the Device Agent is currently connected to the cloud.
get_has_dda_been_onlineCheck if the Device Agent has been online at least once since boot.

Channel Operations

CommandDescription
fetch_channel_aggregate <channel_name>Fetch the current aggregate data for a channel.
update_channel_aggregate <channel_name> <data>Update a channel's aggregate with new data (JSON).
listen_channel <channel_name>Stream channel events to the console in real time.
fetch_turn_tokenFetch a TURN server credential for WebRTC.

Message Operations

CommandDescription
fetch_message <channel_name> <message_id>Fetch a specific message by ID.
list_messages <channel_name>List messages on a channel. Optional --before, --after, --limit flags.
create_message <channel_name> <data>Create a new message on a channel (data as JSON).
send_oneshot_message <channel_name> <data>Send a one-shot message that is not persisted.
update_message <channel_name> <message_id> <data>Update an existing message's data.
fetch_message_attachment <attachment>Download a message attachment.

Examples

Checking agent status:

# Verify the Device Agent is online
pydoover device_agent get_is_dda_online

Working with channels:

# Fetch the current aggregate for the telemetry channel
pydoover device_agent fetch_channel_aggregate telemetry

# Update an aggregate with new data
pydoover device_agent update_channel_aggregate telemetry '{"temperature": 22.5}'

# Stream live events from a channel
pydoover device_agent listen_channel telemetry

Working with messages:

# List the most recent messages on a channel
pydoover device_agent list_messages telemetry

# List messages with filters
pydoover device_agent list_messages telemetry --limit 10 --after 1700000000

# Create a new message
pydoover device_agent create_message telemetry '{"status": "ok", "value": 42}'

Modbus Commands

The modbus subsection communicates with the Modbus Interface container for serial and TCP Modbus operations.

Bus Management

CommandDescription
open_busOpen a Modbus bus connection. See parameters below.
close_busClose a Modbus bus. Optional --bus_id (default: "default").
fetch_bus_statusCheck if a bus is open. Optional --bus_id (default: "default").
test_commsSend an echo message to verify gRPC connectivity.

The open_bus command accepts the following parameters:

ParameterDefaultDescription
--bus_typeserialBus type: serial or tcp.
--namedefaultBus identifier.
--serial_port/dev/ttyS0Serial port path.
--serial_baud9600Baud rate.
--serial_methodrtuSerial method: rtu or ascii.
--serial_bits8Data bits.
--serial_parityNParity: N, E, or O.
--serial_stop1Stop bits.
--serial_timeout0.3Serial timeout in seconds.
--tcp_uri127.0.0.1:5000TCP connection URI.
--tcp_timeout2TCP timeout in seconds.

Register Operations

CommandDescription
read_registersRead registers from a Modbus device.
write_registersWrite values to registers on a Modbus device.

Both register commands accept:

ParameterDefaultDescription
--bus_iddefaultBus identifier.
--modbus_id1Modbus device address.
--start_address0Starting register address.
--num_registers1Number of registers to read (read only).
--valuesNoneValues to write as a list (write only).
--register_type4Register type (1=coil, 2=discrete, 3=holding, 4=input).
--configure_busTrueWhether to auto-configure the bus if not already open.

Examples

Opening a serial Modbus bus:

# Open with default settings (serial RTU, /dev/ttyS0, 9600 baud)
pydoover modbus open_bus

# Open with custom settings
pydoover modbus open_bus --serial_port /dev/ttyUSB0 --serial_baud 19200 --name my_bus

Reading registers:

# Read 10 input registers starting at address 0 from device 1
pydoover modbus read_registers --modbus_id 1 --start_address 0 --num_registers 10

# Read holding registers (type 3)
pydoover modbus read_registers --modbus_id 1 --start_address 100 --num_registers 5 --register_type 3

Writing registers:

# Write values to holding registers starting at address 0
pydoover modbus write_registers --modbus_id 1 --start_address 0 --values '[100, 200, 300]' --register_type 3

Checking bus status:

# Check if the default bus is open
pydoover modbus fetch_bus_status

# Close a specific bus
pydoover modbus close_bus --bus_id my_bus

Related Pages