J’aimerais bien avoir l’icône mdi:garage-open quand il est ouvert et mdi:garage quand il est fermé
Par ailleurs pendant la manœuvre d’environs 30 secondes j’aimerais bien avoir une variation de couleur
PS c’est d’ailleurs pour ça que je souhaitais réutiliser ton dernier code du poste de Matt1 que j’ai modifié ci-après avec mes entitées
type: custom:button-card
aspect_ratio: 9/3
custom_fields:
cardGarage:
card:
type: custom:button-card
entity: input_text.etat_porte_garage
name: Garage
icon: mdi:garage
show_label: true
label: |
[[[
if (states['input_text.etat_porte_garage'].state == 'Fermer')
return '<font color= "green"><b>Fermé</font>';
else if (states['input_text.etat_porte_garage'].state == 'Ouvert')
return '<font color= "red"><b>Ouvert</font>';
else if (states['cover.garage'].state == 'Fermeture')
return '<font color= "orange"><b>Fermeture</font>';
else if (states['cover.garage'].state == 'Ouverture')
return '<font color= "orange"><b>Ouverture</font>';
]]]
aspect_ratio: 1/1
styles:
name:
- font-size: 0.9em
- justify-self: middle
- align-self: end
- color: rgba(255,255,255,0.6)
card:
- background-color: rgba(64,64,64,0.8)
- box-shadow: 4px 4px 4px 0px rgba(32,32,32,0.5)
- border: 2px rgba(211,211,211,1.0) outset
icon:
- border-radius: 50%
- border: none
- box-shadow: 0px 0px 5px 5px rgba(0,128,0,0.5)
- box-shadow: |
[[[
if (states['input_text.etat_porte_garage'].state == 'Fermer')
return '0px 0px 5px 5px rgba(0,128,0,0.5)';
else if (states['input_text.etat_porte_garage'].state == 'Ouvert')
return '0px 0px 5px 5px rgba(255,0,0,0.5)';
else if (states['cover.garage'].state == 'Fermeture')
return '0px 0px 5px 5px rgba(255,140,0,0.5)';
else if (states['cover.garage'].state == 'Ouverture')
return '0px 0px 5px 5px rgba(255,140,0,0.5)';
]]]
- background-color: |
[[[
if (states['input_text.etat_porte_garage'].state == 'Fermer')
return 'rgba(0,128,0,0.5)';
else if (states['input_text.etat_porte_garagee'].state == 'Ouvert')
return 'rgba(255,0,0,0.5)';
else if (states['cover.garage'].state == 'Fermeture')
return 'rgba(255,140,0,0.5)';
else if (states['cover.garage'].state == 'Ouverture')
return 'rgba(255,140,0,0.5)';
]]]
- width: 60px
- height: 60px
- color: |
[[[
if (states['input_text.etat_porte_garage'].state == 'Ouvert')
return 'rgba(0,255,0,1.0)';
else if (states['input_text.etat_porte_garage'].state == 'Fermer')
return 'rgba(255,0,0,1.05)';
else if (states['cover.porte_de_garage'].state == 'Fermeture')
return 'rgba(255,140,0,0.5)';
else if (states['cover.porte_de_garage'].state == 'Ouverture')
return 'rgba(255,140,0,0.5)';
]]]
label:
- animation: |
[[[
if (states['cover.garage'].state == 'Fermeture')
return 'blink 2s ease infinite';
else if (states['cover.garage'].state == 'Ouverture')
return 'blink 2s ease infinite';
]]]
tap_action:
action: call-service
service: script.portail_fermer
hold_action:
action: call-service
service: script.portail_ouvert