Add 'dependent camera' support.

This commit is contained in:
Dermot Duffy
2022-04-23 11:22:04 -07:00
parent 58813c156e
commit fb9d5684ec
11 changed files with 363 additions and 164 deletions
+9 -7
View File
@@ -8,7 +8,7 @@ import {
} from 'lit';
import { HomeAssistant, LovelaceCardEditor, getLovelace } from 'custom-card-helpers';
import { StyleInfo, styleMap } from 'lit/directives/style-map.js';
import { customElement, property, query, state } from 'lit/decorators.js';
import { customElement, property, state } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { createRef, ref, Ref } from 'lit/directives/ref.js';
import screenfull from 'screenfull';
@@ -328,11 +328,12 @@ export class FrigateCard extends LitElement {
const cameraConfig = this._getSelectedCameraConfig();
// Don't show `clips` button if there's no `camera_name` (e.g. non-Frigate
// cameras), or is birdseye.
// cameras), or is birdseye (unless there are dependent cameras).
if (
this._getConfig().menu.buttons.clips &&
cameraConfig?.camera_name &&
cameraConfig?.camera_name !== 'birdseye'
(cameraConfig?.camera_name !== 'birdseye' ||
cameraConfig?.dependent_cameras?.length)
) {
buttons.push({
type: 'custom:frigate-card-menu-icon',
@@ -345,11 +346,12 @@ export class FrigateCard extends LitElement {
}
// Don't show `snapshots` button if there's no `camera_name` (e.g. non-Frigate
// cameras), or is birdseye.
// cameras), or is birdseye (unless there are dependent cameras).
if (
this._getConfig().menu.buttons.snapshots &&
cameraConfig?.camera_name &&
cameraConfig?.camera_name !== 'birdseye'
(cameraConfig?.camera_name !== 'birdseye' ||
cameraConfig?.dependent_cameras?.length)
) {
buttons.push({
type: 'custom:frigate-card-menu-icon',
@@ -1299,7 +1301,7 @@ export class FrigateCard extends LitElement {
? html` <frigate-card-gallery
.hass=${this._hass}
.view=${this._view}
.cameraConfig=${cameraConfig}
.cameras=${this._cameras}
.galleryConfig=${this._getConfig().event_gallery}
>
</frigate-card-gallery>`
@@ -1308,7 +1310,7 @@ export class FrigateCard extends LitElement {
? html` <frigate-card-viewer
.hass=${this._hass}
.view=${this._view}
.cameraConfig=${cameraConfig}
.cameras=${this._cameras}
.viewerConfig=${this._getConfig().event_viewer}
.resolvedMediaCache=${this._resolvedMediaCache}
>