11 Commits

Author SHA1 Message Date
jessikitty bd4996492d Auto-detect URL from page origin — works on HTTP, HTTPS, LAN IP, or domain
Removed CONFIG_HA_URL. The dashboard now always uses window.location.origin
so it adapts to however you access HA:
- https://ha.hideawaygaming.com.au → wss:// WebSocket
- http://10.0.0.55:8123 → ws:// WebSocket
Same token, no config change needed.
2026-05-18 12:19:21 +10:00
jessikitty b754c0cab6 Hardcode HA token in CONFIG block — set once, works on all devices
Replaced parent-frame auto-detect (blocked by HA iframe sandboxing)
with a CONFIG_HA_TOKEN constant at the top of the script.
Set it once in the file, works on every device automatically.
Falls back to localStorage/manual entry if CONFIG is empty.
2026-05-18 11:54:56 +10:00
jessikitty 9224a3fd58 Auto-detect HA auth from parent frame — no manual token entry needed
When loaded as panel_iframe inside HA, the dashboard now automatically
grabs the session token from the parent frame. This means:
- No setup screen on new devices — just log into HA and it works
- Token refreshes automatically on reconnect (session tokens rotate)
- If auto-auth fails, retries with fresh token before showing error
- Falls back to localStorage/manual entry if not inside HA iframe
- Settings modal shows auto-auth status indicator
2026-05-18 00:12:00 +10:00
jessikitty 4142d1c9e1 Fix empty display after save (lastSaveTime guard) + OPNsense JSON payload fix 2026-05-17 00:28:26 +10:00
jessikitty a566400746 Fix: use sensor.home_dhcp_leases_lan with attributes.Leases (capital L), address/hostname/expires fields 2026-05-16 19:52:37 +10:00
jessikitty 8a5fe108dc Fix: chunked storage (12x255=3060 chars), no CFG reference, clean parseCfg/saveCfg 2026-05-16 18:15:46 +10:00
jessikitty 4ecdda5322 Redesign: use OPNsense DHCP lease sensor for discovery/status, fix save error handling, add HA+DHCP status indicators, cleaner UI 2026-05-16 15:13:24 +10:00
jessikitty 5593d1411b Fix: use ws.send() directly for auth — send() expects a result response but HA responds to auth with auth_ok/auth_invalid (no id), causing 60s timeout loop 2026-05-15 16:22:31 +10:00
jessikitty 76b67d3470 Fix connection timeout: use REST API for initial state load, increase WS timeout to 60s
Large HA instances with many entities cause get_states to exceed the 12s
WebSocket timeout. Now loads all states via /api/states HTTP endpoint first
(much more reliable for large payloads), with WebSocket get_states as fallback.
Also bumped WS send timeout from 12s to 60s for slow HA responses.
2026-05-15 16:11:44 +10:00
jessikitty 28e2bf167f Fix: replace double-encoded file with correct HTML dashboard 2026-05-10 21:23:39 +10:00
jessikitty 22e740e754 Add parental controls dashboard HTML
- HA WebSocket connection with auto-reconnect
- User cards with colour coding and per-user block toggle
- Device assignment by MAC (pick from discovered devices or enter manually)
- Per-device block toggle with online/offline indicator
- Weekday/weekend schedule blocking (overnight ranges supported)
- Auto re-block on device reconnect with new IP
- First-time setup screen, credentials stored in localStorage
2026-05-10 21:13:39 +10:00