Skip to main content

Overview

In this quick start guide, you’ll build a simple WiFi Controller Pilot that connects to Qaptly Desktop and executes WiFi commands. This example demonstrates the core UPP concepts in a working implementation.

Prerequisites

  • Qaptly Desktop version 0.15.0 or later
  • Python 3.8+ installed
  • Basic knowledge of Python and JSON

Step 1: Install Dependencies

First, install the WebSocket library:

Step 2: Create Your Pilot

Create a file named wifi_pilot.py:
Important: Replace <qaptly_desktop_ip> with the actual IP address of the machine running Qaptly Desktop on your local network (e.g., 192.168.1.100). You can find this IP address in your network settings or by running ifconfig (macOS/Linux) or ipconfig (Windows).

Step 3: Start Qaptly Desktop

  1. Launch Qaptly Desktop application
  2. The UPP service starts automatically on port 18765

Step 4: Run Your Pilot

Execute the pilot script:
You should see:

Step 5: Approve the Connection

A dialog will appear in Qaptly Desktop:
Click Approve.

Step 6: Test the Connection

Your pilot should receive:

Step 7: Execute a Command

You can now execute commands from Qaptly. The pilot will receive commands and respond automatically. For example, if Qaptly sends a wifi.scan command, you’ll see:

Next Connection (With Key)

For subsequent connections, use the assigned key:
With a valid key, your pilot will be approved automatically without user interaction.

Key Concepts Demonstrated

This example shows: βœ… WebSocket Connection - Connect to ws://<qaptly_desktop_ip>:18765/upp βœ… Message Format - All messages follow UPP structure βœ… Registration - Declare pilot info and capabilities βœ… Authentication - First-time approval + key-based auth βœ… Command Handling - Receive and respond to commands βœ… Heartbeat - Keep connection alive every 30 seconds βœ… JSON Schema - Define params and returns for each capability

Troubleshooting

”Connection refused”

  • Make sure Qaptly Desktop is running
  • Check that no firewall blocks port 18765
  • Verify you’re connecting to <qaptly_desktop_ip> (localhost)

β€œRegistration failed: AUTH_FAILED”

  • Your key may be invalid or expired
  • Try connecting without a key (first-time flow)
  • Check for typos in the key string

Heartbeat timeout

  • Your pilot must send heartbeat every 30 seconds
  • Connection closes after 90 seconds without any message

Next Steps

Now that you have a working pilot:
  1. Add real WiFi control - Replace simulation with actual network commands
  2. Implement more capabilities - Add wifi.connect, wifi.disconnect
  3. Send events - Notify Qaptly about WiFi state changes
  4. Read the protocol - Understand all message types and flows

Protocol Reference

Complete message specifications

Capabilities Guide

Define complex capabilities with JSON Schema

Authentication

Security model and key management

Examples

More complete implementations