Skip to content

feat(zap): PT2260 lighting controls — Tasks 1–5 (no hardware) - #13

Merged
metaframework-dispatch-bot[bot] merged 9 commits into
mainfrom
claude/12-lighting-controls
Jul 15, 2026
Merged

feat(zap): PT2260 lighting controls — Tasks 1–5 (no hardware)#13
metaframework-dispatch-bot[bot] merged 9 commits into
mainfrom
claude/12-lighting-controls

Conversation

@metaframework-dispatch-bot

Copy link
Copy Markdown

Summary

Tasks 1–5 from the implementation plan — no hardware required. Tasks 6 & 7 (RTL-SDR capture, lamp verification) stay Tom-in-the-loop and land after this merges.

  • Task 1 — PT2260 tri-state pulse-train encoder + resolve_code() (per-unit codes under units.<name>.codes.on/off) in src/device.py.
  • Task 2pulses payload builder with firmware-mirrored validation limits (µs 1..100000, 1..256 pairs, repeat_count 1..100, total-duration budget ≤ 5,000,000 µs).
  • Task 3 — Generic {pulses, repeat_count} shape on POST /transmit in firmware/src/main.cpp. Legacy {bits, timing} and /fan/* routes untouched. Watchdog fed inside the pulse-pair loop; PT2260 sync pair is the last element and every pair ends LOW (per spec §4).
  • Task 4 — CLI (cli.py) routes PT2260 profiles through the pulse-train payload path; validates commands per encoding (fan on/off/hi/med/lo, PT2260 codes live under units.<unit>.codes.<command>).
  • Task 5scripts/export_web_devices.py derives the PWA's devices.json from devices/zap_lights.yaml — one source of truth.

Firmware code compiles but requires a Tom flash before Task 7 (lamp verification). All host-side tests pass.

Test plan

  • 62 tests, 0.17s
  • Ruff format + check: clean
  • Task 6 (RTL-SDR capture): Tom's next step — rtl_433 -f 433.92M -A -S unknown on the living-room remote's 8 buttons, populate devices/zap_lights.yaml codes
  • Task 7 (lamp verification): after 6 + firmware flash, python cli.py PROFILE UNIT COMMAND for each of the four outlets
Captured test run (showboat)

Issue #12 Tasks 1-5 test run

2026-07-14T00:53:52Z by Showboat 0.6.1

uv run pytest
warning: `VIRTUAL_ENV=/Users/tom/Documents/work/metaframework/.venv` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
============================= test session starts ==============================
platform darwin -- Python 3.13.7, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/tom/Documents/work/radiofrequency
configfile: pyproject.toml
testpaths: tests
plugins: anyio-4.13.0
collected 62 items

tests/test_cli.py ......                                                 [  9%]
tests/test_device.py ..................................                  [ 64%]
tests/test_export_web_devices.py .                                       [ 66%]
tests/tpms/test_api.py .......                                           [ 77%]
tests/tpms/test_db.py ......                                             [ 87%]
tests/tpms/test_ingest.py ........                                       [100%]

============================== 62 passed in 0.17s ==============================

Closes #12

🤖 Generated with Claude Code

dispatch-bot[bot] and others added 9 commits July 13, 2026 08:13
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nt, PWA/Caddy details)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@metaframework-dispatch-bot
metaframework-dispatch-bot Bot merged commit 9bf91de into main Jul 15, 2026
1 check passed
@metaframework-dispatch-bot
metaframework-dispatch-bot Bot deleted the claude/12-lighting-controls branch July 15, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan for adding lighting controls to existing radiofrequency server and html interface

1 participant