Bonjour,
l’auteur de custom-ui disant clairement qu’il faut mieux utiliser card-mod, j’essaie de migrer de l’un vers l’autre.
All modifications in my entire config are now implemented using Card-mod. I am aware this only works in the actual cards in the View, and not on the more-info dialog of entities. It is an acceptable trade-off between optimal desktop customization, and optimal core handling of the state machine.
J’ai donc regardé un peu les exemples pour transformer ceci :
homeassistant:
customize_domain:
cover:
templates:
icon: >-
if (attributes.position == 0) return '';
if (attributes.position < 33) return 'custom-shutter:shutter-3';
if (attributes.position < 66) return 'custom-shutter:shutter-2';
if (attributes.position < 100) return 'custom-shutter:shutter-1';
return 'custom-shutter:shutter-0';
en celà :
homeassistant:
customize_domain:
cover:
card_mod:
style: |
:host {
--card-mod-icon:
{% set position = state_attr(config.entity, 'position') | int(default=0) %}
{% if position == 'unknown' %} mdi:window-shutter-alert
{% elif position == 0 %} custom-shutter:shutter-4
{% elif position < 33 %} custom-shutter:shutter-3
{% elif position < 66 %} custom-shutter:shutter-2
{% elif position < 100 %} custom-shutter:shutter-1
{% else %} custom-shutter:shutter-0
{% endif %};
}
Le soucis étant que ça ne marche pas et je ne comprends pas ce que j’ai fait de mal.