I kinda want to share my janky (and unfinished) approach:
I use the hacs integration to get the entities and I integrate everything into the lovelace like this:
type: custom:vertical-stack-in-card
cards:
- type: glance
title: 'Pollenflug:'
entities:
- entity: sensor.pollenflug_ambrosia
- entity: sensor.pollenflug_beifuss
- entity: sensor.pollenflug_birke
- entity: sensor.pollenflug_erle
show_state: false
state_color: true
- type: glance
entities:
- entity: sensor.pollenflug_esche
- entity: sensor.pollenflug_graeser
- entity: sensor.pollenflug_hasel
- entity: sensor.pollenflug_roggen
state_color: true
show_state: false
To get the custom icons I downloaded the plant icons as svgs from a different integration (for some scandinavian pollen card, but I dont know which one anymore. But thanks to that creator! Here a download for the people who like the icons). I extracted the svgs (added the rye and deleted the allergens that hat no matching sensor). Then I used the custom icon feature of the “Fontawesome icons” integration (created a Folder named “custom_icons” in the config and dropped the svgs in there).
Then I added the following lines in the customize.yaml
:
sensor.pollenflug_ambrosia:
icon: fapro:ambrosia
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_beifuss:
icon: fapro:beifuss
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_birke:
icon: fapro:birke
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_erle:
icon: fapro:erle
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_esche:
icon: fapro:esche
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_graeser:
icon: fapro:gras
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_hasel:
icon: fapro:hasel
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
sensor.pollenflug_roggen:
icon: fapro:roggen
templates:
icon_color: >
if (state === '0') return '#5ebf0f';
if (state === '0.5') return '#a8bf0f';
if (state === '1') return '#bfb10f';
if (state === '1.5') return '#bf900f';
if (state === '2') return '#bf730f';
if (state === '2.5') return '#bf4a0f';
if (state === '3') return '#bf0f0f';
Maybe you can see now where it doesnt work as I hoped. Theoretically the icons should be colored in hues from green over yellow to red with pollen intensity but I couldn’t get the custom coloring to work.
I kinda put this project aside 'til maybe spring when pollen will become a problem, or until I stumble upon a solution. Maybe one of you can help me fix it.
Edit: you have to install custom-ui and remove one = from the code then it works (thanks MangoMC for the troubleshooting)