I’m having trouble getting my custom card button to display a percentage that is the payload of an MQTT topic. Here’s what I have right now but it doesn’t seem to work
type: custom:button-card
entity: sensor.east_garage_status
icon: mdi:garage
name: East Garage
size: 34px
card_size: 1
tap_action:
action: call-service
service: mqtt.publish
service_data:
payload: toggle
topic: garage/EastGarage/commands
show_state: false
show_name: true
show_label: true
state:
- value: open
label: Open
icon: mdi:garage-open
color: rgb(5, 147, 255)
- value: closed
label: >
[[[
var percent = states['sensor.east_garage_percentage'];
return "Closed " + percent;
]]]
icon: mdi:garage
color: rgb(255, 255, 255)
- value: opening
label: Opening
icon: mdi:garage-alert
color: rgb(255, 0, 0)
- value: closing
label: Closing
icon: mdi:garage-alert
color: rgb(255, 0, 0)
What am I doing wrong?