refactor: Unify substream actions into substream_{on,off} (#2497)

## Summary

- Collapse `live_substream_{on,off,select}` into a unified
`substream_{on,off}` pair, symmetric with `call_{start,end}`.
- Rename the `camera` field on the former `live_substream_select` to
`stream` (it always was a stream ID).
- Add optional `camera` field to both new actions for targeting a
non-selected base camera.
- YAML configs are migrated automatically; URL bookmarks must be updated
by hand.

## Migration

### Cycling between camera and substream (toggle button)

Before:
```yaml
tap_action:
  action: custom:advanced-camera-card-action
  advanced_camera_card_action: live_substream_on
```

After:
```yaml
tap_action:
  action: custom:advanced-camera-card-action
  advanced_camera_card_action: substream_on
```

### Selecting a specific substream

Before:
```yaml
tap_action:
  action: custom:advanced-camera-card-action
  advanced_camera_card_action: live_substream_select
  camera: camera.front_door_hd
```

After:
```yaml
tap_action:
  action: custom:advanced-camera-card-action
  advanced_camera_card_action: substream_on
  stream: camera.front_door_hd
```

### Turning the substream off

Before:
```yaml
tap_action:
  action: custom:advanced-camera-card-action
  advanced_camera_card_action: live_substream_off
```

After:
```yaml
tap_action:
  action: custom:advanced-camera-card-action
  advanced_camera_card_action: substream_off
```

### URL querystrings (manual update required)

| Before | After |
| --- | --- |
|
`?advanced-camera-card-action.live_substream_select=camera.front_door_hd`
| `?advanced-camera-card-action.substream_on=camera.front_door_hd` |
This commit is contained in:
Dermot Duffy
2026-06-30 17:45:13 -07:00
committed by dermotduffy
parent 15e335a647
commit f18e4cd4b8
32 changed files with 878 additions and 386 deletions
+42 -49
View File
@@ -228,50 +228,6 @@ action: custom:advanced-camera-card-action
advanced_camera_card_action: live
```
## `live_substream_off`
Turn off the substream (if on).
```yaml
action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_off
```
| Parameter | Description |
| ----------------------------- | --------------------------------------------- |
| `action` | Must be `custom:advanced-camera-card-action`. |
| `advanced_camera_card_action` | Must be `live_substream_off`. |
## `live_substream_on`
Turn on the first available substream. Use [Camera dependency configuration](../../cameras/README.md?id=dependencies) to configure substreams.
```yaml
action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_on
```
| Parameter | Description |
| ----------------------------- | --------------------------------------------- |
| `action` | Must be `custom:advanced-camera-card-action`. |
| `advanced_camera_card_action` | Must be `live_substream_on`. |
## `live_substream_select`
Select a substream. Use [Camera dependency configuration](../../cameras/README.md?id=dependencies) to configure substreams.
```yaml
action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_select
# [...]
```
| Parameter | Description |
| ----------------------------- | ------------------------------------------------------------------------------- |
| `action` | Must be `custom:advanced-camera-card-action`. |
| `advanced_camera_card_action` | Must be `live_substream_select`. |
| `camera` | The [camera ID](../../cameras/README.md?id=cameras) of the substream to select. |
## `media`
Change to the `media` view.
@@ -687,6 +643,43 @@ advanced_camera_card_action: status_bar
The items parameter is a list of items to `add` or `remove`. See [`custom:advanced-camera-card-status-bar-icon`](../../elements/custom/README.md?id=status-bar-icon), [`custom:advanced-camera-card-status-bar-image`](../../elements/custom/README.md?id=status-bar-image), [`custom:advanced-camera-card-status-bar-string`](../../elements/custom/README.md?id=status-bar-string) for the allowable items and their parameters. See the [fully expanded reference](./README.md?fully-expanded-reference) below for a complete example.
## `substream_off`
Turn off a camera's substream.
```yaml
action: custom:advanced-camera-card-action
advanced_camera_card_action: substream_off
# [...]
```
| Parameter | Description |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `action` | Must be `custom:advanced-camera-card-action`. |
| `advanced_camera_card_action` | Must be `substream_off`. |
| `camera` | An optional [camera ID](../../cameras/README.md?id=cameras) whose substream override to clear. If omitted, the selected camera is used. |
## `substream_on`
Turn on a substream. Use [Camera dependency
configuration](../../cameras/README.md?id=dependencies) to configure substreams.
When `stream` is set, the action engages that named stream. When omitted, each
call advances through the camera's `substream` dependencies in order, wrapping
back to the camera itself (no substream engaged).
```yaml
action: custom:advanced-camera-card-action
advanced_camera_card_action: substream_on
# [...]
```
| Parameter | Description |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action` | Must be `custom:advanced-camera-card-action`. |
| `advanced_camera_card_action` | Must be `substream_on`. |
| `camera` | An optional [camera ID](../../cameras/README.md?id=cameras) whose substream to engage. If omitted, the selected camera is used. |
| `stream` | An optional [camera ID](../../cameras/README.md?id=cameras) of a `substream` [dependency](../../cameras/README.md?id=dependencies) of `camera`. If omitted, the next stream in `camera`'s cycle is engaged. |
## `timeline`
Change to the `timeline` view.
@@ -865,20 +858,20 @@ elements:
title: Turn off substream
tap_action:
action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_off
advanced_camera_card_action: substream_off
- type: custom:advanced-camera-card-menu-icon
icon: mdi:alpha-o-circle
title: Turn on substream
title: Cycle substream
tap_action:
action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_on
advanced_camera_card_action: substream_on
- type: custom:advanced-camera-card-menu-icon
icon: mdi:alpha-n-circle
title: Select HD substream
tap_action:
action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_select
camera: camera.front_door_hd
advanced_camera_card_action: substream_on
stream: camera.front_door_hd
- type: custom:advanced-camera-card-menu-icon
icon: mdi:alpha-o-circle
title: Log to console
+2 -2
View File
@@ -32,8 +32,8 @@ automations:
fullscreen: true
actions:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_on
advanced_camera_card_action: substream_on
actions_not:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_off
advanced_camera_card_action: substream_off
```
+6 -6
View File
@@ -77,10 +77,10 @@ automations:
fullscreen: true
actions:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_on
advanced_camera_card_action: substream_on
actions_not:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_off
advanced_camera_card_action: substream_off
```
### Fullscreen with display mode and substream switching
@@ -117,7 +117,7 @@ elements:
advanced_camera_card_action: display_mode_select
display_mode: single
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_on
advanced_camera_card_action: substream_on
- action: custom:advanced-camera-card-action
advanced_camera_card_action: fullscreen
automations:
@@ -126,7 +126,7 @@ automations:
fullscreen: false
actions:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_off
advanced_camera_card_action: substream_off
- action: custom:advanced-camera-card-action
advanced_camera_card_action: display_mode_select
display_mode: grid
@@ -637,10 +637,10 @@ cameras:
automations:
- actions:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_on
advanced_camera_card_action: substream_on
actions_not:
- action: custom:advanced-camera-card-action
advanced_camera_card_action: live_substream_off
advanced_camera_card_action: substream_off
conditions:
- condition: interaction
interaction: true
+38 -37
View File
@@ -32,11 +32,11 @@ To send an action to a specific named Advanced Camera Card:
> [!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` | An optional value to use with the `camera_select` and `live_substream_select` actions. |
| 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
@@ -51,38 +51,39 @@ To send an action to a specific named Advanced Camera Card:
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_substream_select` | :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_connect`, `microphone_disconnect`, `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: | |
| 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_connect`, `microphone_disconnect`, `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