Commit Graph
1476 Commits
Author SHA1 Message Date
Dermot Duffy 9f88aacefe fix: Ensure no camera outlives a failed initialization (#2657) 2026-08-04 21:33:46 -07:00
Dermot Duffy 80ec92e3b2 refactor: Replace Rollup with Vite (#2656)
This is a high risk change: every byte the card ships is emitted by a
different bundler, minified by a different minifier, and every
stylesheet is compiled by a different sass. The intent is that the
card's behaviour is unchanged.

**Significant development win**: Build time drops from 24s to 1.1s 🎉 

Also adds a test suite ('dist') that runs against the built bundle.
2026-08-04 15:00:13 -07:00
Dermot Duffy 06bcfd58ba refactor: Stamp build information in as "defines" (#2654) 2026-08-03 22:36:32 -07:00
Dermot Duffy 2d124fe3cd test: Add a test harness for the built card (#2653)
Mounts the card from `dist/` the way Home Assistant does, by URL with a
HACS tag, and asserts the entry stays a facade, that no chunk imports
it, that the browser is served the file unmodified, and that the card
starts up and fetches a language chunk lazily.

Runs in Chromium, Firefox and WebKit, so a change of bundler or minifier
is checked against every engine.
2026-08-03 21:50:21 -07:00
Dermot Duffy 4a7c1b62b0 perf: Deduplicate concurrent Home Assistant registry list fetches (#2650) 2026-08-02 21:35:48 -07:00
Dermot Duffy 17146c8ca6 fix: Clear the initialized condition state when the card is not usable (#2646)
The `initialized` state (used in conditions/triggers) was written once
and never cleared, so it meant "has this card ever been initialized"
while everything reading it took it as "is this card usable now". Home
Assistant takes a card off the page and puts it back whenever its
dashboard tab is left and returned to, so the card initialized again
while the state claimed it was initialized throughout: `trigger:
initialized` fired once per card rather than once per startup, and
automations were dropped in between.

The card lifecycle is now an explicit state machine (`SessionManager`),
the only writer of `initialized`, which separates a card that is
starting up from one initializing part of itself again while it runs. A
new `ever` parameter (conditions/triggers) selects the old latched
behaviour.

`remote_control` uses that parameter to keep its two camera priorities
correct under repeated starts. With `camera_priority: entity` the card
now re-reads the entity every time it starts, so a camera selected while
the card was away is picked up on return. With `camera_priority: card`
the card writes the entity on its first start only, unchanged, since
repeating that write would overwrite a camera the user had selected.

Closes: #2642


BREAKING CHANGE: `condition: initialized` is now `false` whenever the
card is not usable, and `trigger: initialized` fires each time the card
starts up rather than only the first time. Set `ever: true` on either to
keep the previous behaviour.
2026-08-02 12:52:58 -07:00
Dermot Duffy e590f72783 test: Add a browser based test harness (#2641) 2026-07-31 10:16:58 -07:00
Dermot Duffy 51c0fab1ce fix: Do not activate pan & zoom on a detached element (#2640)
- Closes: #2633
2026-07-30 21:33:37 -07:00
Dermot Duffy f24064689a fix: Restore keyboard focus for key triggers (#2634) (#2639)
- Closes #2634
2026-07-30 20:52:54 -07:00
Dermot Duffy a736f3dfaf fix: Ensure a bare ptz_digital action resets the zoom (#2635)
- Closes: #2632
2026-07-29 23:18:06 -07:00
Dermot Duffy e9e6d9f833 feat: Use the card's own pan & zoom with the webrtc-card live provider (#2630)
- Closes: #2628
2026-07-29 15:46:03 -07:00
Dermot Duffy 70abb39762 fix: Stop the webrtc-card provider recreating its player on every render (#2629)
- Closes: #2625
2026-07-29 13:11:12 -07:00
Dermot Duffy 15b08db3e8 fix: Clear stale media unavailable errors when a camera recovers (#2627)
- Closes: #2576
2026-07-28 21:21:50 -07:00
Dermot Duffy 231e3087b7 fix: Error when a zoomable element is removed during zoom initialization (#2624)
- Closes: #2410
2026-07-26 20:54:07 -07:00
Dermot Duffy ad89aa9538 test: Split test utilities to improve test times (#2622) 2026-07-26 16:29:53 -07:00
Dermot Duffy 8d44fcecf1 fix: Ignore startup triggers from cameras without the trigger capability (#2621)
- Closes: #2103
2026-07-26 15:37:59 -07:00
Dermot Duffy 0f8593f9fa feat: Answer or reject inbound calls from menu (#2620)
- For: #2587
2026-07-26 14:24:14 -07:00
Dermot Duffy ababe133a8 chore: Switch coverage from istanbul to the v8 provider for speed (#2619) 2026-07-26 14:21:27 -07:00
Dermot Duffy 3b8835ee7c feat: Allow disabling the call controls (#2615)
- For: #2587
2026-07-26 11:35:18 -07:00
Dermot Duffy 0c3d46ad3d chore: Upgrade to Vitest 4 and regroup tests for performance (#2618) 2026-07-26 11:28:58 -07:00
Dermot Duffy 8f953547b1 fix: Connect the microphone when an inbound call is *answered* (#2609) (#2612)
- Closes: #2609
2026-07-25 20:56:07 -07:00
Dermot Duffy 2a84f199de fix: Size the expanded dialog and grid columns to their content (#2611)
- Closes #2607
2026-07-25 13:46:31 -07:00
Dermot Duffy 5f2c7f5e4e fix: Prevent the media grid from collapsing when its cells are unchanged (#2608)
- For: #2306
2026-07-24 18:06:35 -07:00
Dermot Duffy f419798e8e fix: Exponentially back off initialization-error retries (#2579) (#2605)
- Closes #2579
2026-07-24 10:54:31 -07:00
Dermot Duffy 54f75beb9d fix: Improve media_query retry behavior (#2603) 2026-07-23 22:19:17 -07:00
Dermot Duffy 6817d27c91 fix: Guard the ha provider MJPEG stream URL against a missing access_token (#2602)
- Closes: #2601
2026-07-23 09:42:05 -07:00
Dermot Duffy cd53ebd3c8 fix: Correctly bind MJPEG stream URL in the ha live provider (#2305) (#2600)
- Closes: #2305
2026-07-22 22:00:47 -07:00
Dermot Duffy 448fa2d9f1 feat: Surface the provider's error cause in the media_unavailable notification (#2599)
- Closes: #2592
2026-07-22 20:45:49 -07:00
Dermot Duffy 5a549c0326 fix: Prevent microphone auto-disconnect during calls and restore the removed microphone connected condition (#2597)
- Closes: #2590
2026-07-22 16:12:31 -07:00
Dermot Duffy 8c36637092 fix: Only report a live error from the visible ha-camera-stream player (#2596)
- Closes: #2583
2026-07-22 13:45:46 -07:00
Dermot Duffy 7d66c5f005 chore: Replace ts-prune with knip (#2595)
- Closes: #2593
2026-07-22 13:26:34 -07:00
Dermot Duffy 2ca4aa95e5 chore: Replace deprecated 'node' module resolution with 'bundler' and tighten compiler options (#2594) 2026-07-22 12:12:00 -07:00
Dermot Duffy 87ecbc7e45 feat: Trigger automations on call answered, rejected and hung up (#2591) 2026-07-22 11:11:57 -07:00
Dermot Duffy f28b16a4b5 feat: Compress related editor fields into grid rows (#2589) 2026-07-21 22:31:13 -07:00
Dermot Duffy e29c0826cf feat: Add a simple mode to the visual card editor (#2588) 2026-07-21 19:13:29 -07:00
Dermot Duffy b6e1de5999 feat: Modernize the visual card editor. (#2586) 2026-07-20 20:44:16 -07:00
Dermot Duffy e204ec183f fix: Correct status bar alignment in Safari (#2581)
- Closes  #2578
2026-07-15 14:28:47 -07:00
Dermot Duffy c02c692f68 feat: Add experimental rewrite of go2rtc live provider (MSE/WebRTC/MP4/MJPEG) (#2580)
- Closes #2556
- Closes #2450

**Key intended features:**
 - go2rtc compatible
- 100% test coverage to significantly improve ability to test, maintain
and work around browser weirdnesses (e.g. Safari).
 - Written from the ground up in the style of the rest of the project.

**To use:**
 - Change `live_provider` from `go2rtc` to `go2rtc-experimental`.
2026-07-14 14:22:41 -07:00
Dermot Duffy fb1bbc739e feat: Automatically recover from frozen live streams (#2569)
- Closes: #2099
2026-07-07 21:37:24 -07:00
Dermot Duffy 9f956fe89f fix: Match state trigger/condition semantics to HA (#2565)
* Closes #2530
2026-07-04 10:23:51 -07:00
Dermot Duffy 3494706225 fix: Use auto_unmute as input to stream selection for HA (#2562)
- Closes #2479
2026-07-03 08:19:11 -07:00
Dermot Duffy 6a6d65d5c5 fix: Highlight folder icon for correct folder / media (#2560)
- Closes: #2128 
 - Closes: #2129
2026-07-02 10:26:30 -07:00
Dermot Duffy 937ba647a7 fix: Fix audio for cameras with mixed WebRTC/HLS capabilities (#2557)
- Closes #2479
2026-06-30 17:45:13 -07:00
Dermot Duffy 5c97e55a56 fix: Honor configured home preset / merge presets. (#2553)
- Closes:
https://github.com/dermotduffy/advanced-camera-card/issues/2525
2026-06-30 17:45:13 -07:00
Dermot Duffy d833edb65b perf: lazy-load js-yaml (~107KB) as needed (#2551)
- Closes: #2532
2026-06-30 17:45:13 -07:00
Dermot Duffy 3fe5e4004a fix: prevent infinite re-render loop from issue retry callbacks (#2550) 2026-06-30 17:45:13 -07:00
Dermot Duffy ea251ca988 perf(bundle): lazy-load the nunjucks template engine (#2535)
Closes #2531.

## Summary

The full `nunjucks` templating engine (~226KB) plus `ha-nunjucks`
(~46KB) — roughly **272KB, ~13% of the eager entry chunk** — was
statically imported and downloaded by every card on initial load, even
though templates only apply when a config value contains a `{{ … }}` /
`{% … %}` delimiter. Most cards use no templates and never need the
engine.

This defers the engine behind a dynamic `import('ha-nunjucks/dist')` so
it ships in a separate, on-demand chunk instead of the eager
`card-*.js`.

## Approach

The render path (`TemplateRenderer.renderRecursively`) is **kept
synchronous** — it is called from many synchronous hot paths
(condition/trigger evaluators, picture-elements rendering, actions,
folder matchers), and making it async would be a large, high-risk
refactor of the evaluation core.

Instead:

- **New `src/card-controller/templates/engine.ts`** — a module-level
singleton lazy loader (`loadTemplateEngine()` / `getTemplateEngine()`)
shared across all `TemplateRenderer` instances, plus a
`containsTemplate()` delimiter helper.
- **Delimiter gating** — strings without a delimiter never touch the
engine (the overwhelming majority of renders).
- **Pre-warm at config time** — because every template string originates
in the config, a new mandatory `TEMPLATE_ENGINE` initialization aspect
loads the engine before first render whenever the config contains a
delimiter. This **guarantees no raw `{{ … }}` flash**: content/condition
rendering is blocked until the engine is present for template-using
cards. Cards without templates never load it.

## Result

- nunjucks + ha-nunjucks move out of the eager chunk into a separate
chunk fetched only when a card actually uses templates.
- No change to the synchronous public render API; condition/trigger
evaluation core untouched.

## Tests

- New `engine.ts` loader coverage (concurrent load, cached reuse,
not-loaded fallback).
- The 11 existing test files that render real (delimiter-bearing)
templates declare their dependency explicitly via
`beforeAll(loadTemplateEngine)` — no global/implicit setup hook.
- Full suite green (4764 tests), lint and ts-prune clean, per-file 100%
coverage maintained for the affected directories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016ykWemdkZrgywvC71pHc6c

---
_Generated by [Claude
Code](https://claude.ai/code/session_016ykWemdkZrgywvC71pHc6c)_
2026-06-30 17:45:13 -07:00
Paul Botteinanddermotduffy b33c034810 feat: Add card picker suggestion for camera entities (#2517)
Selecting a camera entity in the dashboard card picker now suggests
Advanced Camera Card under the Community section, so you can add it in
one click without searching for it manually.

Requires Home Assistant 2026.6 or later.

Docs:
https://developers.home-assistant.io/docs/frontend/custom-ui/custom-card#suggesting-your-card-for-an-entity

---------

Co-authored-by: dermotduffy <dermot.duffy@gmail.com>
2026-06-30 17:45:13 -07:00
Dermot Duffy 7dc29865b8 chore: Enforce consistent type imports via @typescript-eslint/consistent-type-imports (#2545) 2026-06-30 17:45:13 -07:00
Dermot Duffy a87e5b8eeb chore: Enforce interfaces for object types (#2544) 2026-06-30 17:45:13 -07:00