Move update_entities to view.update_entities

This commit is contained in:
Dermot Duffy
2021-11-28 16:02:56 -08:00
parent 99800ef41b
commit 047afeba29
5 changed files with 15 additions and 16 deletions
+6 -10
View File
@@ -100,12 +100,13 @@ All configuration is under:
view: view:
``` ```
| Option | Default | Description | | Option | Default | Description |
| - | - | - | | - | - | - |
| `default` | `live` | The view to show in the card by default. See [views](#views) below.| | `default` | `live` | The view to show in the card by default. See [views](#views) below.|
| `timeout` | | 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` | | 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` | | Actions to use for all views, individual actions may be overriden by view-specific actions. See [actions](#actions) below.| | `actions` | | Actions to use for all views, individual actions may be overriden by view-specific actions. See [actions](#actions) below.|
| `update_force` | `false` | Whether card updates/refreshes should ignore playing media and human interaction. See [card updates](#card-updates) below for behavior and usecases.|
| `update_entities` | | **YAML only**: A list of entity ids that should cause the whole card to re-render. Entities used in picture elements / included in the menu do not need to be explicitly included here to be kept updated. See [card updates](#card-updates) below for behavior and usecases.|
### Menu Options ### Menu Options
@@ -324,14 +325,6 @@ The card aspect ratio can be changed with the `dimensions.aspect_ratio_mode` and
If no aspect ratio is specified or available, but one is needed then `16:9` will If no aspect ratio is specified or available, but one is needed then `16:9` will
be used by default. be used by default.
<a name="other-options"></a>
### Other Options
| Option | Default | Description |
| - | - | - |
| `update_entities` | | A list of entity ids that should cause the whole card to re-render, this can be useful in the `clip` or `snapshot` mode to (for example) cause a motion sensor to trigger a card refresh. Configurable in YAML only. Entities used in picture elements / included in the menu do not need to be explicitly included here to be kept updated. |
<a name="webrtc"></a> <a name="webrtc"></a>
### Using WebRTC ### Using WebRTC
@@ -797,6 +790,8 @@ menu:
</details> </details>
<a name="card-updates"></a>
## Card Refreshes / Updates ## Card Refreshes / Updates
Automated card refreshes / updates are minimized to avoid disruption to the Automated card refreshes / updates are minimized to avoid disruption to the
@@ -807,7 +802,7 @@ The following table describes the behavior these 3 flags have.
### Card Update Truth Table ### Card Update Truth Table
| `view.timeout` | `view.update_force` | `update_entities` & `camera_entity` | Behavior | | `view.timeout` | `view.update_force` | `view.update_entities` & `camera_entity` | Behavior |
| :-: | :-: | :-: | - | | :-: | :-: | :-: | - |
| Unset or `0` | *(Any value)* | Unset | Card will not automatically re-render. | | Unset or `0` | *(Any value)* | Unset | Card will not automatically re-render. |
| Unset or `0` | `false` | *(Any entity)* | Card will reload **current** view when entity state changes, unless media is playing. | | Unset or `0` | `false` | *(Any entity)* | Card will reload **current** view when entity state changes, unless media is playing. |
@@ -834,6 +829,7 @@ view:
binary_sensor for that camera (or any other entity at your discretion) to binary_sensor for that camera (or any other entity at your discretion) to
trigger the update: trigger the update:
```yaml ```yaml
view:
update_entities: update_entities:
- binary_sensor.office_person_motion - binary_sensor.office_person_motion
``` ```
+1 -1
View File
@@ -503,7 +503,7 @@ export class FrigateCard extends LitElement {
this._frigateCameraName = undefined; this._frigateCameraName = undefined;
this.config = config; this.config = config;
this._entitiesToMonitor = this.config.update_entities || []; this._entitiesToMonitor = this.config.view.update_entities || [];
if (this.config.camera_entity) { if (this.config.camera_entity) {
this._entitiesToMonitor.push(this.config.camera_entity); this._entitiesToMonitor.push(this.config.camera_entity);
} }
+4
View File
@@ -16,6 +16,7 @@ import {
CONF_MENU_MODE, CONF_MENU_MODE,
CONF_VIEW_DEFAULT, CONF_VIEW_DEFAULT,
CONF_VIEW_TIMEOUT, CONF_VIEW_TIMEOUT,
CONF_VIEW_UPDATE_ENTITIES,
} from './const'; } from './const';
import { RawFrigateCardConfig } from './types'; import { RawFrigateCardConfig } from './types';
@@ -170,4 +171,7 @@ const UPGRADES = [
upgradeMoveTo('menu_buttons', 'menu.buttons'), upgradeMoveTo('menu_buttons', 'menu.buttons'),
upgradeMoveTo('menu_button_size', CONF_MENU_BUTTON_SIZE), upgradeMoveTo('menu_button_size', CONF_MENU_BUTTON_SIZE),
upgradeMoveTo('image', CONF_IMAGE_SRC, isNotObject), upgradeMoveTo('image', CONF_IMAGE_SRC, isNotObject),
// v2.0.0 -> v2.1.0
upgradeMoveTo('update_entities', CONF_VIEW_UPDATE_ENTITIES),
]; ];
+1
View File
@@ -12,6 +12,7 @@ export const CONF_FRIGATE_ZONE = 'frigate.zone';
export const CONF_VIEW_DEFAULT = 'view.default'; export const CONF_VIEW_DEFAULT = 'view.default';
export const CONF_VIEW_TIMEOUT = 'view.timeout'; export const CONF_VIEW_TIMEOUT = 'view.timeout';
export const CONF_VIEW_UPDATE_FORCE = 'view.update_force'; export const CONF_VIEW_UPDATE_FORCE = 'view.update_force';
export const CONF_VIEW_UPDATE_ENTITIES = 'view.update_entities';
export const CONF_EVENT_VIEWER_AUTOPLAY_CLIP = 'event_viewer.autoplay_clip'; export const CONF_EVENT_VIEWER_AUTOPLAY_CLIP = 'event_viewer.autoplay_clip';
export const CONF_EVENT_VIEWER_DRAGGABLE = 'event_viewer.draggable'; export const CONF_EVENT_VIEWER_DRAGGABLE = 'event_viewer.draggable';
+1 -3
View File
@@ -342,6 +342,7 @@ const viewConfigSchema = z
.optional() .optional()
.default(viewConfigDefault.timeout), .default(viewConfigDefault.timeout),
update_force: z.boolean().default(viewConfigDefault.update_force), update_force: z.boolean().default(viewConfigDefault.update_force),
update_entities: z.string().array().optional(),
}) })
.merge(actionsSchema) .merge(actionsSchema)
.default(viewConfigDefault); .default(viewConfigDefault);
@@ -570,9 +571,6 @@ export const frigateCardConfigSchema = z.object({
elements: pictureElementsSchema, elements: pictureElementsSchema,
dimensions: dimensionsConfigSchema, dimensions: dimensionsConfigSchema,
// Entities that should trigger a card update.
update_entities: z.string().array().optional(),
// Stock lovelace card config. // Stock lovelace card config.
type: z.string(), type: z.string(),
test_gui: z.boolean().optional(), test_gui: z.boolean().optional(),