Custom attributes for template sensor

I would like to request for the ability to create custom attributes for template sensor or binary sensor.

Example:

sensor:
  - platform: template
    sensors:
      solar_angle:
        friendly_name: "Sun angle"
        unit_of_measurement: 'degrees'
        value_template: "{{ states.sun.sun.attributes.elevation }}"
        attribute_template:
          - azimuth: "{{ states.sun.sun.attributes.azimuth }}"
          - next_rising: "{{ states.sun.sun.attributes.next_rising }}"

definitely!

This would be especially handy.

I’ve got a bunch of sensors that are on a card, via auto-entities, so that they only show up when valid. Unfortunately the state and attributes are fairly ugly natively, but can be cleaned up easily in a template.

So now I’ve either got to have a card that shows sensors when invalid, so that I can incorporate other templated sensors to prettify it … or resort to creating a new sensor, based on the originals, in python. Both methods are a bit hairy and they wouldn’t be necessary with template attributes for template sensors.

DId they ever create this? Or is there a neat way of doing this sort of stuff now?

It’s here: