CLI Overview
The WhookTown CLI (wt) is a command-line tool for managing your WhookTown infrastructure from the terminal.
Features
- Send sensor data - Update building states from scripts and monitoring tools
- Manage layouts - Create, update, and archive city layouts
- Control scenes - Camera and traffic commands
- Workflow management - Create and manage automation workflows
- Multi-environment - Switch between dev/prod contexts
Installation
From Source
# Clone the repository
git clone https://github.com/whooktown/whooktown-cli.git
cd whooktown-cli
# Build the binary
go build -o wt ./cmd/wt
# Move to PATH (optional)
sudo mv wt /usr/local/bin/
Verify Installation
wt version
# Output: wt version X.Y.Z
Shell Completion
Enable tab completion for your shell:
Configuration
Config File Location
~/.whooktown/config.yaml
Config Structure
current_context: default
contexts:
default:
name: default
token: "eyJ..."
environment: PROD
default_layout: ""
dev:
name: dev
token: "eyJ..."
environment: DEV
# Optional custom URLs
auth_url: "https://auth.custom.com"
sensor_url: "https://sensor.custom.com"
Managing Config
# Show current configuration
wt config show
# Set a value
wt config set environment PROD
wt config set default_layout <layout_id>
# Switch contexts
wt config use-context dev
wt config use-context prod
# List contexts
wt config get-contexts
Global Flags
Available with all commands:
| Flag |
Description |
--config <path> |
Config file path (default: ~/.whooktown/config.yaml) |
--token <token> |
Override token (for scripts) |
--env <env> |
Override environment: dev or prod |
--json |
Output in JSON format |
--debug |
Enable debug output |
Examples
# Use dev environment for one command
wt --env dev layout list
# Use specific token
wt --token <token> sensor send --id <id> --status online
# JSON output for scripting
wt layout list --json | jq '.layouts[].name'
Command Categories
Authentication
| Command |
Description |
wt login |
Log in with email (magic link) |
wt logout |
Remove stored credentials |
wt whoami |
Show current account info |
Learn more →
Token Management
| Command |
Description |
wt token list |
List your tokens |
wt token create |
Create new token |
wt token revoke |
Revoke a token |
Learn more →
Layouts
| Command |
Description |
wt layout list |
List layouts and quota |
wt layout create |
Create new layout |
wt layout update |
Update existing layout |
wt layout delete |
Delete a layout |
wt layout archive |
Archive operations |
Learn more →
Sensors
| Command |
Description |
wt sensor send |
Send sensor data |
Learn more →
Workflows
| Command |
Description |
wt workflow list |
List workflows |
wt workflow create |
Create workflow |
wt workflow enable |
Enable workflow |
wt workflow disable |
Disable workflow |
wt workflow export |
Export as JSON |
wt workflow delete |
Delete workflow |
Learn more →
Scene Controls
| Command |
Description |
wt camera |
Camera commands |
wt traffic |
Traffic control |
Learn more →
Quick Examples
Update a Building
wt sensor send --id <building-uuid> --status online --activity fast
Check Quota
Start Flyover
wt camera command --layout <id> --mode flyover --path <path-id>
Getting Help
# General help
wt help
# Command-specific help
wt layout --help
wt sensor send --help