Moin, I need a little help. I create a little button to see if my garage door is open or not. For this I need a red flashing button.
I have build one buttom-card with this code:
Code:
type: custom:button-card
entity: switch.sonoff_mini_garage_status
icon: mdi:home
color: auto
color_type: card
name: Garage
show_state: false
state:
- value: 'off'
name: GARAGE OFFEN
color: red
icon: mdi:alert
styles:
card:
- animation: blink 2s ease infinite
- value: 'on'
name: GESCHLOSSEN
color: rgb(30, 32, 33)
icon: mdi:garage
tap_action:
action: none
double_tap_action:
action: call-service
service: switch.turn_on
target:
entity_id: switch.sonoff_mini_garage_auf_zu
hold_action:
action: none
styles:
card:
- height: 120px
- font-size: 15px
- font-weight: bold
- color: |
[[[
if (entity.state == 'off') return 'blue';
It is working nice. But I use one tablet with dark mode and one with without.
And this is my problem. The button is cool on the dark mode tablet.
But it is bad at the other one. Is someone here who knows what I have to change that the button is working like all other “normal” buttons?
Only if the status is “off” I need the button red and flashing