ha_creality_ws v0.5.1
This combined release fixes the Lovelace card not showing in the picker (and the visual editor error), adds automatic cache-busting for the card resource, hardens the WebSocket client, and introduces unit tests and shared utilities.
Breaking change
- Card element tag renamed to comply with Custom Elements spec:
- Old:
custom:k_printer_card - New:
custom:k-printer-card - Update any YAML cards to use the new tag.
- Old:
Highlights
- Card picker/visual editor
- Card appears again in the picker.
- Visual editor works (editor element is properly defined).
- Resource auto-registration (storage mode)
- Lovelace resource now registered/updated with cache-busting query (?v=), so updates load without manual cache clears.
- WebSocket client
- URL built from
WS_URL_TEMPLATE(no hardcoded port). - Clearer connect/close/error logging with host context.
- Keeps app-level heartbeat and periodic GETs for steady telemetry.
- URL built from
- Reliability
- Lovelace resource registration failures are non-fatal and won’t block setup.
Code quality
- New
utilsmodule:coerce_numbers,parse_model_version,parse_position,safe_float,extract_host_from_zeroconf.
- Sensors/entities refactored to use helpers; duplicate imports and placeholders removed.
- Unit tests for utils (pure unit tests; no HA runtime required).
- Minimal CI workflow to run pytest on pushes/PRs.
- README updated with new tag and storage-mode cache-busting.
Dependency
- Added to integration requirements:
websockets>=10.4
Upgrade notes
- Update your card YAML (if needed)
type: custom:k-printer-card
- Hard refresh Lovelace once
- Desktop:
Ctrl+F5(Windows/Linux),⌘+Shift+R(macOS) - Mobile App: App Settings → Reload resources (or force close)
- Desktop:
- Storage mode resource
- Settings → Dashboards → ⋮ → Resources should list:
/local/ha_creality_ws/k_printer_card.js?v=<build_mtime>(type: module)
- If duplicates exist, keep the versioned entry and remove the old one.
- Settings → Dashboards → ⋮ → Resources should list:
- YAML mode resource
- Keep:
/local/ha_creality_ws/k_printer_card.js - Optionally add
?v=1once to bust cache.
- Keep:
Troubleshooting
- If the card still appears stale:
- Verify the resource is versioned in storage mode or add a one-time
?v=in YAML mode. - Check browser console for 404s or custom element definition errors and open an issue with logs.
- Verify the resource is versioned in storage mode or add a one-time
Thanks for using ha_creality_ws!