> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heylua.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Commands

> Reference for all device-related CLI commands

## lua devices

Manage connected devices from the command line.

```bash theme={null}
lua devices [action] [options]
```

### Actions

| Action         | Description                                 |
| -------------- | ------------------------------------------- |
| *(none)*       | Interactive device management               |
| `list`         | List all connected devices                  |
| `status`       | Check the status of a specific device       |
| `enable`       | Enable a device                             |
| `disable`      | Disable a device (stops receiving commands) |
| `remove`       | Remove a device from the agent              |
| `test`         | Interactively test a device command         |
| `test-trigger` | Test a device trigger                       |

### Options

| Flag                   | Description                                    |
| ---------------------- | ---------------------------------------------- |
| `--device-name <name>` | Target device name                             |
| `--group <group>`      | Filter by device group                         |
| `--payload <json>`     | JSON payload for test commands (default: `{}`) |
| `--force`              | Skip confirmation prompts                      |

### Examples

```bash theme={null}
# Interactive management
lua devices

# List all connected devices
lua devices list

# List devices in a specific group
lua devices list --group warehouse-floor

# Check device status
lua devices status --device-name label-printer

# Enable a device
lua devices enable --device-name label-printer

# Disable a device
lua devices disable --device-name label-printer

# Remove a device (with confirmation)
lua devices remove --device-name label-printer

# Remove without confirmation
lua devices remove --device-name label-printer --force

# Test a command interactively
lua devices test --device-name label-printer

# Test a trigger
lua devices test-trigger --device-name label-printer
```

## lua push device-trigger

Push a compiled device trigger to the server.

```bash theme={null}
lua push device-trigger [name]
```

Device triggers are agent-side primitives that handle events fired by devices. They are compiled, versioned, and pushed like other Lua primitives (skills, webhooks, jobs).

<Steps>
  <Step title="Compile">
    ```bash theme={null}
    lua compile
    ```

    The compiler detects `defineDeviceTrigger()` calls and bundles them.
  </Step>

  <Step title="Push">
    ```bash theme={null}
    # Push a specific device trigger
    lua push device-trigger temperature-alert

    # Push all primitives (including device triggers)
    lua push
    ```
  </Step>

  <Step title="Deploy">
    ```bash theme={null}
    lua deploy
    ```

    Activates the pushed version.
  </Step>
</Steps>

## lua compile

The compiler automatically detects device-related primitives in your source code:

* **`defineDeviceTrigger()`** calls are compiled as device trigger primitives
* **`defineDevice()`** calls define device metadata (commands and inline triggers)

No special flags are needed -- `lua compile` handles everything.

```bash theme={null}
lua compile
```

Output includes device triggers alongside other primitives:

```
Compiled:
  Skills: 2
  Webhooks: 1
  Device Triggers: 3
  Jobs: 0
```

## lua chat

Test device interactions through the chat interface:

```bash theme={null}
lua chat
```

When devices are connected, the agent has access to their commands as tools. You can test device interactions by chatting naturally:

```
> What devices are connected?
> Read the temperature from pico-sensor
> Turn on the LED on my device
```

<Note>
  The device must be running and connected for its tools to appear. If you do not see device tools, check that your device is online with `lua devices list`.
</Note>

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/devices/quickstart">
    Connect your first device
  </Card>

  <Card title="Triggers" icon="bolt" href="/devices/triggers">
    Device trigger development guide
  </Card>

  <Card title="Node.js Client" icon="node-js" href="/devices/node-client">
    Full device client reference
  </Card>

  <Card title="Overview" icon="satellite-dish" href="/devices/overview">
    Device Gateway architecture
  </Card>
</CardGroup>
