1. File api_waqi_info_sensors.yaml:
#https://aqicn.org/api
api_waqi_info_sensors:
  
  sensor:
  - platform: rest
    name: api_waqi_info
    resource_template: "https://api.waqi.info/feed/A195973/?token=YOURS_TOKEN"
    method: GET
    headers:
      content-type: 'application/json'
    value_template: "{{ value_json.data.iaqi.pm25.v }}"
    json_attributes:
      - "data"
    scan_interval: 600 # 10 Minutes

  - platform: template
    sensors:
      api_waqi_color_text:
        friendly_name: "api_waqi_color_text"
        value_template: >
         {% if   ((states('sensor.api_waqi_info') | int) >= 0)   and ((states('sensor.api_waqi_info') | int) <= 50) %}#009966
         {% elif ((states('sensor.api_waqi_info') | int) >= 51)  and ((states('sensor.api_waqi_info') | int) <= 100) %}#ffde33
         {% elif ((states('sensor.api_waqi_info') | int) >= 101) and ((states('sensor.api_waqi_info') | int) <= 150) %}#ff9933
         {% elif ((states('sensor.api_waqi_info') | int) >= 151) and ((states('sensor.api_waqi_info') | int) <= 200) %}#cc0033
         {% elif ((states('sensor.api_waqi_info') | int) >= 201) and ((states('sensor.api_waqi_info') | int) <= 300) %}#660099
         {% elif ((states('sensor.api_waqi_info') | int) > 300) %}#7e0023
         {% else %}#ffffff
         {% endif %}
         
2. File automations.yaml:
- id: '1703280435999'
  alias: AWTRIX Aqi
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /2
  condition: []
  action:
  - service: mqtt.publish
    data:
      qos: '0'
      retain: false
      topic: awtrix_565c3c/custom/airquality
      payload: '{ "text": "pm:{{ states(''sensor.api_waqi_info'') }}", "color": "{{
        states(''sensor.api_waqi_color_text'') }}", "textCase": 2, "icon": "56366",  "repeat":
        2,   "duration": 5  }'
  mode: single