I have the following custom card that displays a battery value and also toggles on/off a switch when pressed
- color: white
color_type: card
entity: sensor.amazon_fire_battery_sensor
label: Tablet
show_label: true
show_name: false
show_state: true
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.meross_tablet
styles:
card:
- width: 105px
- height: 105px
type: 'custom:button-card'
I would like to change the color of this card based on the on/off value of the switch.meross_tablet
switch. Is that possible?
I know I can do something like:
state:
- color: 'rgb(255, 0, 0)'
label: Tablet On
value: 'on'
- color: 'rgb(255, 255, 255)'
label: Tablet Off
value: 'off'
But that is only for the main entity of the card it seems sensor.amazon_fire_battery_sensor
Any idea if that would work?