diff --git a/images/picture_elements_temperature.png b/images/picture_elements_temperature.png
new file mode 100644
index 00000000..8b4f3370
Binary files /dev/null and b/images/picture_elements_temperature.png differ
diff --git a/src/card.ts b/src/card.ts
index 96acfc09..29d2ba04 100644
--- a/src/card.ts
+++ b/src/card.ts
@@ -16,11 +16,10 @@ import {
LovelaceCardEditor,
getLovelace,
handleAction,
- ActionHandlerEvent,
} from 'custom-card-helpers';
import screenfull from 'screenfull';
-import { entitySchema, frigateCardConfigSchema } from './types';
+import { entitySchema, frigateCardConfigSchema, Message } from './types';
import type {
BrowseMediaQueryParameters,
Entity,
@@ -33,16 +32,16 @@ import type {
import { CARD_VERSION } from './const';
import { FrigateCardMenu, MENU_HEIGHT } from './components/menu';
import { View } from './view';
-import { actionHandler } from './action-handler-directive';
import {
getParseErrorKeys,
homeAssistantWSRequest,
shouldUpdateBasedOnHass,
} from './common';
import { localize } from './localize/localize';
-import { renderErrorMessage, renderProgressIndicator } from './components/message';
+import { renderMessage, renderProgressIndicator } from './components/message';
import './editor';
+import './components/elements';
import './components/gallery';
import './components/live';
import './components/menu';
@@ -52,6 +51,7 @@ import './patches/ha-camera-stream';
import './patches/ha-hls-player';
import cardStyle from './scss/card.scss';
+import { FrigateCardElements } from './components/elements';
const MEDIA_HEIGHT_CUTOFF = 50;
const MEDIA_WIDTH_CUTOFF = MEDIA_HEIGHT_CUTOFF;
@@ -105,6 +105,9 @@ export class FrigateCard extends LitElement {
@query('frigate-card-menu')
_menu!: FrigateCardMenu;
+ @query('frigate-card-elements')
+ _elements!: FrigateCardElements;
+
// Whether or not media is actively playing (live or clip).
protected _mediaPlaying = false;
@@ -119,14 +122,22 @@ export class FrigateCard extends LitElement {
// derived).
protected _frigateCameraName: string | null = null;
+ // Error/info message to render.
+ protected _message: Message | null = null;
+
set hass(hass: HomeAssistant & ExtendedHomeAssistant) {
this._hass = hass;
- // Manually set hass in the menu. This is to allow the menu to update,
- // without necessarily re-rendering the entire card (re-rendering interrupts
- // clip playing).
- if (this._menu && this._hass) {
- this._menu.hass = this._hass;
+ // Manually set hass in the menu & elements. This is to allow these to
+ // update, without necessarily re-rendering the entire card (re-rendering
+ // interrupts clip playing).
+ if (this._hass) {
+ if (this._menu) {
+ this._menu.hass = this._hass;
+ }
+ if (this._elements) {
+ this._elements.hass = this._hass;
+ }
}
}
@@ -197,7 +208,7 @@ export class FrigateCard extends LitElement {
const elements = this.config.elements || [];
for (let i = 0; this._hass && i < elements.length; i++) {
const element = elements[i];
- if (['menu-icon', 'menu-state-icon'].includes(element.type)) {
+ if (element.type == 'menu-icon' || element.type == 'menu-state-icon') {
buttons.push(element);
}
}
@@ -404,6 +415,27 @@ export class FrigateCard extends LitElement {
this._mediaPlaying = false;
}
+ protected _setMessageAndUpdate(message: Message): void {
+ // Only register the first message.
+ if (!this._message) {
+ this._message = message;
+ this.requestUpdate();
+ }
+ }
+
+ protected _messageHandler(e: CustomEvent