Airly custom integration - air quality data

Airly custom integration

This integration is deprecated

Home Assistant 0.101 and newer includes official Airly integration. Differences between the official and custom version:

  • no configurable scan_interval
  • no API messages in Polish language
  • some sensors are represented in air_quality entity These differences result from the requirements for official integrations. You can still use the custom version of component. If you want to use the official version, remove integration from Configuration -> Integrations and component files from the /config/custom_components folder and restart Home Assistant.

The integrationt collects data from Airly API to present air quality data as sensors in Home Assitant.
You can add this to Home Assistant via Configuration -> Integrations -> Add -> Airly or configuration.yaml file. You can add this integration several times for different locations, e.g. home and work.

To generate api_key go to Airly for developers page.


You can install component:

Minimal configuration

  - platform: airly
    api_key: !secret airly_api_key

Custom configuration example

  - platform: airly
    name: 'Home'
    api_key: !secret airly_api_key
    latitude: !secret latitude
    longitude: !secret longitude
    language: 'pl'
    scan_interval: 300
      - pm1
      - pm25
      - pm10
      - caqi
      - description


key optional type default description
name True string Airly name of the integration
api_key False string Airly API key
latitude True string latitude from HA config latitude of the location to monitor
longitude True string longitude from HA config longitude of the location to monitor
language True string en language, available en and pl
scan_interval True integer 600 rate in seconds at which Airly should be polled for new data
monitored_conditions True list all available list of monitored conditions, available: pm1, pm25, pm10, caqi, temperature, humidity, pressure, description
1 Like

Good job, there is no sensor near me in Lublin, but I wait patiently :).

Thank you so much @Bieniu !
Is it possible to make pl language if Airly added via official integration (Configurator -> Integrations) ?

Airly is available in HA 0.101 as official integration and strings of config_flow dialogs have translated.

Is there an option to configure official module via configuration.yaml?

No, only via Integrations (config_flow).

I wold like for the Airly to show the air quality index and the color as they show on their map stations, can you help with indications in this direction, please? The integration show now by default few words about air quality and parameters are available if click on the Airly window.

Hi @Bieniu, great job with Airly plugin, thanks for your work!

The default Airly API request limit per day is 100, which means we could do requests every 15 mins.
However, default refresh rate in homeasistant Airly Integration is set to 10 mins.
This is causing that from ~6:30pm to 1am I don’t have any new Airly data as API returns 429 code.

Is there any quick fix I can do through configuration, or any chance to add new refresh rate config in Airly Integration frontend?

I’ve used Markdown card to display Airly data, example:

      - type: markdown
        title: Air quality
        entity_id: air_quality.airly
        content: |
          {{ states('air_quality.airly') }}
          {{ state_attr('air_quality.airly', 'advice') }}

          | | | |
          | --------- | -------- | -------- |
          | PM2.5 &nbsp; | **{{ state_attr('air_quality.airly', 'particulate_matter_2_5') }}** <small>µg/m³</small> &nbsp; | {{ state_attr('air_quality.airly', 'particulate_matter_2_5_percent_of_limit') }}<small>%</small> |
          | PM10  | **{{ state_attr('air_quality.airly', 'particulate_matter_10') }}** <small>µg/m³</small> &nbsp; | {{ state_attr('air_quality.airly', 'particulate_matter_10_percent_of_limit') }}<small>%</small> |



PR with a fix for that issue is waiting for review for 50 days. At the moment you can use custom version of the integration and change scan_interval in config flow options.

Thank you, I got the air quality index number showed in the card.

OK, great. Looking forward to the fix!
If there is anything I can help with to speed things up please let me know (e.g. I can help with GIT, or create an issue so then this PR can be attached to it, as a fix - if that helps anything?).

Fix is ready but I’m not sure if my solution will be accepted. You can create the issue, maybe this speed up the review.

Issue created:

We could create more future proof solution - I guess allowing to pass custom refresh rate for each Airly integration would be the best. In case Airly API changes the limit again, it would not require another PR.

Configurable scan_interval for integrations with config_flow is not allowed (besides few exceptions).

Why is that? Why such a rule? Where are those rules written?

If so, then I guess I’d prefer an integration that does not use config_flow.
In configuration.yaml it’s common to have refresh rate configured…

Don’t ask me, I’m not a core dev. I’ve read about this on the developer chat. I think the reason is that the official integration with config_flow has to be as friendly as possible for a non-technical user.