Always switch non-Frigate cameras to live view

This commit is contained in:
Felipe Santos
2022-05-15 15:31:24 -03:00
parent 51875ebda1
commit 110db5ddc3
+11 -8
View File
@@ -5,7 +5,7 @@ import {
LitElement, LitElement,
PropertyValues, PropertyValues,
TemplateResult, TemplateResult,
unsafeCSS unsafeCSS,
} from 'lit'; } from 'lit';
import { customElement, property, state } from 'lit/decorators.js'; import { customElement, property, state } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js'; import { classMap } from 'lit/directives/class-map.js';
@@ -20,7 +20,7 @@ import {
ConditionState, ConditionState,
conditionStateRequestHandler, conditionStateRequestHandler,
getOverriddenConfig, getOverriddenConfig,
getOverridesByKey getOverridesByKey,
} from './card-condition.js'; } from './card-condition.js';
import './components/elements.js'; import './components/elements.js';
import { FrigateCardElements } from './components/elements.js'; import { FrigateCardElements } from './components/elements.js';
@@ -40,7 +40,7 @@ import {
CAMERA_BIRDSEYE, CAMERA_BIRDSEYE,
CARD_VERSION, CARD_VERSION,
MEDIA_PLAYER_SUPPORT_BROWSE_MEDIA, MEDIA_PLAYER_SUPPORT_BROWSE_MEDIA,
REPO_URL REPO_URL,
} from './const.js'; } from './const.js';
import './editor.js'; import './editor.js';
import { localize } from './localize/localize.js'; import { localize } from './localize/localize.js';
@@ -54,7 +54,7 @@ import type {
FrigateCardConfig, FrigateCardConfig,
MediaShowInfo, MediaShowInfo,
MenuButton, MenuButton,
Message Message,
} from './types.js'; } from './types.js';
import { import {
Actions, Actions,
@@ -65,14 +65,14 @@ import {
FrigateCardCustomAction, FrigateCardCustomAction,
FrigateCardView, FrigateCardView,
FRIGATE_CARD_VIEWS_USER_SPECIFIED, FRIGATE_CARD_VIEWS_USER_SPECIFIED,
RawFrigateCardConfig RawFrigateCardConfig,
} from './types.js'; } from './types.js';
import { import {
convertActionToFrigateCardCustomAction, convertActionToFrigateCardCustomAction,
createFrigateCardCustomAction, createFrigateCardCustomAction,
frigateCardHandleAction, frigateCardHandleAction,
frigateCardHasAction, frigateCardHasAction,
getActionConfigGivenAction getActionConfigGivenAction,
} from './utils/action.js'; } from './utils/action.js';
import { contentsChanged } from './utils/basic.js'; import { contentsChanged } from './utils/basic.js';
import { getCameraIcon, getCameraID, getCameraTitle } from './utils/camera.js'; import { getCameraIcon, getCameraID, getCameraTitle } from './utils/camera.js';
@@ -82,7 +82,7 @@ import {
homeAssistantSignPath, homeAssistantSignPath,
homeAssistantWSRequest, homeAssistantWSRequest,
shouldUpdateBasedOnHass, shouldUpdateBasedOnHass,
sideLoadHomeAssistantElements sideLoadHomeAssistantElements,
} from './utils/ha'; } from './utils/ha';
import { getEventID } from './utils/ha/browse-media.js'; import { getEventID } from './utils/ha/browse-media.js';
import { supportsFeature } from './utils/ha/update.js'; import { supportsFeature } from './utils/ha/update.js';
@@ -1081,7 +1081,10 @@ export class FrigateCard extends LitElement {
view: new View({ view: new View({
view: view:
this._getConfig().view.camera_select === 'current' this._getConfig().view.camera_select === 'current'
? this._view.view ? // Always go to live view when switching to a non-Frigate camera
this._cameras?.get(camera)?.camera_name
? this._view.view
: 'live'
: (this._getConfig().view.camera_select as FrigateCardView), : (this._getConfig().view.camera_select as FrigateCardView),
camera: camera, camera: camera,
}), }),