Created At
Jun 14, 2019
Created By Marcin Ćwięk
Get instant information about air quality using Airly API 2.0
Created At
Jun 14, 2019
Last Update
Jul 01, 2019
Platforms
HC 2
Views
4174
Download
167
Device featuresPeriodic reports on air quality for a defined location. Be warned about the smog conditions at your place instantly. Advantages for everyone
|
labelConfig
).Read comments in Lua scene and VD main loop.
Each configuration parameter is described there in details.
Get one from developer.airly.eu. When you register an account within that website you will get your free API key.
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.
labelConfig
variable in VD main loop. There is the same string formatting as for the Lua print function.The mobile app does not interpret HTML tags. If you prefer to have nice labels over there you need to neglect to have line breaks and colors with the desktop app. To achieve that simply replace labelConfig variable with this one: local labelConfig = { Index = { "%.0f", {"I:"..INDEX_TYPE..":v"} }, Smog = { "%s", {"I:"..INDEX_TYPE..":metaDescription"} }, Description = { "%s", {"I:"..INDEX_TYPE..":description"} }, Advice = { "%s", {"I:"..INDEX_TYPE..":advice"} }, PM1 = { "%.0f µg/m³ (%.0f%%)", {"V:PM1:v", "S:PM1:percent"} }, PM10 = { "%.0f µg/m³ (%.0f%%)", {"V:PM10:v", "S:PM10:percent"} }, PM25 = { "%.0f µg/m³ (%.0f%%)", {"V:PM25:v", "S:PM25:percent"} }, Weather = {"%.1f °C %.0f hPa %.0f %%", {"V:TEMPERATURE:v", "V:PRESSURE:v", "V:HUMIDITY:v"}, empty = "--" }, Station = { "%s (ID: %d)", {"N:sponsor:name", "N:id"}, empty = "--" }, Address = { "%s %s", {"N:address:displayAddress1", "N:address:displayAddress2"}, empty = "--" }, Distance = { "%d m", {"N:distance"} }, UpdateTime = {"%s (pobrano %s)", {"tillDateTime", "nowTimeOnly"} }, }
A może wysyłać push kiedy wykryje, że smog jest wysoki ?
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
Witam Nie będzie może pan robił wersję na HC3
Działa pięknie tylko na telefonie w apce wyświetla dziwne znaki.