Air quality in Norway

I’m using the web scraper platform to get some data from the real time air quality sensors in Norway via www.luftkvalitet.info. There are heaps of them all over the place, so you would only need to change some of the links here to get your city. I’d love for someone to improve this so it could trigger on unhealthy levels.

sensors.yaml:

- platform: scrape
  name: O³
  resource: http://www.luftkvalitet.info/home/overview.aspx?type=Station&id={9f6b3149-209a-4e02-836c-c865c5e306f6}
  select: "td:nth-of-type(8)"
  unit_of_measurement: 'µg/m³'

- platform: scrape
  name: NO²
  resource: http://www.luftkvalitet.info/home/overview.aspx?type=Station&id={9f6b3149-209a-4e02-836c-c865c5e306f6}
  select: "td:nth-of-type(14)"
  unit_of_measurement: 'µg/m³'

- platform: scrape
  name: SO²
  resource: http://www.luftkvalitet.info/home/overview.aspx?type=Station&id={9f6b3149-209a-4e02-836c-c865c5e306f6}
  select: "td:nth-of-type(20)"
  unit_of_measurement: 'µg/m³'

- platform: scrape
  name: PM25
  resource: http://www.luftkvalitet.info/home/overview.aspx?type=Station&id={4c308d8e-dba8-4f9f-8730-f083da14ae01}
  select: "td:nth-of-type(8)"
  unit_of_measurement: 'µg/m³'

- platform: scrape
  name: PM10
  resource: http://www.luftkvalitet.info/home/overview.aspx?type=Station&id={4c308d8e-dba8-4f9f-8730-f083da14ae01}
  select: "td:nth-of-type(14)"
  unit_of_measurement: 'µg/m³'

groups.yaml:

air_quality:
  name: Air Quality Oslo
  view: no
  icon: mdi:jquery
  entities:
    - sensor.o3
    - sensor.no2
    - sensor.so2
    - sensor.pm25
    - sensor.pm10

Keep healthy!

4 Likes

How do you target the values?

I tried to do the same on this page http://goteborg.se/wps/portal?uri=gbglnk%3Agbg.page.66289f63-5959-4215-9029-bb8f6c3a3844 but i am not able to target correct attributes and values.

Honestly, the scrape sensor is pretty finicky to get working. I just ended up making like 20 sensors, and changing the variables a little in each of them, to see which ones got closer. I think someone here would be able to help with scraping much more than me, I just brute forced it.

Aren’t these stations also available through www.waqi.info? There already is a platform for their api.

Unfortunately there is no measurements even close to Gothenburg with waqi

Hey, that looks perfect! Even better! Thanks for that :slight_smile:

@Parihaka Do you have Waqi working for your stations?

I cant get it to work.

UPDATE:
Got it working like this:

  - platform: waqi
    token: 8f28blablabla32a
    locations:
      - mystation, mytown, mycountry

Ah, beat me to it. Glad you have it working!

I have had the Nilu - Norsk institutt for luftforskning (Norwegian Institute for Air Research), sensor code running for some time now, and it works fine.

Check it out here: