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
| Command | Description |
|---|---|
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
| Command | Description |
|---|---|
fetch_system_voltage | Get the system input voltage. |
fetch_system_power | Get the system input power in watts. |
fetch_system_temperature | Get the system temperature (CM4 temperature on Doovits). |
fetch_location | Get the device GPS location. |
fetch_io_table | Fetch the full I/O table showing all pin configurations. |
fetch_immunity_seconds | Get the current shutdown immunity period in seconds. |
Device Control
| Command | Description |
|---|---|
test_comms | Send an echo message to verify gRPC connectivity. Optional --message flag. |
reboot | Reboot the device. |
shutdown | Shut 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_rtc | Synchronise 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
| Command | Description |
|---|---|
get_is_dda_available | Check if the Device Agent service is reachable. |
get_is_dda_online | Check if the Device Agent is currently connected to the cloud. |
get_has_dda_been_online | Check if the Device Agent has been online at least once since boot. |
Channel Operations
| Command | Description |
|---|---|
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_token | Fetch a TURN server credential for WebRTC. |
Message Operations
| Command | Description |
|---|---|
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
| Command | Description |
|---|---|
open_bus | Open a Modbus bus connection. See parameters below. |
close_bus | Close a Modbus bus. Optional --bus_id (default: "default"). |
fetch_bus_status | Check if a bus is open. Optional --bus_id (default: "default"). |
test_comms | Send an echo message to verify gRPC connectivity. |
The open_bus command accepts the following parameters:
| Parameter | Default | Description |
|---|---|---|
--bus_type | serial | Bus type: serial or tcp. |
--name | default | Bus identifier. |
--serial_port | /dev/ttyS0 | Serial port path. |
--serial_baud | 9600 | Baud rate. |
--serial_method | rtu | Serial method: rtu or ascii. |
--serial_bits | 8 | Data bits. |
--serial_parity | N | Parity: N, E, or O. |
--serial_stop | 1 | Stop bits. |
--serial_timeout | 0.3 | Serial timeout in seconds. |
--tcp_uri | 127.0.0.1:5000 | TCP connection URI. |
--tcp_timeout | 2 | TCP timeout in seconds. |
Register Operations
| Command | Description |
|---|---|
read_registers | Read registers from a Modbus device. |
write_registers | Write values to registers on a Modbus device. |
Both register commands accept:
| Parameter | Default | Description |
|---|---|---|
--bus_id | default | Bus identifier. |
--modbus_id | 1 | Modbus device address. |
--start_address | 0 | Starting register address. |
--num_registers | 1 | Number of registers to read (read only). |
--values | None | Values to write as a list (write only). |
--register_type | 4 | Register type (1=coil, 2=discrete, 3=holding, 4=input). |
--configure_bus | True | Whether 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
- pydoover CLI Overview -- installation and basic usage