Hi Leute.
Bin grad mit BatteryNotes am basteln und stehe vor einem Problem.
Ich möchte mir eine Karte bauen (am liebsten im BubbleCard-Design), in der mir nur die leeren Batterien angezeigt werden. Das ganze soll natürlich automatisch funktionieren, nicht das ich bei jedem neuen Gerät wieder überarbeiten muss.
Aktuell sind es bei mir nur Geräte, welche nur den Status anzeigen ob leer oder nicht (also ohne richtige Prozentwerte). Das funktioniert mit Auto-entities auch schon.
Jetzt hätte ich aber gerne, das er mir die zugehörigen Batterietypen, welche als Entität von BatteryNotes zur Verfügung gestellt werden, mit in der Card anzeigt. Entweder als Sub-Button oder als Zusatz beim Status. Ist das möglich?
Das ist die Card, bei der es automatisch die leeren Geräte anzeigt.

Und so ähnlich wollte ich es haben. Die Card ist manuell erstellt.

Bin für jede Hilfe dankbar.
Schönen Abend euch allen…
MfG David
Hi,
nur auf die schnelle aus Zeitmangel, aber vielleicht kannst du dir was rausziehen…
ich verwende ebenfalls die Auto-Entities zusammen mit der Battery Notes. Das ganze packe ich in ein Popup der Bubble Card. Sortiert ist das ganze nach Räumen (hab ich so manuell nach areas aufgebaut.
type: vertical-stack
cards:
- type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Schlafzimmer
bulk_rename:
- from: " Batterie+"
to: ""
- from: Schlafzimmer Button
to: 4-fach-Schalter
- from: Fensterkontakt Schlafzimmer
to: Fenster
- from: Temperatursensor Schlafzimmer
to: Temperatur und Luftfeuchtigkeit
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Schlafzimmer') | select('match',
'sensor.*_battery_plus') | list }}
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Küche
bulk_rename:
- from: " Batterie+"
to: ""
- from: Temperatursensor Kühlschrank
to: Kühlschrank
- from: Fensterkontakt Küche
to: Fenster
- from: Temperatursensor Küche
to: Temperatur und Luftfeuchtigkeit
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Küche') | select('match',
'sensor.*_battery_plus') | list }}
- type: vertical-stack
cards:
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Wohnzimmer
bulk_rename:
- from: " Batterie+"
to: ""
- from: Wohnzimmer Button
to: 4-fach-Schalter
- from: Fensterkontakt Wohnzimmer
to: Fenster
- from: Temperatursensor Wohnzimmer
to: Temperatur und Luftfeuchtigkeit
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Wohnzimmer') | select('match',
'sensor.*_battery_plus') | list }}
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Esszimmer
bulk_rename:
- from: " Batterie+"
to: ""
- from: Fensterkontakt Esszimmer
to: Fenster
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Esszimmer') | select('match',
'sensor.*_battery_plus') | list }}
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Netzwerk Rack
bulk_rename:
- from: " Batterie+"
to: ""
- from: Temperatursensor Netzwerk Rack
to: Temperatursensor
- from: Türkontakt Netzwerk Rack
to: Türkontakt
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Technik') | select('match',
'sensor.*_battery_plus') | list }}
- type: vertical-stack
cards:
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Bad
bulk_rename:
- from: " Batterie+"
to: ""
- from: Fensterkontakt Bad
to: Fenster
- from: Temperatursensor Bad
to: Temperatur und Luftfeuchtigkeit
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Bad') | select('match',
'sensor.*_battery_plus') | list }}
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: Büro
bulk_rename:
- from: " Batterie+"
to: ""
- from: Fensterkontakt Büro
to: Fenster
- from: Temperatursensor Büro
to: Temperatur und Luftfeuchtigkeit
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('Büro') | select('match',
'sensor.*_battery_plus') | list }}
- type: custom:auto-entities
card:
type: custom:battery-state-card
title: HWR
bulk_rename:
- from: " Batterie+"
to: ""
- from: Fensterkontakt HWR
to: Fenster
- from: Temperatursensor HWR
to: Temperatur und Luftfeuchtigkeit
colors:
steps:
- "#ff0000"
- "#ffff00"
- "#00ff00"
gradient: true
sort:
by: name
secondary_info: "{attributes.battery_type}"
tap_action:
action: none
filter:
template: >
{{ area_entities('HWR') | select('match',
'sensor.*_battery_plus') | list }}
title: Alle Batterien
- type: custom:bubble-card
card_type: pop-up
hash: "#batterien"
button_type: name
show_header: false
margin_top_mobile: calc(100vh - 860px)
margin_top_desktop: calc(100vh - 860px)
name: ""
bg_opacity: "70"
width_desktop: 950px
title: Batterien
grid_options:
columns: 24
rows: auto
Sieht dann so aus:
In secondary_info steht dann das Attribut der Batteri Entität Typ, den du ja willst. {attributes.battery_type}
Das filtert dir derzeit natürlich nicht wie gewünscht nur die leeren Batterien… Aber mit der custom:battery-state-card kannst du ja auch festlegen welche Batteriestände angezeigt werden sollen…
Zum Beispiel mit nem filter:
filter:
include:
- name: entity_id
value: "*_battery_plus"
exclude:
- name: state
value: 10
operator: ">"
In dem Fall nichts Anzeigen was größer ist als 10%.
Spiel doch da mal mit rum. Wie gesagt auch Zeitmangel nur mein Stand und keine fertige Lösung…
Hi Schlumperdix,
erstmal vielen Dank für deine Hilfe. Bin leider erst am Wochenende zum probieren gekommen.
Dein Ansatz mit dem Attribut hat mich echt weiter gebracht.
Es werden zwar nur Geräte angezeigt die den Battery_Low status haben, ist für mich aber vollkommen ausreichend, da ich sowieso zur Zeit noch keine Geräte mit prozentualer Batterieanzeige abfrage.
Aussehen tut das ganze wie folgt:
Angezeigt werden nur Geräte mit leerer Batterie und das automatisch auch für zukünftig hinzugefügte Geräte. Wenn keine Batterie leer ist, bleibt die Card unsichtbar.
Falls es jemand gebrauchen kann, hier mein Code:
type: custom:auto-entities
card:
type: grid
columns: 1
square: false
card_param: cards
filter:
include:
- domain: binary_sensor
entity_id: "*battery_plus_low"
attributes:
device_class: battery
state: "on"
options:
type: custom:bubble-card
card_type: button
button_type: state
show_state: false
attribute: battery_type_and_quantity
icon: mdi:battery-alert-variant-outline
styles: |
.bubble-icon {
color: red !important;
}
sort:
method: friendly_name
scrolling_effect: false
Nochmals vielen Dank für die Hilfe.