OzPoll - Australian Pollen Forecast (Integration)

Looks like it might be broken again.

Hopefully I’ll have some time on the weekend to work on a fix.

So the unoffcial API these sensors use no longer appears to be being updated.
So it’s an API issue beyond my control rather than a code issue.

I’m digging around for alternative data sources but haven’t been able to find anything yet.

For those that are keen you could try to resurrect the webpage scraper approach to get just today’s info from the webpage (code may need modifications).

Validating the API results against the app show that the api results appear to be incorrect (always showing “Low”.

FYI @oneseventhree

Ahh thats a shame. I did see there is a version 6 now:
https://api.pollenforecast.com.au/app/json/app_data.php?app=2&version=6

I was using this:

 scan_interval: 3600 #3600 sec = hr
  name: Pollen Forecast
  sensor:
    - unique_id: melbourne_pollen_count
      name: Pollen Count
      select: '#district-pollen-div > div > div > div > div > div > div.uk-grid-match.uk-child-width-1-2\@s.uk-text-center.uk-grid-collapse.uk-grid > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div'
      value_template: '{{ value| trim}}'
      attributes:
        - name: Website Last Updated
          select: '#district-pollen-div > div > div > div > div > div > div.uk-grid-match.uk-child-width-1-2\@s.uk-text-center.uk-grid-collapse.uk-grid > div:nth-child(1) > div.ta-notice'
          value_template: "{{ value| replace('Last updated:', '')}}"
      icon: >-
        {% if value == 'Low' %}
          mdi:emoticon-happy
        {% elif value == 'Moderate' %}
          mdi:emoticon-neutral
        {% elif value == 'High' %}
          mdi:emoticon-sad
        {% elif value == 'Extreme' %}
          mdi:emoticon-angry
        {% else %}
          mdi:help-circle
        {% endif %}

but its showing central and not:

Is there anyway to scrape that section instead?
I tried and couldn’t figure it out when trying to put it in the code above

Yeah I looked at version 6 too but same story.

I’ll probably look at getting the Melbourne scrape running for myself over the coming days, so I’ll keep you posted.

that would be great! thank you. The website hasn’t changed in a while so it should last :slight_smile:

Had to fiddle with the select but think I’ve got the following data fields.

multiscrape:
############################################################################
#Melbourne Pollen Forecast
###########################################################################
  - resource: https://www.melbournepollen.com.au/
    scan_interval: 3600 #3600 sec = 1 hr
    name: Pollen Forecast
    sensor:
      - unique_id: pollen_forecast_today_melbourne_grass
        name: Pollen Forecast Today Melbourne Grass 
        select: '#plevel'
        value_template: '{{ value| trim}}'
        attributes:
          - name: Forecast Date
            select: '#pdate.pollen-date'
            value_template: '{{ value| trim}}'
            # value_template: "{{ value| replace('Last updated:', '')}}"
          - name: Website Last Updated 
            select: '#district-pollen-div > div > div > div > div > div > div.uk-grid-match.uk-child-width-1-2\@s.uk-text-center.uk-grid-collapse.uk-grid > div:nth-child(1) > div.ta-notice'
            value_template: "{{ value| replace('Last updated:', '')}}"
        icon: >-
          {% if value == 'Low' %}
            mdi:emoticon-happy
          {% elif value == 'Moderate' %}
            mdi:emoticon-neutral
          {% elif value == 'High' %}
            mdi:emoticon-sad
          {% elif value == 'Extreme' %}
            mdi:emoticon-angry
          {% else %}
            mdi:help-circle
          {% endif %}

Seems to work for me! Thanks for the quick response. Hopefully we can test it out soon when the warmer weather comes!

1 Like

The “card” for this still seems to work too. Just adjust the sensor and attribute names in the Lovelace config.

1 Like

Edit: in reference to the screen scraping approach

Since the Melbourne area has its own little carve out and isn’t in that large table, how would I grab the values from the first tile that appears on the page? I think it’s represented there?

Did you have a crack at this for it?

I have a whole new approach cooking but it probably won’t be ready to share for a few weeks.

Oh hang on, did you see this?

1 Like

Hey Guys, really well done on figuring this out!

Is there any chance you could please help me with scrapping data for Northern Country?

Thank you,

Sure. What have you tried so far?

well, I couldn’t figure out how
I’m not a web dev but to me, I thought this page was dynamic with js code to load first the city in the widget.

this is what I tried but I cant get it to work from the image to the side of the NORTHERN COUNTRY

sensor:
  - platform: rest
    resource: https://www.melbournepollen.com.au/ 
    name: Northern Country Pollen Level
    scan_interval: 3600 
    value_template: '{{ value_json.pollen_level }}'
    json_attributes:
      - pollen_level
    selector: "#district-pollen-div > div > div > div > div > div > div.uk-grid-match.uk-child-width-1-2\@s.uk-text-center.uk-grid-collapse.uk-grid > div:nth-child(2) > div:nth-child(6)"

Canberra version is working with just a change to resource, the site does not have a ‘last updated’ entry so I have commented that out.

I should have something fancy for you in the next few weeks. Stay tuned;)

I think you were close. I think this works. Give it a go…

multiscrape:
  - resource: https://www.melbournepollen.com.au/
    scan_interval: 3600 #3600 sec = 1 hr
    name: Pollen Forecast
    sensor:
      - unique_id: northern_country_forecast_today
        name: Pollen Forecast Today
        select: '#district-pollen-div > div > div > div > div > div > div.uk-grid-match.uk-child-width-1-2\@s.uk-text-center.uk-grid-collapse.uk-grid > div:nth-child(2) > div:nth-child(6) > div:nth-child(2) > div'
        value_template: '{{ value| trim}}'
        icon: >-
          {% if value == 'Low' %}
            mdi:emoticon-happy
          {% elif value == 'Moderate' %}
            mdi:emoticon-neutral
          {% elif value == 'High' %}
            mdi:emoticon-sad
          {% elif value == 'Extreme' %}
            mdi:emoticon-angry
          {% else %}
            mdi:help-circle
          {% endif %}

You do it like this…

that worked! thank you!

1 Like

Thanks I thought I was doing something wrong but it was as simple as making it
select: ‘#plevel

1 Like

If anyone wants to test my new custom integration, PM me for details once you’ve read the Github details. Cheers.

image

2 Likes