Hello I try to make a simple custom button card, but it is never simple for me.
I wanted mine power mdi icon to change color when I turn it on when it is of it muss be red en when it is on it muss be green.
The button itself works fine mine fan goes on and of only the mdi.pwower icon doesn’t change color.
I tried a couple of configs and this mine latest.
type: custom:button-card
entity: script.plafond_ventilator_aan_uit
name: Plafond Ventilator
icon: mdi:power
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.plafond_ventilator_aan_uit
styles:
card:
- background-color: rgba(0, 0, 0, 1)
state:
- value: "on"
styles:
icon:
- color: green
- value: "off"
styles:
icon:
- color: red
- value: unknown
styles:
icon:
- color: grey
And for the question I hope someone knows the solution.