mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Explain use of collection_key
for energy cards (#37335)
* Update energy.markdown * Update energy.markdown * Typo --------- Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
66f1215145
commit
77063bc223
@ -234,3 +234,28 @@ The following example limits the number of shown devices to 5:
|
||||
type: energy-devices-detail-graph
|
||||
max_devices: 5
|
||||
```
|
||||
|
||||
## Using Multiple Collections
|
||||
|
||||
By default, all energy cards are linked to any `energy-date-selection` card on the view, and all `energy-date-selection` cards are linked to the same period. To enable multiple different date selections on the same view, it is necessary to link them to different collections. This is done by adding the variable `collection_key` to the card YAML, and giving this a value of any custom string that begins with `energy_`. (strings that do not start with `energy_` will generate an error).
|
||||
|
||||
All energy cards support use of `collection_key` option.
|
||||
|
||||
### Examples
|
||||
Example view with multiple collections:
|
||||
|
||||
```yaml
|
||||
type: masonry
|
||||
path: example
|
||||
cards:
|
||||
- type: energy-date-selection
|
||||
- type: energy-date-selection
|
||||
collection_key: energy_2
|
||||
|
||||
# This card is linked to the first (default) date selection
|
||||
- type: energy-usage-graph
|
||||
|
||||
# This card is linked to the second date selection
|
||||
- type: energy-usage-graph
|
||||
collection_key: energy_2
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user