I made a quick template sensor to pull in data from AirNow. After, I then found out about the post at https://lemmy.world/post/730349, but I thought it might still be useful to share for a quick glance.
template:
- sensor:
- name: "Air Quality"
unique_id: "airnowaqitemplate"
state: >
{% set aqi = states('sensor.airnow_air_quality_index') | int %}
{% if aqi <= 50 %}
Good
{% elif aqi <= 100 %}
Moderate
{% elif aqi <= 150 %}
Unhealthy for Sensitive Groups
{% elif aqi <= 200 %}
Unhealthy
{% elif aqi <= 300 %}
Very Unhealthy
{% elif aqi >= 301 %}
Hazardous
{% else %}
Unknown
{% endif %}
icon: >
{% set aqi = states('sensor.airnow_air_quality_index') | int %}
{% if aqi <= 50 %}
mdi:emoticon-happy
{% elif aqi <= 100 %}
mdi:emoticon-neutral
{% elif aqi <= 150 %}
mdi:emoticon-sad
{% elif aqi <= 200 %}
mdi:emoticon-sick
{% elif aqi <= 300 %}
mdi:emoticon-dead
{% elif aqi >= 301 %}
mdi:skull-crossbones
{% else %}
mdi:minus-circle
{% endif %}
availability: "{{ has_value('sensor.airnow_air_quality_index') }}"
You must log in or # to comment.