I have setup a custom button card to change the color of an icon when MQTT message is received. The icon color is not changing. I send message with MQTT app in home assistant and verify be listening to topic. the config yaml file has the entry for the mqtt binary_sensor. Not sure what to try next. My goal is to receive mqtt from a custom ESP32.
I was not sure how to format code please advise if its incorrect.
type: custom:button-card
entity: binary_sensor.bed_window
icon: mdi:mailbox
name: Mailbox
state:
- operator: template
value: '{{ is_state("binary_sensor.bed_window", "1") }}'
styles:
icon:
- color: red
- operator: template
value: '{{ is_state("binary_sensor.bed_window", "0") }}'
styles:
icon:
- color: blue
Here is MQTT in config yaml file
mqtt:
binary_sensor:
- name: bed_window
state_topic: bedroom/window
unique_id: bed_window