Air Quality Binding - looking for testers

@AndrewZ check your configuration in *.things file or in PaperUI. I checked my own configs just now and everything seems to run smoothly.

Air Quality Binding is now a part of openhab2-addons!

Thank you everyone for testing, improving and reviewing my code!
You no longer need to place a JAR file - just update your openHAB! :sunglasses:


Regarding the binding itself, a few breaking changes:

  1. Location configuration no longer understands semicolon - you need to use comma instead (which is now compliant with other bindings)
  2. I’ve removed stationUrl channel - I couldn’t find any reason to keep it. Let me know if you find any use case for it!
  3. Aqi_StationGeo item (and stationLocation channel) is now a Location element (instead of String) which allows you to display it on a map
2 Likes

@kubawolanin I’m using the same configuration for quite some time already and this error appears sporadically. I suppose this is how binding reacts to the invalid response from the server. I’ll probably need to keep debug on for a longer period.

I have updated to unstable Build #789 but the new binding is not available in Paper UI and it doesn’t install through my addons.cfg. What’s wrong?

I’m on build #798 - my binding is there :slight_smile:

I did a sudo apt-get update && sudo apt-get upgrade and the latest build was 789 (in the karaf screen). That’s weird.

You might have missed The Linux snapshot installation repo has moved!?

1 Like

Hello!

I’ve just installed Air Quality Binding and registered on their site, but I’m unable to find Station ID there. I would like to use the binding with the Station ID, rather then geolocation, because there is a significant difference in the air pollution between stations (and neighborhoods). Namely, I would like to find the Station ID for Sarajevo, Otoka station.

Best regards,
Davor

How to manually get Station ID of Air Quality Index

@davorf yeah, I didn’t find any convenient way to get Station ID from AQIcn.
If you’d like to get your hands dirty, you can go diretly to the measurement URL, eg

And then you need to view source of the page by either Ctrl + U or right click and “View source” option.

After that, search for aqisrv.obs(' string.
9272 should be your Station ID :slight_smile:

I’ll contact AQIcn and see if they offer any API for getting Station ID easily.

Cheers,
K

1 Like

Hello!

Thank you for the information. And thank you for all the work on this binding.

Best regards,
Davor

I have an item definition like this:

Location Aqi_StationLocation "Meetstation locatie [%s]" <text> (gAirQuality) { channel="airquality:aqi:home:stationLocation" }

The channel is updated, but the item stays at NULL and is never updated.

The debug log shows the channel as a String type, not location:

13:49:13.320 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel stationLocation with state 4.58007,51.86942 (String)

Am I doing something wrong, or should I report an issue in the repo?

part of the log:

13:49:13.063 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Index changed from NULL to 54
13:49:13.065 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel aqiLevel with state 54 (Integer)
13:49:13.076 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel aqiLevel with state 54 (Integer)
13:49:13.094 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_Index-airquality:aqi:home:aqiLevel' has been added.
13:49:13.098 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Level changed from NULL to MODERATE
13:49:13.101 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel aqiDescription with state MODERATE (String)
13:49:13.119 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel aqiDescription with state MODERATE (String)
13:49:13.138 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_Level-airquality:aqi:home:aqiDescription' has been added.
13:49:13.144 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Pm25 changed from NULL to 54
13:49:13.145 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel pm25 with state 54 (BigDecimal)
13:49:13.155 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel pm25 with state 54 (BigDecimal)
13:49:13.172 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_Pm25-airquality:aqi:home:pm25' has been added.
13:49:13.179 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Pm10 changed from NULL to 19
13:49:13.178 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel pm10 with state 19 (BigDecimal)
13:49:13.189 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel pm10 with state 19 (BigDecimal)
13:49:13.211 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_Pm10-airquality:aqi:home:pm10' has been added.
13:49:13.212 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel o3 with state 9.6 (BigDecimal)
13:49:13.218 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_O3 changed from NULL to 9.6
13:49:13.225 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel o3 with state 9.6 (BigDecimal)
13:49:13.242 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_O3-airquality:aqi:home:o3' has been added.
13:49:13.249 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_No2 changed from NULL to 23
13:49:13.252 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel no2 with state 23 (BigDecimal)
13:49:13.262 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel no2 with state 23 (BigDecimal)
13:49:13.278 [DEBUG] [airquality.handler.AirQualityHandler] - Station doesn't provide CO measurement
13:49:13.281 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_No2-airquality:aqi:home:no2' has been added.
13:49:13.283 [DEBUG] [airquality.handler.AirQualityHandler] - Station doesn't provide CO measurement
13:49:13.291 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_Co-airquality:aqi:home:co' has been added.
13:49:13.295 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel locationName with state Hogeweg, Ridderkerk (String)
13:49:13.298 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_LocationName changed from NULL to Hogeweg, Ridderkerk
13:49:13.305 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel locationName with state Hogeweg, Ridderkerk (String)
13:49:13.318 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_LocationName-airquality:aqi:home:locationName' has been added.
13:49:13.320 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel stationLocation with state 4.58007,51.86942 (String)
13:49:13.332 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel stationLocation with state 4.58007,51.86942 (String)
13:49:13.346 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_StationLocation-airquality:aqi:home:stationLocation' has been added.
13:49:13.351 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel observationTime with state 2017-02-17T13:00:00.000+0100 (GregorianCalendar)
13:49:13.356 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_ObservationTime changed from NULL to 2017-02-17T13:00:00.000+0100
13:49:13.364 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel observationTime with state 2017-02-17T13:00:00.000+0100 (GregorianCalendar)
13:49:13.381 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'Aqi_ObservationTime-airquality:aqi:home:observationTime' has been added.
13:49:14.680 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_ObservationTime changed from NULL to 2017-02-17T13:00:00.000+0100
13:49:14.688 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel observationTime with state 2017-02-17T13:00:00.000+0100 (GregorianCalendar)
13:49:14.756 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_No2 changed from NULL to 23
13:49:14.766 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel no2 with state 23 (BigDecimal)
13:49:14.805 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_LastUpdate changed from NULL to 2017-02-17T13:46:49.821+0100
13:49:14.850 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_LocationName changed from NULL to Hogeweg, Ridderkerk
13:49:14.857 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel locationName with state Hogeweg, Ridderkerk (String)
13:49:14.873 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel stationLocation with state 4.58007,51.86942 (String)
13:49:14.948 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_O3 changed from NULL to 9.6
13:49:14.952 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel o3 with state 9.6 (BigDecimal)
13:49:14.966 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Level changed from NULL to MODERATE
13:49:14.975 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel aqiDescription with state MODERATE (String)
13:49:15.036 [DEBUG] [airquality.handler.AirQualityHandler] - Station doesn't provide CO measurement
13:49:15.054 [INFO ] [ome.event.GroupItemStateChangedEvent] - gAirQuality changed from 140 to UNDEF through Aqi_Pm10
13:49:15.056 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Pm10 changed from NULL to 19
13:49:15.060 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel pm10 with state 19 (BigDecimal)
13:49:15.113 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Index changed from NULL to 54
13:49:15.120 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel aqiLevel with state 54 (Integer)
13:49:15.163 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_LastUpdate changed from 2017-02-17T13:46:49.821+0100 to 2017-02-17T13:49:15.149+0100
13:49:15.246 [INFO ] [marthome.event.ItemStateChangedEvent] - Aqi_Pm25 changed from NULL to 54
13:49:15.252 [DEBUG] [airquality.handler.AirQualityHandler] - Update channel pm25 with state 54 (BigDecimal)

Hello @kubawolanin

I would like to make a MAP file for the air quality description, but I’m not sure what values does it return? Do you have a list of the possible descriptions? Thank you in advance.

Best regards,
Davor

Hey @davorf,
You can find them in the documentation:
http://docs.openhab.org/addons/bindings/airquality/readme.html#full-example

Cheers!
K

1 Like

Hello!

Thank you for the quick reply.

Best regards,
Davor

@kubawolanin it seems that this error is caused by the server response like this:

“aqi”:"-"

Kuba, could you please check and adjust the error handling if possible?
Thanks!

Hello @kubawolanin

I’ve just installed latest snapshot (2.1.0 nightly build #838), and the Air Quality Binding isn’t automatically installed (nor I could find it in the add-ons list). Do you know if it’s removed from the official build?

Best regards,
Davor

I installed air quality add-on as per the instructions on the bindings reference page. I am using the location settings for things. The airquality.things is parsed correctly but i don’t see any values. I am using the sitemap as in the documentation here2

i checked running the api directly with the key and the location settings and the it is returning the correct values.

In the logs, i don’t see the data getting queried. Do i have to any settings for scheduling the fetching of data?

@manu74 could you please enable debug for that binding from karaf console

Hi Andew,

I enabled debug logging for the airquality binding in karaf using the command below

openhab> log:set DEBUG org.openhab.binding.airquality

After that I edited the airquality.things configuration and reduced the frequency of update to 5 mins. The file is parsed correctly as shown below in the log.

16:26:44.026 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'airquality.things'

But i didn’t see any activity in the log file for this binding. I restarted openhab and still no information on loading of the binding or scheduling of the refreshing of data (how it shows for astro).

Not sure whether i am missing any important setup step. I rechecked my configuration against binding instructions and they seem to be fine.

@manu74 do you have the binding installed?

in your addons.cfg you should have airquality added on binding = line

i have the airquality in addons.cfg but while loading the bindings, it is not getting activated. Let me reinstall from scratch and check again