Help with sensor templates

I have an entity “air_quality.dyson” with many atributes. I have read that using sensor templates I can make the attributes to behave like entities and use them in the cards.
I have read the sensor templates documentation but is still unclear to me how the code should look like
Can someone help me to get this workin? thanks in advance

I am interested in air_quality_index

imagen

  - platform: template
    sensors:
      air_quality_index:
        friendly_name: "Air Quality Index"
        unit_of_measurement: 'ug/m3' 
        value_template: "{{ state_attr('air_quality.dyson', 'air_quality_index') }}"
2 Likes