Last active
January 26, 2017 20:56
-
-
Save kubawolanin/317f07a763795ea5480b49a120504f88 to your computer and use it in GitHub Desktop.
openHAB Air Quality Index measurement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Number AirQualityIndex "AQI" | |
String AirQuality "Air Quality [SCALE(airquality.scale):%s]" | |
Switch AirQualityRerun "Measure AQI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rule "Test AirQuality" | |
when | |
Time cron "0 0 * * * ?" or | |
Item AirQualityRerun received command ON | |
then { | |
var String coordinates = "37.14360;-115.482399" | |
var String token = "YOURTOKEN" | |
var response = sendHttpGetRequest("http://api.waqi.info/feed/geo:" + coordinates + "/?token=" + token, 3000) | |
var aqi = transform("JSONPATH","$.data.aqi", response.toString) | |
AirQualityIndex.postUpdate(aqi) | |
AirQuality.postUpdate(aqi) | |
AirQualityRerun.postUpdate(OFF) | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-=No data | |
[0..50]=Good | |
[51..100]=Moderate | |
[101..150]=Unhealthy for Sensitive Groups | |
[151..200]=Unhealthy | |
[201..300]=Very Unhealthy | |
[300..]=Hazardous |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-=Brak danych | |
[0..50]=Dobra | |
[51..100]=Średnia | |
[101..150]=Niezdrowa dla osób wrażliwych | |
[151..200]=Niezdrowa | |
[201..300]=Bardzo niezdrowa | |
[300..]=Zagrożenie dla życia |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment