Summary
- Merges 8 commits from cjkas/ESPSomfy-RTS up to upstream
v3.0.13(RTW decoder fix,/controllerchunked streaming, login UX) - Bumps version to
v3.2.0acrossappversion,FW_VERSION, and asset cache-bust strings - Preserves all our HCSR04 distance-sensor work and
shailensobheeSSDP branding
Upstream commits taken
26400c5 — Fix off-by-one bug in RTW protocol decoder
- src/Somfy.cpp:177 — replaces special-case
cmd = encKey == 133 ? My : (encKey - 133)with the symmetric inverse of the encoder (encKey - 132). Old formula decoded every non-My RTW command one slot too low (Up read as My, Down as MyUp). - src/Somfy.h:192 — adds
uint8_t rawCmdtosomfy_frame_tso the raw command nibble (decoded[1] >> 4) is preserved before any protocol-classification rewriting ofcmd. - src/Somfy.cpp:164-165 — populate
rawCmdindecodeFrame. - src/Somfy.cpp:4434-4437 — new
ESP_LOGIon every valid RX showingADDR / CMD / RAW_CMD / KEY / PROTO. - src/Somfy.cpp:4451 — emit
rawCmdin the WebSocket frame event. - data-src/index.html:1030 — adds Raw header span to the frame log.
- data-src/index.js:2956-2957 — render
rawCmdas uppercase hex (0x{N}); blank if older firmware. - data-src/main.css:835-839 — sizes and centers the new column.
6365f16 — Memory-bounded streaming builder for /controller
- src/WResp.h:55-60,
src/WResp.cpp— newBufferedJsonFormattersubclass ofJsonFormatterwriting into a caller-supplied fixed buffer. - src/Web.cpp:428 — new
ControllerChunkerclass owning a 3072-byte buffer; produces the/controllerJSON one section at a time (HEADER → ROOMS → SHADES → GROUPS → REPEATERS → DONE). - src/Web.cpp:699-700 —
handleControllerrewritten to drive the chunker viarequest->beginChunkedResponse(...). Eliminates the OOM hit that affected users with many shades/groups.
4f7fa73 — Login UX
data-src/login.html— wraps login in a real<form>; tags inputs withautocomplete="username"/"current-password"so password managers work.- data-src/index.js:1260-1262 — on successful login, store the credential via
new PasswordCredential(...)+navigator.credentials.store(...)when the API is available. appversionfetch is now properly awaited so the version string in the UI no longer flashes the placeholder.
Marker / merge commits
5c90715— merge of PR cjkas#24 (RTW decoder)f51e90b— chore: bump v3.0.1215e7dd1— merge of PR cjkas#25 (controller streaming)6f856ff— merge of PR cjkas#26 (login UX)3ba27ad— chore: bump v3.0.13
What we kept over upstream
FW_VERSION/appversion/ cache-bust strings → v3.2.0 (intentionally ahead of upstream's v3.0.13)- src/ESPNetwork.cpp:323-332 SSDP fields → kept the
shailensobheebranding from74d126c(no conflict — upstream didn't touch those lines after our fork point) - Somfy noise-detection thresholds from
305a4b2— unchanged (upstream only reworded the comment)
What was preserved on our side through the merge
- Full HC-SR04 sensor stack:
src/HCSR04.cpp/.h,HCSR04SettingsonConfigSettings, MQTT/SomfyController wiring,/hcsr04settings+/connecthcsr04+/discoveryroutes, Sensors tab with live distance via WebSocketdistanceevent
Conflict resolutions in merge commit 4969720
data-src/appversion,src/ConfigSettings.h,data-src/index.html(×2),data-src/index.js(×2): version-string conflicts — kept ours (re-bumped tov3.2.0here)src/Web.cppinclude block: took both —#include ""HCSR04.h""(ours) plus#include <memory>(upstream needs it forstd::make_shared<ControllerChunker>at Web.cpp:699)
Build status
- ✅
pio run -e esp32c6succeeded — RAM 27.6%, Flash 38.9% - ✅ Firmware + LittleFS flashed to ESP32-C6 (XIAO), boots and serves UI
Test plan
- Build for esp32c6 (no errors)
- Flash firmware + filesystem
- Web UI shows version
v3.2.0 - HC-SR04 distance live-updates every second on Sensors tab
- Frame Log shows new Raw column populated with
0x{N}hex on Somfy RX - RTW remote (if available): non-My commands decode correctly (Up = Up, Down = Down, not the off-by-one mappings)
-
/controllerendpoint loads (chunked streaming) with shades populated - Logout/login: browser offers to save credentials via
PasswordCredentialAPI - No regressions in shade control, groups, MQTT discovery
🤖 Claude, Shailen and my friend cjkas - also helped by the same Claude - improved this code and made it robust!