Change entity icon color based on an binary sensor attribute (Battery check)

Hello i want to show a battery icon based on the the voltage of the battery. The icon should be red if it is below a voltage level.

Thereforei want to change the icon color based on an attribute from an binary sensor.
The binary sensor has the voltage as an attribute. :

{{ state_attr('binary_sensor.002a1d89aa0f4a_low_bat', 'voltage') }} V

as example it is 3,6 V and the icon should show red if it is below 3,7V

so i chaged the icon color but my scipt does not work. Can you help me what i need to code so that i can compare the volage values:

icon_color: |-
  {% if state_attr('binary_sensor.002a1d89aa0f4a_low_bat', 'voltage‘) > 3.7 %}
    green
  {% else %}
    red
  {% endif %}

Solved it i had a ’ mistake at voltage :slight_smile: