Add example to documentation.

This commit is contained in:
Dermot Duffy
2024-04-27 19:56:50 -07:00
parent 7917e5c537
commit b70e3157d6
4 changed files with 50 additions and 3 deletions
+17 -3
View File
@@ -132,9 +132,13 @@ frigate_card_action: change_zoom
| - | - |
| `action` | Must be `custom:frigate-card-action`. |
| `frigate_card_action` | Must be `change_zoom`. |
| `target_id` | The [camera ID](cameras/README.md?id=cameras) to adjust the pan/zoom of, or a media ID (e.g. `frigate` event ID) to zoom in on specific media items. |
| `zoom` | How much to zoom-in. See the [camera zoom parameter](cameras/README.md?id=layout-configuration). |
| `pan` | How much to pan-x/y. See the [camera pan parameter](cameras/README.md?id=layout-configuration). |
| `target_id` | The [camera ID](cameras/README.md?id=cameras) or a media ID (e.g. `frigate` event ID) to change zoom/pam settings for. |
| `zoom` | Optional parameter that controls how much to zoom-in. See the [camera zoom parameter](cameras/README.md?id=layout-configuration). |
| `pan` | Optional parameter that controls how much to pan-x/y. See the [camera pan parameter](cameras/README.md?id=layout-configuration). |
?> If neither `zoom` nor `pan` are specified the camera will return to its default zoom and pan settings.
See [example of automatically zoom/panning based on state](../examples.md?id=automatically-zoom-based-on-state).
### `clip`, `clips`, `image`, `live`, `recording`, `recordings`, `snapshot`, `snapshots`
@@ -536,4 +540,14 @@ elements:
frigate_card_action: ptz
ptz_action: preset
ptz_preset: doorway
- type: custom:frigate-card-menu-icon
icon: mdi:alpha-r-circle
title: Change Zoom
tap_action:
action: custom:frigate-card-action
frigate_card_action: change_zoom
pan:
x: 50
y: 50
zoom: 1
```
+32
View File
@@ -1057,3 +1057,35 @@ overrides:
x: 100
y: 100
```
### Automatically zoom based on state
This example automatically zooms in and out based on the state of an entity:
```yaml
type: custom:frigate-card
cameras:
- camera_entity: camera.living_room
live_provider: go2rtc
debug:
logging: true
automations:
- conditions:
- condition: state
entity: binary_sensor.door_contact
state: 'on'
actions:
- action: custom:frigate-card-action
frigate_card_action: change_zoom
target_id: camera.living_room
zoom: 4
pan:
x: 38
y: 20
actions_not:
- action: custom:frigate-card-action
frigate_card_action: change_zoom
target_id: camera.living_room
```
![](images/zoom-automation.gif 'Zoom automation example :size=400')
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

@@ -190,6 +190,7 @@ export class ConditionsManager {
const config = this._api.getConfigManager().getConfig();
const conditions: FrigateCardCondition[] = [];
config?.overrides?.forEach((override) => conditions.push(...override.conditions));
config?.automations?.forEach((automation) => conditions.push(...automation.conditions));
// Element conditions can be arbitrarily nested underneath conditionals and
// custom elements that this card may not known. Here we recursively parse