Did you at some point in time rename their entity_id option?
I’m asking because, when supplied name and unique_id, Home Assistant automatically uses the value of name to create the sensor’s entity_id, not the value of unique_id.
In other words it will create a slug from “Air-1 Overall Quality Realtime” which will look like air_1_overall_quality_realtime.
Alternately, did the sensor’s name originally end with rt and you changed it after the sensor had been created?
If you did none of those things, and the sensor’s entity_id was derived automatically from its unique_id, then your instance of Home Assistant has behaved in a way that doesn’t correspond to known naming rules.
At any rate, a Trigger-based Template Sensor initially reports unknown until it’s triggered.
You may wish to try this version. It uses a State Trigger to detect when the sensor’s state changes to any value that remains unchanged for at least 5 minutes. Then it reports that value.
- trigger:
- platform: state
entity_id: sensor.air1_overall_quality_rt
to:
for:
minutes: 5
sensor:
- name: Air-1 Overall Quality Metric
unique_id: air1_overall_quality
state: "{{ trigger.to_state.state }}"
Keep in mind that neither your version or mine will report anything until the sensor’s state changes and then remains in the changed state for at least 5 minutes. For example, your air quality sensor is currently reporting Good. It won’t serve to trigger your Template Trigger or my State Trigger until it changes to another value (and maintains it for at least 5 minutes).