You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/community.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ The overview video is available on YouTube [here](https://youtu.be/D403Vy2VaFA)
54
54
### Search for devices with a particular battery
55
55
56
56
Again from the excellent [Smart Live](https://smart-live.net/battery-notes-batteriemanagement-mit-home-assistant/)
57
-
This requires creating a helper of type text called `Battery search` with a max length of 20, which you can then reference in the below yaml on a dashboard.
57
+
This requires creating a helper of type text called `Battery search` with a max length of 20, which you can then reference in the below yaml on a dashboard.
58
58
59
59
```yaml
60
60
type: vertical-stack
@@ -68,13 +68,19 @@ cards:
68
68
state_color: false
69
69
- type: markdown
70
70
content: |-
71
-
{% set search_term = states('input_text.battery_search') | upper %}
72
-
{% if search_term != "" %}
71
+
{% set search_term = states('input_text.battery_search') | upper | trim %}
72
+
{% if search_term != "" %}
73
73
{% set devices = states | selectattr('attributes.battery_type', 'defined')
74
74
| selectattr('entity_id', 'search', '_battery_type$') | list %}
75
-
{% set matching_devices = devices | selectattr('attributes.battery_type', 'string')
0 commit comments