OK thanks. The scrape version is working so no rush.
Hi
New release is out with Canberra fixes (issue actually would have affected other locations too).
Let me know how you get on.
I’ll also PM you about api options.
Great HACS integration. Love it. I use this sensor in my config.yaml and it works fine with Melbourne. I’m not really a coder so I don’t know how to create a sensor the astha warnings? Any advice would be greatly appreciate. Cheers.
You can create your own sensors as required by navigating down the attribute tree to specific values (admittedly the example below is a little complex with the use of selectattr() and map().
Paste this into Developer Tools > Template
{{
(states['sensor.oz_poll_allergy_forecast'].attributes.allergy_forecast_web.asthma_data_regional_today.regional_data| selectattr('region', 'equalto', 'Central') | map(attribute='value') | first)
}}
Have a play around…
(states['sensor.oz_poll_allergy_forecast'].attributes.allergy_forecast_web.asthma_data_regional_today.regional_data[1])
{
"region": "East Gippsland",
"value": "Low"
}
Then you can use it in a sensor like this:|
sensor:
- platform: template
sensors:
central_asthma_risk:
friendly_name: Central Asthma Risk
value_template: >-
{{
(states['sensor.oz_poll_allergy_forecast'].attributes.allergy_forecast_web.asthma_data_regional_today.regional_data| selectattr('region', 'equalto', 'Central') | map(attribute='value') | first)
}}
What is the best way to update ??
Do you get a little update banner when you head into HACS? Follow that.
It is now, wasn’t a couple of hours ago.
I haven’t done any of the dashboard stuff but the sensors seem to work.
If I add the api info to the config I don’t get any addition data.
Yeah I think you might need to force a refresh sometimes.
Hmmm that’s quite surprising… You have the third config option set to true?
OK, adding that gives me heaps of sensors !! I think I’ll stick with the minimal non-api version.
@Mahko_Mahko have you tested with 2023.11?
I am getting errors since updating…
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'allergy_forecast_api' homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'allergy_forecast_api'
Yes, working ok for me in 2023.11.1.
Is that error in the logs?
Can you still see the sensor entity and it’s data in developer tools> state?
I am on V0.05 and am seeing an update to test1 in HACS ?
BTW, it is working with 2023.11.2.on my test system.
I updated to test1 in HACS so maybe it’s that?
Yes, that is in the logs.
This works:
The pollen level today is {{
(states['sensor.oz_poll_allergy_forecast'].attributes.allergy_forecast_web.pollen_data_regional_today.regional_data| selectattr('region', 'equalto', 'Melbourne') | map(attribute='value') | first)
}}
The thunderstorm asthma risk today is {{
(states['sensor.oz_poll_allergy_forecast'].attributes.allergy_forecast_web.asthma_data_regional_today.regional_data| selectattr('region', 'equalto', 'Central') | map(attribute='value') | first)
}}
V0.5 should be the one to be on. test1 is something I was tinkering with. It should be the same as V0.5 though basically.
Is it still working for you otherwise though? ^^^^^^^^^^^
Is the error just on a restart?
I suspect maybe just some jinja isn’t rendering when the sensor values aren’t yet present and it throws an error. Or maybe you have some old Jinja templates somewhere that needs updating to the new data schema.
I’ve been using your original method for pollen observation for a while now, and just found your add-on.
Have you got a config example for Melbourne that you can share, although I’m getting no reponse from https://api.pollenforecast.com.au/ so that might not be helping my cause at the moment!..
I’ve just PM’d you some details. Cheers.
Any reason anyone can see why this has stopped working:
- resource: https://www.melbournepollen.com.au/
scan_interval: 3600
name: Pollen Forecast
sensor:
- unique_id: melbourne_pollen_count
name: Pollen Count
select: '#plevel'
value_template: '{{ value| trim}}'
attributes:
- name: Forecast Date
select: '#pdate.pollen-date'
value_template: '{{ value| trim}}'
- 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 %}
It was working on 15/02/24 but has been unknown since then even though the website says LOW