Advice on how to display battery level indicator on an AppDaemon dashboard

I have sensors that send their battery level as a float (9.99) every hour and I’d like to display a battery icon (e.g. fas-battery-*) indicating the battery level.

e.g.:

battery_level >3 : fas-battery-full
battery_level <3 and >2.5 :fas-battery-three-quarters
etc…

Looking at the list of standard widget types the Icon widget seems like it should be able to do the job, however I can’t seem to get the syntax right to enter a condition in the icons list instead of a state.

e.g.

icon:
    title: icon
    widget_type: icon
    entity: sensor.ground_floor_temperature_battery
    state_text: 1
    icons:
      >3:
        icon: fas-battery-full
        style: "color: green"

Please advise if there is a way to do this with the icon widget or another way to do it, and if not how else could I dot it (e.g. custom widget?).

Thanks

If anyone’s interested this is how I got it to work. I created an entity in Home Assistant that transformed the numerical battery reading from the sensor into a state (FULL, EMPTY etc…).

configuration.yaml:

  - platform: mqtt
    name: "Ground Floor Temperature Battery State"
    entity_id: ground_floor_temperature_battery_state
    state_topic: "myhome/RF_Device04/BATT"
    value_template:  >-
      {% if value|float>2.8 %}
        FULL
      {% else %}
        {% if value|float>2.7 %}
          THREE-QUARTER
        {% else %}
          {% if value|float>2.6 %}
            HALF
          {% else %}
            {% if value|float>2.4 %}
              QUARTER
            {% else %}
              EMPTY
            {% endif %}
          {% endif %}
        {% endif %}
      {% endif %}

mydashboard.yaml:

  gf_battery:
    title: Ground Floor Temperature Battery
    widget_type: icon
    entity: sensor.ground_floor_temperature_battery_state
    icons:
      "FULL":
        icon: fas-battery-full
        style: "color: green"
      "THREE-QUARTER":
        icon: fas-battery-three-quarters
        style: "color: green"
      "HALF":
        icon: fas-battery-half
        style: "color: orange"
      "QUARTER":
        icon: fas-battery-quarter
        style: "color: red"
      "EMPTY":
        icon: fas-battery-empty
        style: "color: red"
      "default":
        icon: fas-question-circle
        style: "color: yellow"