Add more-info for motion entity.
This commit is contained in:
+8
-9
@@ -20,6 +20,7 @@ import { until } from 'lit-html/directives/until.js';
|
|||||||
import {
|
import {
|
||||||
HomeAssistant,
|
HomeAssistant,
|
||||||
ActionHandlerEvent,
|
ActionHandlerEvent,
|
||||||
|
fireEvent,
|
||||||
handleAction,
|
handleAction,
|
||||||
LovelaceCardEditor,
|
LovelaceCardEditor,
|
||||||
getLovelace,
|
getLovelace,
|
||||||
@@ -423,11 +424,12 @@ export class FrigateCard extends LitElement {
|
|||||||
|
|
||||||
// Render the status bar (motion icon).
|
// Render the status bar (motion icon).
|
||||||
protected _renderStatusBar(): TemplateResult {
|
protected _renderStatusBar(): TemplateResult {
|
||||||
if (!this.config.motion_entity || !(this.config.motion_entity in this.hass.states)) {
|
const motionEntity = this.config.motion_entity
|
||||||
|
if (!motionEntity || !(motionEntity in this.hass.states)) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
const icon = this.hass.states[this.config.motion_entity].state == "on" ?
|
const icon = this.hass.states[motionEntity].state == "on" ?
|
||||||
"mdi:motion-sensor" : "mdi:walk"
|
"mdi:motion-sensor" : "mdi:walk";
|
||||||
return html`
|
return html`
|
||||||
<div class="frigate-card-statusbar ${
|
<div class="frigate-card-statusbar ${
|
||||||
this._viewMode == FrigateCardView.LIVE ? 'visible' : 'invisible'}
|
this._viewMode == FrigateCardView.LIVE ? 'visible' : 'invisible'}
|
||||||
@@ -436,6 +438,9 @@ export class FrigateCard extends LitElement {
|
|||||||
data-toggle="tooltip" title="View motion sensor"
|
data-toggle="tooltip" title="View motion sensor"
|
||||||
class="button"
|
class="button"
|
||||||
icon="${icon}"
|
icon="${icon}"
|
||||||
|
@click=${() => {
|
||||||
|
fireEvent(this, "hass-more-info", {entityId: motionEntity});
|
||||||
|
}}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
</div>`
|
</div>`
|
||||||
}
|
}
|
||||||
@@ -509,12 +514,6 @@ export class FrigateCard extends LitElement {
|
|||||||
</ha-card>`;
|
</ha-card>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private _handleAction(ev: ActionHandlerEvent): void {
|
|
||||||
// if (this.hass && this.config && ev.detail.action) {
|
|
||||||
// handleAction(this, this.hass, this.config, ev.detail.action);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Show a warning card.
|
// Show a warning card.
|
||||||
private _showWarning(warning: string): TemplateResult {
|
private _showWarning(warning: string): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
|
|||||||
Reference in New Issue
Block a user