Created At

Jun 14, 2019

Last Update

Jul 01, 2019


HC 2





Device features

Periodic reports on air quality for a defined location. Be warned about the smog conditions at your place instantly.

Advantages for everyone

  • Automatic status update. Custom interval value for update queries. Manual update is also available (via button).
  • May use "interpolation mode" (enabled by default in Lua scene). Airly gives you an option to calculate estimated values for any location near their stations, to see more then just what is exactly measured by the station.
  • You may select the language used for Airly messages. Polish and English are supported.
  • Colors to visualize Smog description. This will work on PC only. The mobile app does not interpret HTML tags.
  • Icon color is changing according to air quality measured. The colors are in correspondence with Airly recommendations.
  • One of three different air quality indexes from Airly might be selected. Airly supports: "AIRLY_CAQI", "CAQI" and "PIJP". Each may have different levels, descriptions, and pieces of advice.
  • Customizable location for reports. The location might be read automatically from your Home Center box or it might be set as a fixed one.
  • Data retrieved from Airly are stored in a global variable. The variable might be used to trigger another scene.

Advantages for geeks

  • Using the newest API 2.0.
  • Missing pieces of data from Airly are properly detected and do not stop the device from working.
  • No label "flickering" ("50%" → "missing data" → "52%", e.g.) on data updates. Changes on any update are reported once.
  • Clear information about the license (MIT). Make any changes you want, distribute, sell or whatever. Just include my name and the copywrite information.
  • Easy to change labels content, data grouping within labels, etc. (data selectors within one config variable labelConfig).
  • Source code easy to maintain and develop: rich debug information; separation of acquisition, extraction and data presentation, etc.


  1. Import the virtual device and create a new Lua scene with the code provided in the file.
  2. Add device icons and update their IDs in the virtual device main loop.
  3. Replace 'xxx...x' with the key you can get from Airly free of charge.
  4. Start the Lua scene manually (just for the first time).
  5. (optional) Customize: update interval, display language, labels content and many more (see details below).


Read comments in Lua scene and VD main loop. 
Each configuration parameter is described there in details.

Zip file content

  • Virtual device: "Airly Status".
  • Lua scene for grabbing data from Airly: "Airly Status scraper".
  • Nine device icons to visualize air quality.
  • Screenshots.


How can I get Airly API key?

Get one from When you register an account within that website you will get your free API key.

How to upload/add device icons?

  1. Open (any) virtual device configuration page.
  2. Press "Change icon".
  3. Press "Select file" (in the bottom), choose file, then confirm with "Add" button (even lower).

Please make sure to execute step 1 properly. Icons in Home Center are divided into 4 categories. If your icons are placed not in the "virtual device collection", they will not be visible for the device.

How can I get an icon ID?

  1. Open (any) virtual device configuration page.
  2. Press "Change icon".
  3. Right click on the icon you want to get an ID. Select "Open graphics in a new tab". The address should be like: "http://hc2/fibaro/n_vicons/User1003.png". 1003 is your ID in this case.

How can I change the language for all displayed information?

  1. Change config variable in Lua scene. Only "pl" and "en" messages are supported by Airly API.
  2. Update display name of each label.
  3. Update labels content (if needed) by editing labelConfig variable in VD main loop. There is the same string formatting as for the Lua print function.

7 Comments,  Want to add comment please login

Hej, czy to możliwe że dla Gdyni to nie działa?? ustawiłem fixed lokalizacje Pana i wszystkie dane są... a w Gdyni zwiększam dystans nawet do 1000 km i nic,...


Pewnie tak. Póki co jednak jestem dalej na HC2, przesiadkę planuje tak w okolicach wakacji - zatem nie szybko.


Witam Nie będzie może pan robił wersję na HC3


Sure. The device stores all retrieved data in a global variable. You can create very simple Lua scene on any condition and action you like. For detecting high pollution you could do: --[[ %% properties %% events %% globals AirlyStatus --]] local data = json.decode(fibaro:getGlobalValue("AirlyStatus")) if data.action == nil and data.indexes.AIRLY_CAQI.value > 75 then fibaro:debug("Very bad air") -- send push here or anything you need... end


A może wysyłać push kiedy wykryje, że smog jest wysoki ?