Rename view.timeout to view.timeout_seconds .
This commit is contained in:
@@ -135,7 +135,7 @@ view:
|
||||
| Option | Default | Overridable | Description |
|
||||
| - | - | - | - |
|
||||
| `default` | `live` | :heavy_multiplication_x: | The view to show in the card by default. See [views](#views) below.|
|
||||
| `timeout` | | :heavy_multiplication_x: | A numbers of seconds of inactivity after which the card will reset to the default configured view. Inactivity is defined as lack of interaction with the Frigate menu.|
|
||||
| `timeout_seconds` | | :heavy_multiplication_x: | A numbers of seconds of inactivity after which the card will reset to the default configured view. Inactivity is defined as lack of interaction with the Frigate menu.|
|
||||
| `actions` | | :heavy_multiplication_x: | Actions to use for all views, individual actions may be overriden by view-specific actions. See [actions](#actions) below.|
|
||||
| `update_force` | `false` | :heavy_multiplication_x: | Whether card updates/refreshes should ignore playing media and human interaction. See [card updates](#card-updates) below for behavior and usecases.|
|
||||
| `update_entities` | | :heavy_multiplication_x: | **YAML only**: A list of entity ids that should cause the view to reset to the default. See [card updates](#card-updates) below for behavior and usecases.|
|
||||
@@ -572,7 +572,7 @@ This card supports several different views:
|
||||
|`snapshot`|Shows an event viewer for the most recent snapshot for this camera/zone/label. Can also be accessed by holding down the `snapshots` menu icon.|
|
||||
|`clips`|Shows an event gallery of clips for this camera/zone/label.|
|
||||
|`clip`|Shows an event viewer for the most recent clip for this camera/zone/label. Can also be accessed by holding down the `clips` menu icon.|
|
||||
|`image`|Shows a static image specified by the `image` parameter, can be used as a discrete default view or a screensaver (via `view_timeout`).|
|
||||
|`image`|Shows a static image specified by the `image` parameter, can be used as a discrete default view or a screensaver (via `view.timeout_seconds`).|
|
||||
|
||||
### Navigating From A Snapshot To A Clip
|
||||
|
||||
@@ -1105,7 +1105,7 @@ The following table describes the behavior these 3 flags have.
|
||||
|
||||
### Card Update Truth Table
|
||||
|
||||
| `view.timeout` | `view.update_force` | `view.update_entities` | Behavior |
|
||||
| `view.timeout_seconds` | `view.update_force` | `view.update_entities` | Behavior |
|
||||
| :-: | :-: | :-: | - |
|
||||
| Unset or `0` | *(Any value)* | Unset | Card will not automatically refresh. |
|
||||
| Unset or `0` | `false` | *(Any entity)* | Card will reload default view when entity state changes, unless media is playing. |
|
||||
@@ -1121,7 +1121,7 @@ The following table describes the behavior these 3 flags have.
|
||||
```yaml
|
||||
view:
|
||||
default: live
|
||||
timeout: 30
|
||||
timeout_seconds: 30
|
||||
force: true
|
||||
```
|
||||
* Using `clip` or `snapshot` as the default view (for the most recent clip or
|
||||
|
||||
@@ -26,9 +26,9 @@ export class CachedValueController<T> implements ReactiveController {
|
||||
protected _timerID?: number;
|
||||
|
||||
constructor(host: ReactiveControllerHost, timerSeconds: number, callback: () => T) {
|
||||
(this._host = host).addController(this);
|
||||
this._timerSeconds = timerSeconds;
|
||||
this._callback = callback;
|
||||
(this._host = host).addController(this);
|
||||
}
|
||||
|
||||
public removeController(): void {
|
||||
|
||||
+13
-3
@@ -20,7 +20,7 @@ import {
|
||||
CONF_MENU_MODE,
|
||||
CONF_OVERRIDES,
|
||||
CONF_VIEW_DEFAULT,
|
||||
CONF_VIEW_TIMEOUT,
|
||||
CONF_VIEW_TIMEOUT_SECONDS,
|
||||
CONF_VIEW_UPDATE_ENTITIES,
|
||||
} from './const';
|
||||
import { RawFrigateCardConfig, RawFrigateCardConfigArray } from './types';
|
||||
@@ -129,13 +129,22 @@ export const copyConfig = function (obj: RawFrigateCardConfig): RawFrigateCardCo
|
||||
|
||||
/**
|
||||
* Determines if a property is not an object.
|
||||
* @param value The property.
|
||||
* @param value The value.
|
||||
* @returns `true` is the value is not an object.
|
||||
*/
|
||||
const isNotObject = function (value: unknown) {
|
||||
return typeof value !== 'object' ? value : undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts to a number or return undefined.
|
||||
* @param value The value.
|
||||
* @returns A number or undefined.
|
||||
*/
|
||||
const toNumberOrIgnore = function (value: unknown) {
|
||||
return isNaN(value as number) ? undefined : Number(value)
|
||||
};
|
||||
|
||||
/**
|
||||
* Move a property from one location to another.
|
||||
* @param obj The configuration object in which the property resides.
|
||||
@@ -265,7 +274,7 @@ const UPGRADES = [
|
||||
upgradeMoveTo('label', 'frigate.label'),
|
||||
upgradeMoveTo('zone', 'frigate.zone'),
|
||||
upgradeMoveTo('view_default', CONF_VIEW_DEFAULT),
|
||||
upgradeMoveTo('view_timeout', CONF_VIEW_TIMEOUT),
|
||||
upgradeMoveTo('view_timeout', 'view.timeout'),
|
||||
upgradeMoveTo('live_provider', 'live.provider'),
|
||||
upgradeMoveTo('live_preload', CONF_LIVE_PRELOAD),
|
||||
upgradeMoveTo('webrtc', 'live.webrtc'),
|
||||
@@ -283,4 +292,5 @@ const UPGRADES = [
|
||||
// v2.1.0 -> v3.0.0
|
||||
upgradeToMultipleCameras(),
|
||||
updateMenuConditionToMenuOverride(),
|
||||
upgradeMoveTo('view.timeout', CONF_VIEW_TIMEOUT_SECONDS, toNumberOrIgnore),
|
||||
];
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export const CONF_CAMERAS_ARRAY_LIVE_PROVIDER = `${CONF_CAMERAS}.#.live_provider
|
||||
|
||||
export const CONF_VIEW = 'view' as const;
|
||||
export const CONF_VIEW_DEFAULT = `${CONF_VIEW}.default` as const;
|
||||
export const CONF_VIEW_TIMEOUT = `${CONF_VIEW}.timeout` as const;
|
||||
export const CONF_VIEW_TIMEOUT_SECONDS = `${CONF_VIEW}.timeout_seconds` as const;
|
||||
export const CONF_VIEW_UPDATE_FORCE = `${CONF_VIEW}.update_force` as const;
|
||||
export const CONF_VIEW_UPDATE_ENTITIES = `${CONF_VIEW}.update_entities` as const;
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ import {
|
||||
CONF_MENU_BUTTON_SIZE,
|
||||
CONF_MENU_MODE,
|
||||
CONF_VIEW_DEFAULT,
|
||||
CONF_VIEW_TIMEOUT,
|
||||
CONF_VIEW_TIMEOUT_SECONDS,
|
||||
CONF_VIEW_UPDATE_FORCE,
|
||||
} from './const.js';
|
||||
import { arrayMove, getEntityTitle, prettifyFrigateName } from './common.js';
|
||||
@@ -657,7 +657,7 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
||||
? html`
|
||||
<div class="values">
|
||||
${this._renderDropdown(CONF_VIEW_DEFAULT, viewModes)}
|
||||
${this._renderStringInput(CONF_VIEW_TIMEOUT, 'number')}
|
||||
${this._renderStringInput(CONF_VIEW_TIMEOUT_SECONDS, 'number')}
|
||||
${this._renderSwitch(CONF_VIEW_UPDATE_FORCE, defaults.view.update_force)}
|
||||
</div>
|
||||
`
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"snapshots": "Snapshots gallery",
|
||||
"image": "Static image"
|
||||
},
|
||||
"timeout": "View timeout secs (before returning to default, 0=never)",
|
||||
"timeout_seconds": "View timeout seconds (before returning to default, 0=never)",
|
||||
"update_force": "Force card updates (ignore media playing / interaction)"
|
||||
},
|
||||
"event_gallery": {
|
||||
@@ -99,7 +99,7 @@
|
||||
},
|
||||
"image": {
|
||||
"src": "Static image URL/data for image view",
|
||||
"refresh_seconds": "Number of seconds after which to refresh"
|
||||
"refresh_seconds": "Number of seconds after which to refresh (0=never)"
|
||||
},
|
||||
"menu": {
|
||||
"buttons": {
|
||||
|
||||
+1
-10
@@ -371,16 +371,7 @@ const viewConfigSchema = z
|
||||
.enum(FRIGATE_CARD_VIEWS_USER_SPECIFIED)
|
||||
.optional()
|
||||
.default(viewConfigDefault.default),
|
||||
timeout: z
|
||||
.number()
|
||||
.or(
|
||||
z
|
||||
.string()
|
||||
.regex(/^\d+$/)
|
||||
.transform((val) => Number(val)),
|
||||
)
|
||||
.optional()
|
||||
.default(viewConfigDefault.timeout),
|
||||
timeout_seconds: z.number().default(viewConfigDefault.timeout),
|
||||
update_force: z.boolean().default(viewConfigDefault.update_force),
|
||||
update_entities: z.string().array().optional(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user