RESTful sensors should support icon_template

Configurable entities, like RESTful sensors, should extend capabilities from Template sensors.

For example, check this implementation:

sensor:
  - platform: rest
    name: Glucose Value
    resource: 'https://192.168.1.2:5423/api/v1/entries/current.json'
    value_template: '{{ value_json[0].sgv }}'
    json_attributes_path: "$.[0]"
    json_attributes:
      - direction
      - delta
      - dateString
      - utcOffset
  - platform: template
    sensors:
      marcio_glucose:
        entity_id: sensor.glucose_value
        friendly_name: "My Glucose"
        unit_of_measurement: mg/dL
        value_template: "{{ states('sensor.glucose_value') | float }}"
        icon_template: >-
          {%- set state = state_attr('sensor.glucose_value', 'direction') -%}
          {%- if state == "Flat" -%}
              mdi:arrow-right
          {%- elif state == "SingleDown" -%}
              mdi:arrow-down
          {%- elif state == "FortyFiveDown" -%}
              mdi:arrow-bottom-right
          {%- elif state == "DoubleDown" -%}
              mdi:chevron-triple-down
          {%- elif state == "SingleUp" -%}
              mdi:arrow-up
          {%- elif state == "FortyFiveUp" -%}
              mdi:arrow-top-right
          {%- elif state == "DoubleUp" -%}
              mdi:chevron-triple-up
          {%- else -%}
            mdi:cloud-question
          {%- endif -%}

I have to create a second template sensor just to have icon_template capability.

I try to use device_class whenever possible since it requires less YAML. But when the sensor doesn’t fit nicely into a device_class I’ve definitely wished for the icon_template option

You can use customization to set an icon you like, but when I found I couldn’t set the icon where I defined the sensor… It was a WTH moment…