Update camera review, sidebar and kiosk dashboard behavior

master
Carlo Costanzo 3 weeks ago
parent e154b4fc2f
commit c02836d852

@ -31,8 +31,8 @@ default_config:
frontend:
themes: !include_dir_merge_named themes
extra_module_url:
- /hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524421
- /local/custom-sidebar-loader.js?v=1.0.0
- /local/community/lovelace-card-mod/card-mod.js?v=190927524421
- /local/custom-sidebar-loader.js?v=1.0.1
# -------------------------------------------------------------------
# Lovelace (YAML dashboards/resources)

@ -15,6 +15,11 @@
frigate_client_id: frigate
cameras: !include /config/dashboards/overview/partials/frigate_camera_names.yaml
review_clips: true
review_zones:
- zone: doorstep
name: Doorstep visits
camera: frontdoorbell
label: person
show_timeline: true
timeline_on_click: true
video: true

@ -8,54 +8,54 @@
# YAML-managed Lovelace resources (resource_mode: yaml).
# -------------------------------------------------------------------
# Notes: Generated from config/.storage/lovelace_resources. Edit here after migration; do not edit .storage.
# Loaded by Home Assistant via `config/lovelace/resources.yaml`.
# Loaded by lovelace.resources in configuration.yaml.
# Ookla resources are declared here because the integration's storage-mode registration
# is incompatible with this dashboard's YAML-managed resources.
# Notes: Keep card-mod's URL identical to frontend.extra_module_url so nested kiosk cards are styled on cold loads.
######################################################################
- type: module
url: /hacsfiles/lovelace-card-tools/card-tools.js?hacstag=16140332811
url: /local/community/lovelace-card-tools/card-tools.js?v=16140332811
- type: module
url: /hacsfiles/lovelace-auto-entities/auto-entities.js?hacstag=1677445841161
url: /local/community/lovelace-auto-entities/auto-entities.js?v=1677445841161
- type: module
url: /hacsfiles/button-card/button-card.js?hacstag=146194325701
url: /local/community/button-card/button-card.js?v=146194325701
- type: module
url: /hacsfiles/frigate-hass-card/frigate-hass-card.js?hacstag=394082552651
url: /local/community/frigate-hass-card/frigate-hass-card.js?v=394082552651
- type: module
url: /hacsfiles/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js?hacstag=193372044232
url: /local/community/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js?v=193372044232
- type: module
url: /hacsfiles/lovelace-mushroom/mushroom.js?hacstag=4443503755010
url: /local/community/lovelace-mushroom/mushroom.js?v=4443503755010
- type: module
url: /hacsfiles/clock-weather-card/clock-weather-card.js?hacstag=522634019296
url: /local/community/clock-weather-card/clock-weather-card.js?v=522634019296
- type: module
url: /hacsfiles/weather-radar-card/weather-radar-card.js?hacstag=487680971372
url: /local/community/weather-radar-card/weather-radar-card.js?v=487680971372
- type: module
url: /hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524421
url: /local/community/lovelace-card-mod/card-mod.js?v=190927524421
- type: module
url: /hacsfiles/Bubble-Card/bubble-card.js?hacstag=680112919311
url: /local/community/Bubble-Card/bubble-card.js?v=680112919311
- type: module
url: /hacsfiles/power-flow-card-plus/power-flow-card-plus.js?hacstag=618081815026
url: /local/community/power-flow-card-plus/power-flow-card-plus.js?v=618081815026
- type: module
url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js?hacstag=1512800620130
url: /local/community/mini-graph-card/mini-graph-card-bundle.js?v=1512800620130
- type: module
url: /hacsfiles/search-card/search-card.js?hacstag=19775918003
url: /local/community/search-card/search-card.js?v=19775918003
- type: module
url: /hacsfiles/apexcharts-card/apexcharts-card.js?hacstag=331701152223
url: /local/community/apexcharts-card/apexcharts-card.js?v=331701152223
- type: module
url: /hacsfiles/pi-hole-card/pi-hole-card.js?hacstag=9776750790250
url: /local/community/pi-hole-card/pi-hole-card.js?v=9776750790250
- type: module
url: /hacsfiles/flex-horseshoe-card/flex-horseshoe-card.js?hacstag=20729272512
url: /local/community/flex-horseshoe-card/flex-horseshoe-card.js?v=20729272512
- type: module
url: /hacsfiles/vertical-stack-in-card/vertical-stack-in-card.js?hacstag=142051833101
url: /local/community/vertical-stack-in-card/vertical-stack-in-card.js?v=142051833101
- type: module
url: /hacsfiles/lovelace-layout-card/layout-card.js?hacstag=156434866247
url: /local/community/lovelace-layout-card/layout-card.js?v=156434866247
- type: module
# One notification model for the Show, Bedroom, and Raven kiosk renderers.
url: /local/kiosk/ambient.js?v=1.2.0
- type: module
# Loads the versioned HACS card with signed timeline media for Clips.
url: /local/frigate-events-navigation.js?v=8
url: /local/frigate-events-navigation.js?v=12
- type: module
url: /local/ookla_speedtest/ookla-speedtest-card.js?v=3.0.5
- type: module

@ -7,7 +7,7 @@
# Related Issue: 1572
# Pins core views, hides low-use panels, and fixes Developer Tools at the bottom.
# -------------------------------------------------------------------
# Served as /local/custom-sidebar-config.yaml; plugin loads via HACS.
# Served as /local/custom-sidebar-config.yaml; Marketplace manages the plugin.
######################################################################
order:
@ -19,6 +19,12 @@ order:
exact: true
icon: mdi:server-network
- new_item: true
item: Marketplace
icon: mdi:store
href: /marketplace
hide: '[[[ !user_is_admin ]]]'
- item: Calendar
exact: true
hide: true

@ -5,5 +5,5 @@ const isAndroidWebView = /\bAndroid\b/i.test(navigator.userAgent)
&& /(?:;|\s)wv\)/i.test(navigator.userAgent);
if (!isAndroidWebView) {
import("/hacsfiles/custom-sidebar/custom-sidebar-plugin.js?v=17.0.0");
import("/local/community/custom-sidebar/custom-sidebar-plugin.js?v=17.0.0");
}

@ -1,5 +1,5 @@
// A paged, labeled review surface around the installed Frigate Events Card.
import "/local/frigate-events-auth.js?v=2";
import "/local/frigate-events-auth.js?v=3";
const Card = customElements.get("frigate-events-card");
const installed = Symbol.for("frigate-events-card.clip-review");
@ -11,7 +11,7 @@ if (Card && !Card.prototype[installed]) {
const states = new WeakMap();
function stateFor(card) {
if (!states.has(card)) states.set(card, { page: 0, cursors: [null], camera: "", request: 0 });
if (!states.has(card)) states.set(card, { page: 0, cursors: [null], camera: "", zone: "", request: 0 });
return states.get(card);
}
@ -20,10 +20,12 @@ if (Card && !Card.prototype[installed]) {
if (!this.hass) return;
const state = stateFor(this);
const cursor = state.cursors[state.page];
const key = JSON.stringify([state.page, state.camera, cursor]);
const key = JSON.stringify([state.page, state.camera, state.zone, cursor]);
if (state.loading && state.key === key) return;
const request = ++state.request;
state.busy = state.key !== key || !this._events?.length;
// A new filter/page must not leave unrelated clips visible on an API error.
if (state.key !== key) this._events = [];
state.key = key;
state.loading = true;
state.error = false;
@ -34,6 +36,12 @@ if (Card && !Card.prototype[installed]) {
const query = { type: "frigate/events/get", instance_id: this._config.frigate_client_id || "frigate",
cameras: state.camera ? [state.camera] : this._config.cameras,
has_clip: true, limit: size + 1 + (cursor?.exclude.length || 0) };
const zone = this._config.review_zones?.find(item => item.zone === state.zone);
if (zone) {
query.cameras = [zone.camera];
query.zones = [zone.zone];
query.labels = [zone.label];
}
if (cursor) query.before = cursor.before;
const response = await this.hass.callWS(query);
if (request !== state.request || !this.isConnected) return;
@ -84,10 +92,28 @@ if (Card && !Card.prototype[installed]) {
}
select.addEventListener("change", () => {
state.camera = select.value;
state.zone = "";
const zoneSelect = toolbar.querySelector('[aria-label="Filter clips by zone"]');
if (zoneSelect) zoneSelect.value = "";
state.page = 0;
state.cursors = [null];
card._loadEvents();
});
if (card._config.review_zones?.length) {
const zoneSelect = document.createElement("select");
zoneSelect.setAttribute("aria-label", "Filter clips by zone");
zoneSelect.add(new Option("All activity", ""));
for (const zone of card._config.review_zones) zoneSelect.add(new Option(zone.name, zone.zone));
zoneSelect.addEventListener("change", () => {
state.zone = zoneSelect.value;
const zone = card._config.review_zones.find(item => item.zone === state.zone);
if (zone) state.camera = select.value = zone.camera;
state.page = 0;
state.cursors = [null];
card._loadEvents();
});
select.after(zoneSelect);
}
toolbar.addEventListener("click", async event => {
const action = event.target.closest("[data-review]")?.dataset.review;
if (!action) return;
@ -164,7 +190,8 @@ if (Card && !Card.prototype[installed]) {
const count = card._events?.length || 0;
toolbar.querySelector(".review-status").textContent = state.busy ? "Loading recorded clips..."
: state.error ? "Could not load clips. Use Latest to retry."
: count ? `Page ${state.page + 1} · ${count} recorded clips · newest first` : "No recorded clips for this camera.";
: count ? `Page ${state.page + 1} · ${count} recorded clips · newest first`
: state.zone ? "No recorded clips in this zone yet." : "No recorded clips for this camera.";
toolbar.querySelector('[data-review="newer"]').disabled = state.busy || state.page === 0;
toolbar.querySelector('[data-review="older"]').disabled = state.busy || !state.more;
toolbar.querySelector('[data-review="latest"]').disabled = state.busy;

@ -2,7 +2,7 @@
// Keep the HACS bundle intact and adapt only this card's timeline media loaders.
// Version the underlying bundle as well as the adapters: an old HACS cache key
// can otherwise load a card release that does not have the timeline API.
import "/hacsfiles/frigate-events-card/frigate-events-card.js?v=2.5.23";
import "/local/community/frigate-events-card/frigate-events-card.js?v=2.5.23";
const Card = customElements.get("frigate-events-card");
const originalLoad = Card?.prototype._loadTimelineVideo;

@ -1,7 +1,7 @@
// Load the shared timeline helpers and keep one Clips player open at a time.
import "/local/frigate-events-auth.js?v=2";
import "/local/frigate-timeline-time.js?v=5";
import "/local/frigate-clip-review.js?v=5";
import "/local/frigate-events-auth.js?v=3";
import "/local/frigate-timeline-time.js?v=6";
import "/local/frigate-clip-review.js?v=9";
// Keep existing bookmarks useful while the visible routes describe each page.
const renamedRoute = {

@ -1,5 +1,5 @@
// Keep one wall-clock selection across cameras, including recording gaps.
import "/local/frigate-events-auth.js?v=2";
import "/local/frigate-events-auth.js?v=3";
const Card = customElements.get("frigate-events-card");
const installed = Symbol.for("frigate-events-card.shared-time");

@ -3,6 +3,8 @@
* Add notification types in build(); keep ES5 syntax for older displays.
* State and actions are data only; renderers decide presentation and interaction.
* Issue #2029: seasonal accents follow the lighting mode, never a second calendar.
* Video: https://youtu.be/qawvBd8_RJ0
* Guide: https://www.vcloudinfo.com/2026/11/home-assistant-holiday-dashboard-theming.html
*/
(function (root) {
'use strict';

Loading…
Cancel
Save

Powered by TurnKey Linux.