Firstly look at your section here:
animation: spin 0.5s linear infinite reverse;' if states('sensor.all_standby_energy') | float > 7 }}
You dont have a ā in front of animation despite the fact that the animation section ends with one.
animation: spin 0.5s linear infinite reverse;'
You also have 2 close brackets without the open brackets first.
if states('sensor.hybride_pomp_power') | float > 7 }}
So the correct syntax if you are going to have your if statements this way is this:
{{'animation: spin 0.5s linear infinite reverse;' if states('sensor.all_standby_energy') | float > 7 }}
Now you also have an issue because you are referring to .shape without referencing the object that .shape comes from. This is a bit harder to explain but essentially you need to start at the root of an object and drill down to the element that you want to style.
So for .shape you would need to have this instead.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
The issue for you is then that now style: no longer has style: | which you are using for the ha-state-icon section.
So what you can do is this:
.: |
ha-state-icon {
Think of the .: | as resetting you back to style: |
So all in all it would look like this:
card_mod:
style:
mushroom-shape-icon$: |
.shape {
border: 4px dashed rgb(var(--rgb-green));
{{ '--shape-animation: spin 2s linear infinite;' if states('sensor.hybride_pomp_power') | float > 2 }}
--shape-color: none;
--icon-symbol-size: 5px;
--icon-size: 34px;
}
.: |
ha-state-icon {
{{ 'animation: spin 0.5s linear infinite reverse;' if states('sensor.hybride_pomp_power') | float > 6 }}
border-radius: 50%;
border: 8px dotted rgb(var(--rgb-red));
}
But like i said in my last post. The reason you are having issues most of the time is because it looks like you arent noticing your if statements and then breaking them.
So i would write it like this. Just so it is easier to see what is going on.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
border: 4px dashed rgb(var(--rgb-green));
--shape-color: none;
--icon-symbol-size: 5px;
--icon-size: 34px;
{% if states('sensor.hybride_pomp_power') | float > 2 %}
--shape-animation: spin 2s linear infinite;
{% else %}
{% endif %}
}
.: |
ha-state-icon {
border-radius: 50%;
border: 8px dotted rgb(var(--rgb-red));
{% if states('sensor.hybride_pomp_power') | float > 6 %}
animation: spin 0.5s linear infinite reverse;
{% else %}
{% endif %}
}