Salut,
J’ai un exemple avec un select (c’est un peu différent d’un input_select) mais le gros principe est là
https://forum.hacf.fr/t/integration-legrand-cable-outlet-064882-a-zigbee2mqtt/8952/40
Qui doit correspondre à ça
type: custom:auto-entities
show_empty: false
card:
type: custom:mushroom-chips-card
view_layout:
grid-area: chips
alignment: center
card_param: chips
filter:
template: >
{% set ns =
namespace(select=[],entity="select.convecteur_bureau_pilot_wire_mode")
%} {% for opt in state_attr(ns.entity, 'options') %}
{% set icon = iif(opt== 'off', 'mdi:radiator-off', icon) %}
{% set icon_color_select = iif(opt== 'off', 'red', icon_color_select) %}
{% set icon = iif(opt== 'frost_protection', 'mdi:snowflake-thermometer', icon) %}
{% set icon_color_select = iif(opt== 'frost_protection', 'blue', icon_color_select) %}
{% set icon = iif(opt== 'eco', 'mdi:thermometer-low', icon) %}
{% set icon_color_select = iif(opt== 'eco', 'green', icon_color_select) %}
{% set icon = iif(opt== 'comfort', 'mdi:checkbox-multiple-outline', icon) %}
{% set icon_color_select = iif(opt== 'comfort', 'yellow', icon_color_select) %}
{% set icon = iif(opt== 'comfort_-1', 'mdi:numeric-1-box-multiple-outline', icon) %}
{% set icon_color_select = iif(opt== 'comfort_-1', 'yellow', icon_color_select) %}
{% set icon = iif(opt== 'comfort_-2', 'mdi:numeric-2-box-multiple-outline', icon) %}
{% set icon_color_select = iif(opt== 'comfort_-2', 'yellow', icon_color_select) %}
{% set ns.select = ns.select + [
{
"type": "template",
"icon": icon,
"entity": ns.entity,
"icon_color": '{{ iif(is_state("' ~ ns.entity ~ '", "' ~ opt ~ '"), "' ~ icon_color_select ~ '", "disabled") }}',
"tap_action": {
"action": "call-service",
"service": "select.select_option",
"service_data": {
"entity_id": ns.entity,
"option": opt
}
},
"card_mod": {
"style": 'ha-card {
{% if is_state( "' ~ ns.entity ~ '" , "' ~ opt ~ '" ) %}
--chip-background: rgba(var(--mush-rgb-state-entity), 0.3);
{% else %}
--chip-background: rgba(var(--rgb-grey), 0.1);
{% endif %}
}'
}
}
] %}
{% endfor %} {{ ns.select }}
J’ai plus d’exemple tout fait, mais si tu ne t’en sors pas, je devrais pouvoir exhumer un truc