Create entity based other entity values

You don’t have an expression to retrieve the values for the variables you are assigning to i.e. a1pm25. Either get rid of the set statements or add an expression at the end.

Also, if you aren’t going to assign a default value for the float filter, you should really set an availability:

...
      - name: "aiq1 pm25 cat"
        state: >
          {% set a1pm25 = states('sensor.aiq1_h1_pm2_5') | float %}
          {% if 0 <= a1pm25 < 9 %}
            1
          {% elif 9 <= a1pm25 < 35.4 %}
            2
          {% elif 35.4 <= a1pm25 < 55.4 %}
            3
          {% elif 55.4 <= a1pm25 < 125.4 %}
            4
          {% elif 125.4 <= a1pm25 < 225.4 %}
            5
          {% elif a1pm25 >= 225.4 %}
            6
          {% else %}
            {{ a1pm25 }}
          {% endif %}
        availability: "{{ has_value('sensor.aiq1_h1_pm2_5') }}"