Animation avec card_mod

Mon problème

Du jour au lendemain cette config de button-card n’a plus fonctionné. Je n’ai pas trouvé la raison.
Il s’agit d’animer l’icone et de la colorier en rouge lorsque le bouton est enfoncé.
L’icone est remise remise en bleu fixe par un autre bouton.
Actuellement, l’icone reste noire fixe !

Pouvez-vous m’aider à dissiper ce mystère?

type: custom:button-card
tap_action:
action: call-service
service: input_boolean.turn_on
service_data:
entity_id: input_boolean.test
show_state: true
icon: mdi:download-multiple
card_mod:
style: |
@keyframes blink {
0% {opacity: 0}
49% {opacity: 0}
50% {opacity: 1}
}
ha-icon {
{% set var_action = ‹ input_boolean.test › %}
{% if is_state(var_action,‹ on ›) %}
animation: blink 1s linear infinite;
color: red !important
{% elif is_state(var_action,‹ off ›) %}
color: #44739e !important
{% endif %}
}

Ma configuration


System Information

version core-2023.8.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.4
os_name Linux
os_version 6.1.39
arch x86_64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.32.1
Stage running
Available Repositories 1268
Downloaded Repositories 35
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 10.4
update_channel stable
supervisor_version supervisor-2023.07.1
agent_version 1.5.1
docker_version 23.0.6
disk_total 234.0 GB
disk_used 37.7 GB
healthy true
supported true
board generic-x86-64
supervisor_api ok
version_api ok
installed_addons Studio Code Server (5.10.0), Home Assistant Google Drive Backup (0.111.1), AppDaemon (0.13.3), Node-RED (14.4.3), Samba share (10.0.2), Duck DNS (1.15.0), File editor (5.6.0), ESPHome (2023.7.1), Zigbee2MQTT (1.32.2-1), NGINX Home Assistant SSL proxy (3.5.0), SQLite Web (3.9.0), Mosquitto broker (6.2.1), Grafana (9.0.3), InfluxDB (4.7.0), Music Assistant BETA (2.0.0b63), RTSPtoWeb - WebRTC (1.4.0), MariaDB (2.6.1), Advanced SSH & Web Terminal (15.0.6)
Dashboards
dashboards 4
resources 20
views 33
mode storage
Recorder
oldest_recorder_run 31 juillet 2023 à 06:02
current_recorder_run 6 août 2023 à 11:28
estimated_db_size 535.08 MiB
database_engine sqlite
database_version 3.41.2
Sonoff
version 3.5.2 (2ad1cd7)
cloud_online 0 / 1
local_online 1 / 1
___

Bonjour,
tu as une autre façon pour les animations directement avec button-card.

type: custom:button-card
entity: input_boolean.test
state:
  - value: 'on'
    color: red
    styles:
      icon:
        - animation: blink 2s linear infinite
  - value: 'off'
    color: '#44739e'
tap_action:
  action: call-service
  service: input_boolean.turn_on
  data:
    entity_id: input_boolean.test
hold_action:
  action: call-service
  service: input_boolean.turn_off
  data:
    entity_id: input_boolean.test
show_state: true
icon: mdi:download-multiple

======================================================================================
Il y a eu une modification dans les dernières maj de button-card pour service_data: qui deviens data: quand tu utilise un service.

avant

tap_action:
  action: call-service
  service: input_boolean.turn_on
  service_data:
    entity_id: input_boolean.test

après

tap_action:
  action: call-service
  service: input_boolean.turn_on
  data:
    entity_id: input_boolean.test

Ensuite ton soucis viens d’un changement dans button-card ou ha-icon est remplacer par ha-state-icon. Ta cas changer ca dans card_mod, pour corriger ton erreur.

  • icons: replace ha-icon with ha-state-icon to follow new HA’s icons per domain automatically (ab6a3f5)

Merci pour vos explications et solutions. Le sujet est clos!