⚠️ Critical fix: firmware-rule writes never persisted (Homebridge Device Rules tab)
Field debugging on a live 30-device network uncovered that every firmware-rule write through the Homebridge plugin's SOAP client was a silent no-op — the device ACKed each StoreRules upload and then discarded it. The Homebridge UI's Device Rules tab (toggle / delete / create) has never actually changed anything on a device. Three compounding bugs, now fixed in homebridge-dibby-wemo@2.0.40:
- Missing
<processDb>1</processDb>— the client sent<StartSync>NOSYNC</StartSync>where the firmware requiresprocessDb=1to apply an uploaded DB. Proof: the on-deviceruleDbVersionnever advanced across "successful" writes; with the fix it advances and rules genuinely change. - Wrong success detection — success was inferred from the absence of the word "failed"; the firmware signals success via an
<errorInfo>field containingsuccessful. Rejections were invisible. - Schema-stripping rebuild — mutators rebuilt a 3-table SQLite DB from scratch; the firmware's DB has ~10 tables and ignores uploads missing its schema. All mutators now modify the device's own fetched DB in place, echoing back its original zip entry name.
Verified live: 300 firmware rules wiped across 16 devices, every wipe read-back-confirmed, DWM rules untouched.
New: Windows add-on tool — Clear Wemo Firmware Rules
Ships in the NSIS Windows installer: Start menu → Dibby Wemo Manager → Clear Wemo Firmware Rules. Wipes every native firmware rule across all Dibby-discovered devices in one confirmed pass — the dead rules left in each Wemo's on-device database since Belkin shut down their cloud. DWM rules are never touched.
- Explicit
yesconfirmation; cancel-safe - Single
StoreRulesround-trip per device (no per-rule reboot storm), read-back verified - Bounded concurrency (default 6,
DWM_CLEAR_CONCURRENCYto override), 30 s SOAP timeout, one auto-retry on connection errors - Devices on firmware without
FetchRules(Dimmer V2 / newer Lightswitch-3_0) are skipped with a clear note - Clear per-device output + final summary
Security hardening
- Code-signing password removed from the repo. The build reads
WIN_CSC_KEY_PASSWORDfrom the environment; the plaintext value no longer lives inpackage.json. - Docker / Synology web server (
docker/server.js):- Optional
DWM_API_KEY— when set, all state-changing requests (POST/PUT/DELETE) require it viaX-Api-KeyorAuthorization: Bearer, compared withcrypto.timingSafeEqual. GETs and healthchecks stay open. The bundled web UI sends the key automatically once stored vialocalStorage.setItem('dwm.apiKey', …). - Bounded request bodies (
DWM_MAX_BODY, default 1 MiB →413over limit) - Configurable CORS (
DWM_CORS_ORIGIN),X-Content-Type-Options: nosniff, JSON404for unknown/api/*routes
- Optional
Data integrity — atomic stores everywhere
The desktop app store and the Home Assistant store now carry the same protections proven in the Homebridge store: distinguish missing-file from corrupt/unreadable (never overwrite what couldn't be read), atomic tmp+rename writes, rolling .bak with corrupt-file quarantine and recovery, and an empty-write guard that refuses to flatten non-empty data.
The Homebridge scheduler heartbeat moved out of the main store into a tiny .heartbeat sidecar — the main dibby-wemo.json is no longer rewritten once per second (SD-card wear on Pi hosts, and the concurrent-write race surface behind the historical rules-wipe bug).
Carried forward
- v2.0.39's bounded Schedule-rule enforcement (5-minute window, then human override wins)
- v2.0.37's location search fix, v2.0.36's store data-loss protections, v2.0.35's Synology Docker root-fallback
Upgrade
- Homebridge (important):
npm install -g homebridge-dibby-wemo@2.0.40→ restart Homebridge. Device Rules tab edits now actually persist to devices. - Windows desktop: download
Dibby Wemo Manager Setup 2.0.40.exefrom this release's Assets → the new Start-menu tool appears after install. - Synology Container Manager / Docker: Stop → Build → Start (
:latest→ 2.0.40). New optional env knobs:DWM_API_KEY,DWM_CORS_ORIGIN,DWM_MAX_BODY. - Synology
.spk: download the new.spkfor your arch → Package Center → Manual Install. - Node-RED:
npm install -g node-red-contrib-dibby-wemo@2.0.40. - HACS: ⋮ → Reload data → Dibby Wemo → ⋮ → Redownload → 2.0.40 → restart HA (store hardening included).