diff --git a/README.md b/README.md index fe8649f3..6239c9ec 100644 --- a/README.md +++ b/README.md @@ -579,9 +579,30 @@ All variables listed are under a `conditions:` section. | `view` | A list of [views](#views) in which this condition is satified (e.g. `clips`) | | `camera` | A list of camera ids in which this condition is satisfied. See [camera IDs](#camera-ids).| | `fullscreen` | If `true` the condition is satisfied if the card is in fullscreen mode. If `false` the condition is satisfied if the card is **NOT** in fullscreen mode.| +| `state` | A list of state conditions to compare with Home Assistant state. See below. | See the [PTZ example below](#frigate-card-conditional-example) for a real-world example of how these conditions can be used. +### State Conditions + +```yaml +- conditions: + state: + - [entries] +``` + +The Frigate Card Condition can compare HA state against fixed string values. This is the same as the Home Assistant [Conditional Element](https://www.home-assistant.io/dashboards/picture-elements/#conditional-element) condition, but can be used outside of a Picture Element context (e.g. card configuration overrides). + +If multiple entries are provided, the results are `AND`ed. + +| Parameter | Description | +| - | - | +| `entity` | The entity ID to check the state for | +| `state` | Condition will be met if state is equal to this optional string. | +| `state_not` | Condition will be met if state is unequal to this optional string. | + +See the [Menu override example below](#frigate-card-menu-override-example) for an illustration. + ## Picture Elements / Menu Customizations @@ -1230,6 +1251,23 @@ overrides: + + +
+ Expand: Change the menu position based on HA state + +```yaml +overrides: + - conditions: + state: + - entity: light.office_lights + state: 'on' + overrides: + menu: + position: bottom +``` +
+ ### Refreshing a static image
diff --git a/src/card.ts b/src/card.ts index 1a299954..978bfc4b 100644 --- a/src/card.ts +++ b/src/card.ts @@ -204,6 +204,7 @@ export class FrigateCard extends LitElement { } } + // HA entity state is part of the condition state. this._generateConditionState(); // Dark mode may depend on HASS.