Je partage ma carte pour ceux qui le souhaite :
Le code:
type: custom:stack-in-card
mode: vertical
keep:
box_shadow: true
margin: false
border_radius: true
background: true
outer_padding: false
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.rte_tempo_couleur_actuelle
name: |
[[[
const dateObj = new Date();
const day = dateObj.getDate();
const month = dateObj.toLocaleDateString('fr-FR', { month: 'long' });
const lineColor = (entity.state === 'Blanc' || entity.state === 'inconnu') ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)';
const capsuleColor = entity.state === 'Bleu' ? 'rgba(0, 0, 102, 0.8)' : (entity.state === 'Rouge' ? 'rgba(102, 0, 0, 0.8)' : 'rgba(128, 128, 128, 0.5)');
let displayState;
if (entity.state === 'Bleu') displayState = 'Jour bleu';
else if (entity.state === 'Rouge') displayState = 'Jour rouge';
else if (entity.state === 'Blanc') displayState = 'Jour blanc';
else displayState = 'Indéterminé';
return `<div style="background-color: ${capsuleColor}; padding: 4px 12px; border-radius: 14px; display: inline-block; margin-bottom: 6px; color: white;">Aujourd'hui</div><br><span style="font-size: 22px; font-weight: bold;">${day}</span> ${month}<br><div style="width: 100px; height: 1px; background-color: ${lineColor}; margin: 4px auto;"></div><span style="font-size: 13px;">${displayState}</span>`;
]]]
show_icon: false
show_state: false
styles:
card:
- background: |
[[[
if (entity.state === 'Bleu') return 'radial-gradient(circle, #0d61fc, #0404c2)';
if (entity.state === 'Blanc') return 'radial-gradient(circle, #ffffff, #cccccc)';
if (entity.state === 'Rouge') return 'radial-gradient(circle, #fc2121, #9c0505)';
return 'repeating-linear-gradient(-45deg, #dddddd, #dddddd 3px, #aaaaaa 3px, #aaaaaa 6px)';
]]]
- display: flex
- align-items: center
- justify-content: center
- text-align: center
name:
- color: |
[[[
if (entity.state === 'Rouge' || entity.state === 'Bleu') return 'white';
return 'black';
]]]
- font-family: "'Helvetica Neue', Arial, sans-serif"
- font-size: 18px
- type: custom:button-card
entity: sensor.rte_tempo_prochaine_couleur
name: |
[[[
let tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const day = tomorrow.getDate();
const month = tomorrow.toLocaleDateString('fr-FR', { month: 'long' });
const lineColor = (entity.state === 'Blanc' || entity.state === 'inconnu') ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)';
const capsuleColor = entity.state === 'Bleu' ? 'rgba(0, 0, 102, 0.8)' : (entity.state === 'Rouge' ? 'rgba(102, 0, 0, 0.8)' : 'rgba(128, 128, 128, 0.5)');
let displayState;
if (entity.state === 'Bleu') displayState = 'Jour bleu';
else if (entity.state === 'Rouge') displayState = 'Jour rouge';
else if (entity.state === 'Blanc') displayState = 'Jour blanc';
else displayState = 'Indéterminé';
return `<div style="background-color: ${capsuleColor}; padding: 4px 12px; border-radius: 14px; display: inline-block; margin-bottom: 6px; color: white;">Demain</div><br><span style="font-size: 22px; font-weight: bold;">${day}</span> ${month}<br><div style="width: 100px; height: 1px; background-color: ${lineColor}; margin: 4px auto;"></div><span style="font-size: 13px;">${displayState}</span>`;
]]]
show_icon: false
show_state: false
styles:
card:
- background: |
[[[
if (entity.state === 'Bleu') return 'radial-gradient(circle, #0d61fc, #0404c2)';
if (entity.state === 'Blanc') return 'radial-gradient(circle, #ffffff, #cccccc)';
if (entity.state === 'Rouge') return 'radial-gradient(circle, #fc2121, #9c0505)';
return 'repeating-linear-gradient(-45deg, #dddddd, #dddddd 3px, #aaaaaa 3px, #aaaaaa 6px)';
]]]
- display: flex
- align-items: center
- justify-content: center
- text-align: center
name:
- color: |
[[[
if (entity.state === 'Rouge' || entity.state === 'Bleu') return 'white';
return 'black';
]]]
- font-family: "'Helvetica Neue', Arial, sans-serif"
- font-size: 18px
- type: horizontal-stack
cards:
- type: custom:mushroom-entity-card
entity: sensor.rte_tempo_cycle_jours_restants_bleu
icon_color: blue
icon: mdi:calendar
name: " "
layout: horizontal
primary_info: state
secondary_info: none
icon_type: icon
card_mod:
style: |
ha-card {
padding: 8px 0px !important;
display: flex;
justify-content: center;
align-items: center;
background: radial-gradient(circle, rgba(13, 97, 252, 0.3), rgba(28, 28, 28, 0.3));
border: #242424;
}
mushroom-state-item {
--icon-size: 24px !important;
}
- type: custom:mushroom-entity-card
entity: sensor.rte_tempo_cycle_jours_restants_blanc
icon_color: white
icon: mdi:calendar
name: " "
layout: horizontal
primary_info: state
secondary_info: none
icon_type: icon
card_mod:
style: |
ha-card {
padding: 8px 0px !important;
display: flex;
justify-content: center;
align-items: center;
background: radial-gradient(circle, rgba(255, 255, 255, 0.3), rgba(28, 28, 28, 0.3));
border: #242424;
}
mushroom-state-item {
--icon-size: 24px !important;
}
- type: custom:mushroom-entity-card
entity: sensor.rte_tempo_cycle_jours_restants_rouge
icon_color: "#FC2121"
icon: mdi:calendar
name: " "
layout: horizontal
primary_info: state
secondary_info: none
icon_type: icon
card_mod:
style: |
ha-card {
padding: 8px 0px !important;
display: flex;
justify-content: center;
align-items: center;
background: radial-gradient(circle, rgba(252, 33, 33, 0.3), rgba(28, 28, 28, 0.3));
border: #242424;
}
mushroom-state-item {
--icon-size: 24px !important;
}
shape {
background-color: rgba(0)!important;
}