Hallo zusammen.
Inspiriert vom Beitrag Entity Sensor auf Deutsch übersetzen
wollte ich das ganze auch mit einem Device_tracker ausprobieren. Mich stört z.B. etwas, dass bei den Sonos-Lautsprechern im Status ‘Zuhause’ oder ‘Abwesend’ steht. Schöner wäre es wenn es ‘Online’ oder ‘Offline’ wäre, zudem soll das Icon entsprechend geändert werden.
Nur leider bekomme ich das nicht wie im u.a. Code erstellt hin. Ich habe zwar keinen Fehler im YAML aber der Status Text wird nicht geändert. Hat jemand eine Idee?
Gruß
AndiFidi
Edit: Ich habe den Code mal ersetzt nach dem Hinweis von @detlan (s.u.). Danke Dir dafür!
Eigentlich wollte ich den Statustext selber ändern lassen, dies scheint aber schwierig zu sein. Von daher habe ich die ‘einfache’ Variante gewählt. Nun wird der Name der entity und das Icon geändert. Sieht auch cool aus
type: custom:button-card
entity: device_tracker.sonos_wohnzimmerl
color: auto
size: 33%
show_state: false
show_label: true
aspect_ratio: 1.5/1
tap_action:
action: toggle
haptic: light
styles:
card:
- border-radius: 12px
label:
- color: gray
- font-size: 11px
- font-family: Helvetica
- padding: 0px 10px
- justify-self: start
state:
- font-size: 11px
- padding: 0px 10px
- justify-self: start
- text-transform: capitalize
- font-weight: bold
- padding-left: 10px
img_cell:
- align-self: center
- text-align: start
- margin-left: 0px
name:
- justify-self: start
- padding-left: 10px
- font-weight: bold
- font-family: Helvetica
- font-size: 13px
state:
- value: home
icon: mdi:network-outline
name: Sonos Wohnzimmer Online
styles:
icon:
- color: '#37823a'
name:
- color: '#37823a'
state:
- color: '#37823a'
- value: not_home
icon: mdi:network-off-outline
name: Sonos Wohnzimmer Offline
style:
- opacity: 0.4
styles:
icon:
- color: '#ce717c'
name:
- color: '#ce717c'
state:
- color: '#ce717c'