First skeleton of scan mode.

This commit is contained in:
Dermot Duffy
2022-05-18 21:24:17 -07:00
parent a4a7c0d738
commit ab3202c9ac
6 changed files with 228 additions and 37 deletions
+8 -8
View File
@@ -1,11 +1,11 @@
import { HomeAssistant } from 'custom-card-helpers';
import {
CSSResultGroup,
html,
LitElement,
PropertyValues,
TemplateResult,
unsafeCSS
CSSResultGroup,
html,
LitElement,
PropertyValues,
TemplateResult,
unsafeCSS
} from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { createRef, ref, Ref } from 'lit/directives/ref.js';
@@ -14,7 +14,7 @@ import defaultImage from '../images/frigate-bird-in-sky.jpg';
import { localize } from '../localize/localize.js';
import imageStyle from '../scss/image.scss';
import { CameraConfig, ImageViewConfig } from '../types.js';
import { shouldUpdateBasedOnHass } from '../utils/ha';
import { isHassDifferent } from '../utils/ha';
import { dispatchMediaShowEvent } from '../utils/media-info.js';
import { View } from '../view.js';
import { dispatchErrorMessageEvent } from './message.js';
@@ -96,7 +96,7 @@ export class FrigateCardImage extends LitElement {
this._imageConfig?.mode === 'camera' &&
cameraEntity
) {
if (shouldUpdateBasedOnHass(this.hass, changedProps.get('hass'), [cameraEntity])) {
if (isHassDifferent(this.hass, changedProps.get('hass'), [cameraEntity])) {
// If the state of the camera entity has changed, remove the cached
// value (will be re-calculated in willUpdate). This is important to
// ensure a changed access token is immediately used.
+10 -10
View File
@@ -1,12 +1,12 @@
import type { Corner } from '@material/mwc-menu';
import { HomeAssistant } from 'custom-card-helpers';
import {
CSSResultGroup,
html,
LitElement,
PropertyValues,
TemplateResult,
unsafeCSS
CSSResultGroup,
html,
LitElement,
PropertyValues,
TemplateResult,
unsafeCSS
} from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
@@ -15,10 +15,10 @@ import { actionHandler } from '../action-handler-directive.js';
import submenuStyle from '../scss/submenu.scss';
import { MenuSubmenu, MenuSubmenuItem, MenuSubmenuSelect } from '../types.js';
import {
frigateCardHasAction,
stopEventFromActivatingCardWideActions
frigateCardHasAction,
stopEventFromActivatingCardWideActions
} from '../utils/action.js';
import { refreshDynamicStateParameters, shouldUpdateBasedOnHass } from '../utils/ha';
import { isHassDifferent, refreshDynamicStateParameters } from '../utils/ha';
import { domainIcon } from '../utils/icons/domain-icon.js';
@customElement('frigate-card-submenu')
@@ -139,7 +139,7 @@ export class FrigateCardSubmenuSelect extends LitElement {
changedProps.size != 1 ||
!this.submenuSelect ||
(!!oldHass &&
shouldUpdateBasedOnHass(this.hass, oldHass, [this.submenuSelect.entity]))
isHassDifferent(this.hass, oldHass, [this.submenuSelect.entity]))
);
}