Bon suite à l’achat, j’ai fait une petite carte mushroom (encore simplifiable/optimizable)
type: custom:stack-in-card
cards:
- type: custom:layout-card
layout_type: grid
layout:
grid-template-rows: 25px
grid-template-areas: |
"entity info"
"entity last"
cards:
- type: custom:mushroom-template-card
primary: >-
{{state_attr('switch.convecteur_bureau','friendly_name')| title }}
secondary: >-
{{
states('switch.convecteur_bureau')|replace('on','Allumé')|replace('off','Éteint')
}}
icon: mdi:radiator
entity: switch.convecteur_bureau
picture: >-
{{state_attr('switch.convecteur_bureau','entity_picture') }}
icon_color: |
{% if is_state('switch.convecteur_bureau','on') %}
yellow
{% else %}
disable
{% endif %}
view_layout:
grid-area: entity
grid-column-start: 1
grid-column-end: 3
- type: custom:mushroom-template-card
primary: ''
secondary: >-
Il y a {{ relative_time(states.switch.convecteur_bureau.last_changed)
| regex_replace('second','seconde') | regex_replace("hour", "heure")
|regex_replace("day", "jour") |regex_replace("month(s){0,1}", "mois")
}}
view_layout:
grid-area: last
card_mod:
style: |
ha-card {
background-color: transparent;
margin-top: 10px;
margin-right: 5px;
text-align: right;
box-shadow: none;
}
- type: custom:mushroom-template-card
primary: ''
secondary: '{{ states(''sensor.convecteur_bureau_power'') }} W'
view_layout:
grid-area: info
card_mod:
style: |
ha-card {
background-color: transparent;
margin-top: 10px;
margin-right: 5px;
text-align: right;
box-shadow: none;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-bottom: 10px;
}
alignment: center
chips:
- type: template
content: >-
Il y a {{
relative_time(states.select.convecteur_bureau_cable_outlet_mode.last_changed)
|
regex_replace('second','seconde') | regex_replace("hour", "heure")
|regex_replace("day", "jour") |regex_replace("month(s){0,1}",
"mois") }}
- type: template
icon: mdi:radiator-off
entity: select.convecteur_bureau_cable_outlet_mode
icon_color: |-
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'off') %}
yellow
{% else %}
disabled
{% endif %}
tap_action:
action: call-service
service: select.select_option
service_data:
entity_id: select.convecteur_bureau_cable_outlet_mode
option: 'off'
card_mod:
style: |
ha-card {
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'off') %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}
- type: template
icon: mdi:snowflake-thermometer
entity: select.convecteur_bureau_cable_outlet_mode
icon_color: >-
{% if is_state('select.convecteur_bureau_cable_outlet_mode',
'frost_protection') %}
yellow
{% else %}
disabled
{% endif %}
tap_action:
action: call-service
service: select.select_option
service_data:
entity_id: select.convecteur_bureau_cable_outlet_mode
option: frost_protection
card_mod:
style: |
ha-card {
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'frost_protection') %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}
- type: template
icon: mdi:thermometer-low
entity: select.convecteur_bureau_cable_outlet_mode
icon_color: |-
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'eco') %}
yellow
{% else %}
disabled
{% endif %}
tap_action:
action: call-service
service: select.select_option
service_data:
entity_id: select.convecteur_bureau_cable_outlet_mode
option: eco
card_mod:
style: |
ha-card {
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'eco') %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}
- type: template
icon: mdi:checkbox-multiple-outline
entity: select.convecteur_bureau_cable_outlet_mode
icon_color: >-
{% if is_state('select.convecteur_bureau_cable_outlet_mode',
'comfort') %}
yellow
{% else %}
disabled
{% endif %}
tap_action:
action: call-service
service: select.select_option
service_data:
entity_id: select.convecteur_bureau_cable_outlet_mode
option: comfort
card_mod:
style: |
ha-card {
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'comfort') %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}
- type: template
icon: mdi:numeric-1-box-multiple-outline
entity: select.convecteur_bureau_cable_outlet_mode
icon_color: >-
{% if is_state('select.convecteur_bureau_cable_outlet_mode',
'comfort-1') %}
yellow
{% else %}
disabled
{% endif %}
tap_action:
action: call-service
service: select.select_option
service_data:
entity_id: select.convecteur_bureau_cable_outlet_mode
option: comfort-1
card_mod:
style: |
ha-card {
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'comfort-1') %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}
- type: template
icon: mdi:numeric-2-box-multiple-outline
entity: select.convecteur_bureau_cable_outlet_mode
icon_color: >-
{% if is_state('select.convecteur_bureau_cable_outlet_mode',
'comfort-2') %}
yellow
{% else %}
disabled
{% endif %}
tap_action:
action: call-service
service: select.select_option
service_data:
entity_id: select.convecteur_bureau_cable_outlet_mode
option: comfort-2
card_mod:
style: |
ha-card {
{% if is_state('select.convecteur_bureau_cable_outlet_mode', 'comfort-2') %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}