mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 14:56:53 +00:00
Added conditional element documentation (#8795)
* Added conditional element documentation Will add an example later on * Fixed required * Added conditional example * Update picture-elements.markdown
This commit is contained in:
parent
666b3a0d0c
commit
fd7f785652
@ -397,6 +397,38 @@ style:
|
|||||||
default: "position: absolute, transform: translate(-50%, -50%)"
|
default: "position: absolute, transform: translate(-50%, -50%)"
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
|
### {% linkable_title Conditional Element %}
|
||||||
|
|
||||||
|
Much like the Conditional card, this element will let you show its sub-elements based on entity states.
|
||||||
|
|
||||||
|
{% configuration %}
|
||||||
|
type:
|
||||||
|
required: true
|
||||||
|
description: conditional
|
||||||
|
type: string
|
||||||
|
conditions:
|
||||||
|
required: true
|
||||||
|
description: List of entity IDs and matching states.
|
||||||
|
type: list
|
||||||
|
keys:
|
||||||
|
entity:
|
||||||
|
required: true
|
||||||
|
description: HA entity ID.
|
||||||
|
type: string
|
||||||
|
state:
|
||||||
|
required: false
|
||||||
|
description: Entity state is equal to this value.*
|
||||||
|
type: string
|
||||||
|
state_not:
|
||||||
|
required: false
|
||||||
|
description: Entity state is unequal to this value.*
|
||||||
|
type: string
|
||||||
|
elements:
|
||||||
|
required: true
|
||||||
|
description: One or more elements of any type to show when conditions are met. See below for an example.
|
||||||
|
type: list
|
||||||
|
{% endconfiguration %}
|
||||||
|
|
||||||
### {% linkable_title Custom Elements %}
|
### {% linkable_title Custom Elements %}
|
||||||
|
|
||||||
{% configuration %}
|
{% configuration %}
|
||||||
@ -554,3 +586,26 @@ elements:
|
|||||||
left: 75%
|
left: 75%
|
||||||
width: 5%
|
width: 5%
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## {% linkable_title Conditional Example %}
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
type: picture-elements
|
||||||
|
image: /local/House.png
|
||||||
|
elements:
|
||||||
|
# conditionally show TV off button shortcut when dad's away and daughter is home
|
||||||
|
- type: conditional
|
||||||
|
conditions:
|
||||||
|
- entity: sensor.presence_daughter
|
||||||
|
state: 'home'
|
||||||
|
- entity: sensor.presence_dad
|
||||||
|
state: 'not_home'
|
||||||
|
elements:
|
||||||
|
- type: state-icon
|
||||||
|
entity: switch.tv
|
||||||
|
tap_action:
|
||||||
|
action: toggle
|
||||||
|
style:
|
||||||
|
top: 47%
|
||||||
|
left: 42%
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user