Created At

Jun 14, 2019

Last Update

Jul 01, 2019

Platforms

HC 2

Views

4173

Download

167

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.

Installation

  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).

Configuration

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.

FAQ

How can I get Airly API key?

Get one from developer.airly.eu. 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.

14 Comments,  Want to add comment please login
Da54c20566015cb188b16106e0cb981e

Na dole komentarzy tutaj jest też opis jak zrobić, żeby działało mobilnie (za cenę prostych opisów na PC).

9bca395bfc0b7d127ee554e8321f722b

PS. Sorki za pytanie, w opisie znalazłem odpowiedź na którą wcześniej nie zwróciłem uwagi.:"This will work on PC only. The mobile app does not interpret HTML tags".

9bca395bfc0b7d127ee554e8321f722b

Teraz zrozumiałem, dziękuję za wyjaśnienie. Mam jeszcze kolejne pytanie, czy w aplikacji mobilnej stan zanieczyszczenia powinien pokazywać się tak jak poprzez http jako kolorowa ikona ?. U mnie jest standardowa ikona sześcioboku i dane tekstowe.

Da54c20566015cb188b16106e0cb981e

Wszystko gra, Tak jak jest napisane w komentarzu obok wskazanej zmiennej - pobranie kompletu informacji wymaga trzech zapytań.

9bca395bfc0b7d127ee554e8321f722b

Rozumiem, oczywiście zmienię tą wartość, tylko że poprawnych zapytań i odpowiedzi tej nocy pomiędzy 01:14:48 a 09:34:16 było jedynie 33 a nie 100 więc i tak coś tu nie gra.

© 2024. Nice-Polska Sp. z o.o.Privacy policyTerms & ConditionsFeedback