Add experimental ESPHome touchscreen example - #1
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an experimental ESPHome-based wireless touchscreen panel integration for Joydex. It adds a Windows-side adapter/transport that talks directly to an ESPHome panel over Digest-authenticated REST and SSE, plus a DPAPI-protected configuration store, an interactive provisioning tool, firmware examples pinned to ESPHome 2026.7.2, and supporting documentation/assets.
Changes:
- Added a new
Joydex.WirelessPanellibrary for DPAPI-protected per-user configuration and schema validation. - Added a new
Joydex.Windows.WirelessPanelimplementation (SSE parser, REST transport, adapter) and wired it into the Joydex tray app lifecycle. - Added an interactive provisioning tool, extensive tests, and ESPHome firmware + docs for the ESP32-4848S040C_I panel.
Reviewed changes
Copilot reviewed 30 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/Joydex.WirelessPanel.Configure/Program.cs | New interactive provisioning CLI for panel endpoint/credentials, saves via DPAPI-backed store. |
| tools/Joydex.WirelessPanel.Configure/Joydex.WirelessPanel.Configure.csproj | New Windows-targeted provisioning tool project. |
| THIRD_PARTY_NOTICES.md | Adds licensing/attribution note for the published scale photograph. |
| tests/Joydex.WirelessPanel.Tests/WirelessPanelConfigurationTests.cs | Tests validation rules and password exclusion from diagnostics/JSON. |
| tests/Joydex.WirelessPanel.Tests/WirelessPanelConfigurationStoreTests.cs | Tests DPAPI encrypt/decrypt round-trip, schema validation, and temp-file behavior. |
| tests/Joydex.WirelessPanel.Tests/ProvisioningToolProcessTests.cs | Process-level tests for provisioning tool argument rejection / redirected input handling. |
| tests/Joydex.WirelessPanel.Tests/Joydex.WirelessPanel.Tests.csproj | New test project for wireless-panel library + provisioning tool. |
| tests/Joydex.Tests/EspHomePanelTransportTests.cs | Tests SSE parsing, press tracking, REST select posting serialization/timeouts, and reconnect behavior. |
| tests/Joydex.Tests/EspHomePanelAdapterTests.cs | Tests adapter projection, navigation/acknowledgement behavior, Plan Mode action routing, and publish coalescing/retry semantics. |
| src/Joydex.WirelessPanel/WirelessPanelConfigurationStore.cs | New DPAPI-protected JSON store with strict schema and best-effort ACL hardening. |
| src/Joydex.WirelessPanel/WirelessPanelConfiguration.cs | New validated configuration model (http-only endpoint boundary, username/password constraints). |
| src/Joydex.WirelessPanel/Joydex.WirelessPanel.csproj | New library project (net8.0-windows) with ProtectedData dependency. |
| src/Joydex.Windows/WirelessPanel/EspHomeSseParser.cs | Adds bounded SSE line reader + ESPHome state event parsing + press edge tracking. |
| src/Joydex.Windows/WirelessPanel/EspHomePanelTransport.cs | Adds Digest-auth HTTP client transport for /events + select updates, with reconnection and serialization. |
| src/Joydex.Windows/WirelessPanel/EspHomePanelModels.cs | Defines panel button/task-state enums used by adapter/transport. |
| src/Joydex.Windows/WirelessPanel/EspHomePanelAdapter.cs | Adds host policy adapter: projects task alerts to panel states and routes touch events to navigation/actions. |
| src/Joydex.App/TrayApplicationContext.cs | Wires panel adapter into app startup/shutdown and task-alert change propagation. |
| src/Joydex.App/Joydex.App.csproj | Adds reference to the new Joydex.WirelessPanel project. |
| scripts/Publish-Joydex.ps1 | Publishes the provisioning tool alongside the app into the release output. |
| README.md | Documents the experimental touchscreen feature, device, and where to start. |
| Joydex.sln | Adds new projects (wireless panel library, provisioning tool, wireless panel tests) to the solution. |
| firmware/esphome/secrets.example.yaml | Adds example secrets template for Wi-Fi/Web Server/OTA credentials. |
| firmware/esphome/requirements.txt | Pins ESPHome to 2026.7.2 for repeatable builds. |
| firmware/esphome/README.md | End-to-end firmware + provisioning + security-boundary instructions. |
| firmware/esphome/joydex-panel.yaml | Neutral ESPHome/LVGL firmware example implementing the panel contract. |
| firmware/esphome/joydex-panel-bridge.yaml | Bridge-console ESPHome/LVGL firmware example implementing the same contract. |
| firmware/esphome/.gitignore | Ignores ESPHome build output, secrets, and firmware artifacts in the firmware directory. |
| docs/WIRELESS_TOUCHSCREEN_RESEARCH_V1.1.md | Public research/design record, contract definition, and lessons learned. |
| docs/ESP32_4848S040C_I_DEVICE_REFERENCE.md | Device-specific findings, pin/timing notes, and repeatability checklist. |
| CHANGELOG.md | Records the new experimental touchscreen capability in the dated changelog. |
| .gitignore | Ensures ESPHome secrets, venv, and build output stay out of Git. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 33 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/Joydex.WirelessPanel/WirelessPanelConfigurationStore.cs:87
Load()has a TOCTOU race: the file can be deleted between theFile.Exists(...)check andFileInfo.Length, causingFileNotFoundExceptionto escape even though the method contract is to returnnullwhen no settings exist. Handle “file vanished” as “no configuration”.
var fileInfo = new FileInfo(ConfigurationPath);
if (fileInfo.Length is <= 0 or > MaximumDocumentBytes)
{
throw new InvalidDataException(
$"The wireless-panel settings file must contain 1 to {MaximumDocumentBytes} bytes.");
What changed
Why
This provides an experimental way to display four Joydex task states and invoke task or Plan Mode actions from an ESP32-4848S040C_I touchscreen on a normal trusted Wi-Fi LAN, without Home Assistant, MQTT, or custom panel firmware.
Validation
dotnet format Joydex.sln --verify-no-changes --no-restorepassed.Manual hardware checklist
The final physical pass showed one tiny redraw-local flicker while all four task cards changed. That remains within the documented acceptance threshold for this experimental example.
Security and scope