A command-line interface for sending MQTT commands to radio-gaga clients.
go build -o radio-gaga-cli./radio-gaga-cli [options]-broker- MQTT broker hostname (default: localhost)-port- MQTT broker port (default: 1883)-username- MQTT username-password- MQTT password-client-id- MQTT client ID (default: radio-gaga-cli)-tls- Use TLS connection (default: false)-vehicle- Vehicle identifier (required)-command- Command to send (required)-params- Command parameters as JSON string (default: {})-request-id- Request ID (auto-generated if not provided)-timeout- Timeout in seconds when waiting for responses (default: 10)-subscribe- Subscribe to all response topics and wait for responses (default: false)-wait-ack- Wait for command acknowledgement on acks topic (default: false)-wait-data- Wait for data response on data topic (default: false)
Get a configuration value and wait for data response:
./radio-gaga-cli -vehicle=TEST-001 -command=config:get -params='{"field":"telemetry.intervals.driving"}' -wait-dataSet a configuration value and wait for acknowledgement:
./radio-gaga-cli -vehicle=TEST-001 -command=config:set -params='{"field":"debug","value":true}' -wait-ackDelete/clear a configuration value and wait for both ack and data:
./radio-gaga-cli -vehicle=TEST-001 -command=config:del -params='{"field":"telemetry.intervals.driving"}' -wait-ack -wait-dataSave configuration to file and wait for acknowledgement:
./radio-gaga-cli -vehicle=TEST-001 -command=config:save -wait-ackGet entire configuration and wait for data response:
./radio-gaga-cli -vehicle=TEST-001 -command=config:get -wait-dataGet status:
./radio-gaga-cli -vehicle=TEST-001 -command=status -subscribeRestart service:
./radio-gaga-cli -vehicle=TEST-001 -command=restartExecute shell command (development only):
./radio-gaga-cli -vehicle=TEST-001 -command=shell -params='{"command":"uptime"}' -subscribe./radio-gaga-cli -broker=mqtt.example.com -username=myuser -password=mypass -vehicle=TEST-001 -command=status -subscribe./radio-gaga-cli -broker=mqtt.example.com -port=8883 -tls -username=myuser -password=mypass -vehicle=TEST-001 -command=status -subscribeRadio-gaga sends responses on two different MQTT topics:
Contains command acknowledgements with status information:
{
"status": "success",
"error": "",
"request_id": "cli-1234567890"
}Contains actual response data (e.g., configuration values, command results):
{
"status": "success",
"config": {"debug": true},
"request_id": "cli-1234567890"
}-wait-ack: Wait only for acknowledgement on the acks topic-wait-data: Wait only for data response on the data topic-wait-ack -wait-data: Wait for both acknowledgement and data response-subscribe: Subscribe to both topics and show all messages (legacy mode)
- config:get: Use
-wait-data(returns configuration data) - config:set: Use
-wait-ack(returns acknowledgement) - config:del: Use
-wait-ack -wait-data(returns both ack and data with previous value) - config:save: Use
-wait-ack(returns acknowledgement) - status: Use
-wait-data(returns status information) - shell commands: Use
-wait-data(returns command output)
Commands are sent as JSON to the topic scooters/{vehicle}/commands:
{
"command": "config:set",
"params": {
"field": "debug",
"value": true
},
"request_id": "cli-1234567890"
}You can also set options via environment variables:
MQTT_BROKER- MQTT broker hostnameMQTT_PORT- MQTT broker portMQTT_USERNAME- MQTT usernameMQTT_PASSWORD- MQTT passwordMQTT_USE_TLS- Use TLS (true/false)
Command-line flags take precedence over environment variables.
# Linux
GOOS=linux GOARCH=amd64 go build -o radio-gaga-cli-linux
# Windows
GOOS=windows GOARCH=amd64 go build -o radio-gaga-cli.exe
# macOS
GOOS=darwin GOARCH=amd64 go build -o radio-gaga-cli-macos- Check that the MQTT broker is running and accessible
- Verify the broker hostname and port
- Check firewall settings
- For TLS connections, ensure certificates are valid
- Verify username and password are correct
- Check that the user has permission to publish to command topics
- Check that the user has permission to subscribe to data topics
- Ensure the vehicle identifier matches exactly
- Check that radio-gaga is running on the target vehicle
- Verify the vehicle is connected to the same MQTT broker
- Use
-subscribeflag to wait for responses - Increase timeout with
-timeoutif responses are slow