Files
advanced-camera-card/docs/usage/url-actions.md
T

91 lines
8.9 KiB
Markdown

# URL Actions
It is possible to pass the Advanced Camera Card one or more
[actions](../configuration/actions/README.md) from the URL (e.g. select a particular
camera, open the live view in expanded mode, etc).
## When actions are executed
The Advanced Camera Card will execute these actions in the following circumstances:
- On initial card load.
- On 'tab' change in a dashboard.
- When a `navigate` [action](https://www.home-assistant.io/dashboards/actions/)
is called on the dashboard (e.g. a button click requests navigation).
- When the user uses the `back` / `forward` browser buttons while viewing a
dashboard.
## Instructions
To send an action to _all_ Advanced Camera Cards on a dashboard:
```text
[PATH_TO_YOUR_HA_DASHBOARD]?advanced-camera-card-action.[ACTION]=[VALUE]
```
To send an action to a specific named Advanced Camera Card:
```text
[PATH_TO_YOUR_HA_DASHBOARD]?advanced-camera-card-action.[CARD_ID].[ACTION]=[VALUE]
```
> [!NOTE]
> For backwards compatibility, the card will also respond to `frigate-card-action` as a query-parameter with the same syntax.
| Parameter | Description |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ACTION` | One of the supported Advanced Camera Card custom actions. See [Supported Actions](#supported-actions). |
| `CARD_ID` | When specified only cards that have a [`card_id`](../configuration/README.md) parameter will act. |
| `VALUE` | A value for actions that accept one: required by `camera_select`; optional for `substream_on` (interpreted as the `stream` to engage; omit to cycle). |
> [!TIP]
> Both `.` and `:` may be used as the delimiter. If you use `:` some
> browsers may require it be escaped to `%3A`.
> [!NOTE]
> If a dashboard has multiple Advanced Camera Cards on it, even if they are on
> different 'tabs' within that dashboard, they will all respond to the actions
> unless the action is targeted with a `CARD_ID` as shown [above](#instructions).
## Supported Actions
Only a subset of all [actions](../configuration/actions/README.md) are supported in URL form.
| Action | Supported in URL | Explanation |
| -------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `camera_select` | :white_check_mark: | |
| `camera_ui` | :white_check_mark: | |
| `clip` | :white_check_mark: | |
| `clips` | :white_check_mark: | |
| `default` | :white_check_mark: | |
| `diagnostics` | :white_check_mark: | |
| `download` | :heavy_multiplication_x: | Latest media information is not available on initial render. |
| `expand` | :white_check_mark: | |
| `folder` | :white_check_mark: | |
| `folders` | :white_check_mark: | |
| `fullscreen` | :heavy_multiplication_x: | Javascript does not support activating fullscreen without direct human interaction. Use `expand` as an alternative. |
| `gallery` | :white_check_mark: | |
| `image` | :white_check_mark: | |
| `live` | :white_check_mark: | |
| `media` | :white_check_mark: | |
| `media_player` | :heavy_multiplication_x: | Please [request](https://github.com/dermotduffy/advanced-camera-card/issues) if you need this. |
| `menu_toggle` | :white_check_mark: | |
| `microphone_mute`, `microphone_unmute` | :heavy_multiplication_x: | |
| `mute`, `unmute` | :heavy_multiplication_x: | |
| `play`, `pause` | :heavy_multiplication_x: | |
| `ptz` | :heavy_multiplication_x: | Please [request](https://github.com/dermotduffy/advanced-camera-card/issues) if you need this. |
| `recording` | :white_check_mark: | |
| `recordings` | :white_check_mark: | |
| `review` | :white_check_mark: | |
| `reviews` | :white_check_mark: | |
| `screenshot` | :heavy_multiplication_x: | Latest media information is not available on initial render. |
| `ptz_controls` | :heavy_multiplication_x: | Please [request](https://github.com/dermotduffy/advanced-camera-card/issues) if you need this. |
| `snapshot` | :white_check_mark: | |
| `snapshots` | :white_check_mark: | |
| `substream_off` | :white_check_mark: | The `camera` field is not exposed via URL; the selected camera is used. Use the action config directly to target another camera. |
| `substream_on` | :white_check_mark: | Pass the substream camera ID as the URL value to engage it directly; omit the value to cycle. |
## Examples
See [URL actions examples](../examples.md?id=url-actions).