Integrate and visualise Oz allergy forecasts in Home Assistant.
It's best if you install and manage this custom component via HACS. HACS opens up a whole world of options so it's really worth setting up if you haven't already.
HACS is also the best way to install and manage another requirement for this project - The custom Button card is the backbone of the Lovelace "card" for this project (image above). Button Card is really cool of itself too so this is really nice to have anyway. It's only required for the "card visual", not the actual sensor data.
Now for actual installation. Follow any prompts and associated documentation as required. Some steps require restarts. If you get stuck anywhere try a restart.
- Install HACS
- Install Button card (Using HACS installation method is recommended)
- Install this custom component using HACS (currently uses "custom repository" method). HACS > Integrations > Top right three dots > Custom Repositories: Repository = https://github.com/OkhammahkO/oz-poll, Category = Integration
- Then configure the sensor (below). Restart. After this stop and check your sensor is showing up in HA. You'll (hopefully) see most of the data is currently stored in the attributes of the sensor (state contains current allergen level).
- Now you can set up the Lovelace card if you like (See Lovelace Configuration section)
- Maybe build yourself some automations and alerts! Maybe ask on the forum if you want tips/examples.
In your configuration.yaml
sensor:
- platform: oz_poll
url_website: AskOnHAForum
url_api: AskOnHAForum
i_subscribe_and_support: false
Name | Default | Description |
---|---|---|
url_website |
Required | Ask around or guess it. |
url_api |
Optional | More data is available for subscribers. Ask around about this. Remove this whole entry if not in use (don't leave blank). |
i_subscribe_and_support |
Required. Default: false |
Change to true if you are a paid user and are using the url_api. |
The card uses Button Card Configuration Templates to reduce code repetition and make maintenance and changes easier.
- Paste the code for the template section from lovelace_card.yaml into the "root" of your lovelace config. If you use the UI you go to the "Raw configuration editor".
- Paste the code for the card part from lovelace_card.yaml into a view where you want it to appear.
See below for more hints on this.
#This is the "root" of your lovelace config"
#....the template code you want to copy starts like this...
button_card_templates:
pollen_data_regional_today:
entity: sensor.oz_poll_allergy_forecast
state_display: |
#....then there's more code...
label:
- font-weight: bold
- font-size: clamp(8px, 0.7vw, 10px)
- color: white
#...then the template code eventually ends ...
#...and then say later in your lovelace config in a view of your choice...
title: Home
views:
- title: Pollen
path: pollen
badges: []
cards:
#...you paste the actual "card", which starts like this...
- type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
template: pollen_forecast_days
variables:
forecast_day: 0
#...code goes on for a while...
if (states['sensor.oz_poll_allergy_forecast'].attributes.pollen_forecast.asthma_data_regional_today[0].value == 'High')
return 'orange';
if (states['sensor.oz_poll_allergy_forecast'].attributes.pollen_forecast.asthma_data_regional_today[0].value == 'Extreme')
return 'red';
else
return 'grey';
]]]
#...then the code eventually ends...
Q: Does this work for location X in Oz? A: Maybe. Maybe not. Give it a go.
I'm not a programmer and this is both my first HA integration and proper GitHub project. I'm just some dude fumbling through some new things. So don't expect a pro set-up, implementation, and maintenance regime;) I'll entertain bug and feature requests, but well there will be effort and skill based limits to what I can do.
This code and GitHub project contains no direct references to data sources. You are responsible for informing yourself of any relevant terms of use before activating the integration by adding the actual sources. The code author proudly supports research into this area via paying for a subscription and encourages you to do the same.