feat: Add or, and and not condition types (#1980)

[skip ci]
This commit is contained in:
Dermot Duffy
2025-03-23 21:04:15 -07:00
committed by GitHub
parent f140f6a653
commit a3b17d8cb2
6 changed files with 312 additions and 20 deletions
+3
View File
@@ -50,6 +50,9 @@ Trigger template values must be proceeded by `advanced_camera_card.trigger` (or
conditions](../conditions.md?id=state), only data from the last listed state
condition is available.
!> If you use an [`or`](../conditions.md?id=or) condition, only the trigger data
for the first matching trigger will be included.
Please [request](https://github.com/dermotduffy/advanced-camera-card/issues) if
you need data from additional conditions.
+45
View File
@@ -14,6 +14,21 @@ certain configurations (in `overrides`) or to display "picture elements" (in
- [condition_2]
```
## `and`
Evaluates to `true` if _all_ embedded conditions evaluate to `true`.
```yaml
conditions:
- condition: and
# [...]
```
| Parameter | Description |
| ------------ | -------------------------------------------------------------------------------------------------------------- |
| `condition` | Must be `and`. |
| `conditions` | A list of other conditions _all_ of which must evaluate `true` in order for this condition to evaluate `true`. |
## `camera`
Matches based on the selected camera. Does not match other cameras (whether
@@ -174,6 +189,21 @@ conditions:
When multiple parameters are specified they must all match for the condition to
match.
## `not`
Evaluates to `true` if _all_ embedded conditions evaluate to `false`.
```yaml
conditions:
- condition: not
# [...]
```
| Parameter | Description |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
| `condition` | Must be `not`. |
| `conditions` | A list of other conditions _all_ of which must evaluate `false` in order for this condition to evaluate `true`. |
## `numeric_state`
Matches based on numeric Home Assistant state.
@@ -186,6 +216,21 @@ conditions:
See [Home Assistant conditions documentation](https://www.home-assistant.io/dashboards/conditional/#numeric-state).
## `or`
Evaluates to `true` if _any_ embedded condition evaluates to `true`.
```yaml
conditions:
- condition: or
# [...]
```
| Parameter | Description |
| ------------ | -------------------------------------------------------------------------------------------------------- |
| `condition` | Must be `or`. |
| `conditions` | A list of conditions _any_ of which must evaluate `true` in order for this condition to evaluate `true`. |
## `screen`
Matches based on [media queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries).