Ich hatte die Idee in einem CustumButton den Status einer zusätzlichen Entität anzeigen zu lassen
(Device Tracker Sonos Lautsprecher), nur gefällt mir der Text ‚home‘ und ‚away‘ nicht. Diesen möchte ich mit ‚online‘ oder ‚offline‘ ersetzen. Aber irgendwie funktioniert der Syntax nicht. Es gibt zwar keine Fehlermeldung aber es wird nichts angezeigt.
Hier der gesamte YamlCode, der betroffene Abschnitt wäre dann ‚custom field‘
type: custom:button-card
name: Wohn
icon: mdi:speaker-wireless
entity: switch.steckdose_sonos_wz
color: auto
size: 20%
show_state: false
show_label: true
aspect_ratio: 1.7/0.9
tap_action:
action: toggle
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: normal
- padding-left: 10px
grid:
- grid-template-areas: "\"i\" \"n\" \"s\" \"l\""
- grid-template-columns: 1fr
- grid-template-rows: 1fr min-content min-content
img_cell:
- align-self: center
- text-align: start
- margin-left: 0px
name:
- justify-self: center
- padding: 2px 0px 10px 0px;
- padding-left: 0 px
- font-weight: normal
- font-family: Helvetica
- font-size: 11px
custom_fields:
Sets:
- position: absolute
- padding: 30px 0px 0px 34px;
- color: "#37823a"
- font-weight: normal
- font-family: Helvetica
- font-size: 11px
custom_fields:
Sets: |
[[[if (states["device_tracker.sonos_wohnzimmerl"].state === 'home') return
'Online'; if (states["device_tracker.sonos_wohnzimmerl"].state === 'away') return
'Offline';]]]
state:
- value: "on"
styles:
icon:
- color: "#37823a"
name:
- color: "#37823a"
state:
- color: "#37823a"
- value: "off"
styles:
icon:
- color: "#ce717c"
name:
- color: "#ce717c"
state:
- color: "#ce717c"
Gruß, AndiFidi

