Skip to content

feat: the unit finds the broker by a UDP beacon from the launcher - #16

Merged
mohanvd merged 2 commits into
mainfrom
15-broker-beacon
Nov 17, 2026
Merged

mohanvd merged 2 commits into
mainfrom
15-broker-beacon

Conversation

@mohanvd

@mohanvd mohanvd commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Closes #15

The project network is moving to a phone hotspot, where the laptop's IP address changes every time. The unit now finds the broker by itself.

What changed

  • Launcher: invigil start also starts python -m invigil.beacon, which broadcasts invigil broker <mqtt port> <tag> once a second on UDP port 18830, from every network address the laptop has. stop stops it, and the status screen has a Beacon line.
  • Firmware 0.3.0: after Wi-Fi is up, the unit listens for the beacon and connects to the sender. MQTT_HOST in secrets.h is an optional fallback, tried after 5 s without a beacon. When the beacon comes from another address and the old one has missed 3 beacons, the unit drops the old connection and connects to the new address.
  • Signature: the tag is HMAC-SHA256 with the hash salt as key over the port and the sender's address. The unit checks it against the address the datagram came from, so a copied beacon cannot point the unit at another device.
  • Scan windows: listening is receive only. Connects, reconnects and moves happen between cycles, and a move drops the old connection with one TCP reset, not a close that would keep resending.

Tests

  • Host tests for the beacon check, HMAC-SHA256 (RFC 4231 vectors) and the sender choice, in firmware/tests/test_portable.c.
  • check_contract.py compares the beacons the firmware expects with the ones invigil/beacon.py builds.
  • invigil/tests/test_beacon.py for the launcher side.

Hardware

Flashed on unit N1: boots as 0.3.0 and the beacon listener self-check passes. Finding the broker on the hotspot is not checked yet. See the comments below.

The launcher broadcasts a signed beacon once a second on UDP port 18830.
The unit listens for it after Wi-Fi connects and uses the sender's address
as the MQTT host, so the laptop's IP address may change. MQTT_HOST in
secrets.h is now an optional fallback. When the beacon moves to another
address the unit reconnects there, between cycles. Firmware 0.3.0.
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
invigil-demo Ready Ready Preview Nov 17, 2026 7:19am UTC

Request Review

@mohanvd
mohanvd merged commit 7035956 into main Nov 17, 2026
7 checks passed
@mohanvd
mohanvd deleted the 15-broker-beacon branch November 17, 2026 14:13
@github-project-automation github-project-automation Bot moved this from Todo to Done in Invigil Nov 17, 2026
mohanvd added a commit that referenced this pull request Nov 22, 2026
* feat: the unit finds the broker by a UDP beacon from the launcher

The launcher broadcasts a signed beacon once a second on UDP port 18830.
The unit listens for it after Wi-Fi connects and uses the sender's address
as the MQTT host, so the laptop's IP address may change. MQTT_HOST in
secrets.h is now an optional fallback. When the beacon moves to another
address the unit reconnects there, between cycles. Firmware 0.3.0.

* docs: first hardware run of the broker beacon on a phone hotspot

This branch was successfully deployed

1 active deployment
Preview — f7a6c5da Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Unit finds the broker by itself on a network where the laptop IP changes

1 participant