Request: can u make sensors from the forecasts?
Closed this issue · 4 comments
Hi,
I am trying to integrate the forecast into another card that was made by somebody else but i would like to get some help.
copy paste from the HA community:
You’ll need the Mushroom cards, stack-in-card, layout-card, grid-layout, bar-card and card_mod from HACS.
For those adding to your own dashboard, you’ll need to make a “toggle” (boolean) helper to enable the drop down graphs. Link to Helpers – My Home Assistant (home-assistant.io) 16
it works with entities like - entity: sensor.thuis_grass_pollen_day_1
and i would like to add this value:
- entity: {{ state_attr('sensor.kleenex_pollen_radar_thuis_gras',
'forecast')[0].value }}
But i am unable to get it working. (I have no experience with this nice frontend stuff)
I think it can not be done like that inside this card because it wants sensors. (please correct me if i am wrong)
Thanks in advance for any help in the right direction or making sensors of the values so it could be used in cards like this:
`type: custom:stack-in-card
title: EXPERIMENT
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: auto 33px
margin: '-4px -4px -10px -4px;'
cards:- type: grid
columns: 3
cards:-
type: custom:mushroom-template-card
primary: Grass pollen
icon: mdi:grass
layout: vertical
entity: sensor.kleenex_pollen_radar_thuis_gras
friendly_name: Grass Pollen Level (experiment)
icon_color: |-
{% if states(config.entity) | int <= 29 %}
green
{% elif states(config.entity) | int <= 60 %}
orange
{% elif states(config.entity) | int > 60 %}
red
{% endif %}
secondary: >-
Today: {{ state_attr('sensor.kleenex_pollen_radar_thuis_gras',
'current').level }}Tomorrow: {{ state_attr('sensor.kleenex_pollen_radar_thuis_gras',
'forecast')[0].level }}
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
multiline_secondary: true
card_mod:
style: |
ha-card {
background: none;
--ha-card-box-shadow: 0px;
} -
type: custom:mushroom-template-card
primary: Tree pollen
icon: mdi:tree
layout: vertical
entity: sensor.kleenex_pollen_radar_thuis_bomen
icon_color: |-
{% if states(config.entity) | int <= 95 %}
green
{% elif states(config.entity) | int <= 207 %}
orange
{% elif states(config.entity) | int > 207 %}
red
{% endif %}
secondary: >-
Today: {{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen',
'current').level }} Tomorrow: {{
state_attr('sensor.kleenex_pollen_radar_thuis_bomen',
'forecast')[0].level}}
double_tap_action:
action: none
tap_action:
action: more-info
hold_action:
action: none
multiline_secondary: true
card_mod:
style: |
ha-card {
background: none;
--ha-card-box-shadow: 0px;
} -
type: custom:mushroom-template-card
primary: Weed pollen
icon: mdi:spa
layout: vertical
entity: sensor.kleenex_pollen_radar_thuis_kruiden
icon_color: |-
{% if states(config.entity) | int <= 20 %}
green
{% elif states(config.entity) | int <= 77 %}
orange
{% elif states(config.entity) | int > 77 %}
red
{% endif %}
secondary: >-
Today: {{ state_attr('sensor.kleenex_pollen_radar_thuis_kruiden',
'current').level }}Tomorrow: {{
state_attr('sensor.kleenex_pollen_radar_thuis_kruiden',
'forecast')[0].level}}
double_tap_action:
action: none
tap_action:
action: more-info
hold_action:
action: none
multiline_secondary: true
card_mod:
style: |
ha-card {
background: none;
--ha-card-box-shadow: 0px;
}
-
- type: custom:mushroom-template-card
entity: input_boolean.adaptive_dropdown
primary: ''
secondary: ''
icon: >-
{{ 'mdi:chevron-up' if is_state(entity, 'on') else 'mdi:chevron-down'
}}
icon_color: disabled
hold_action:
action: none
card_mod:
style: |
ha-card {
align-items: flex-end;
background: none;
--ha-card-box-shadow: 0px;
}
mushroom-shape-icon {
--shape-color: none !important;
}
- type: grid
- type: conditional
conditions:- entity: input_boolean.adaptive_dropdown
state: 'on'
card:
type: vertical-stack
cards:- type: custom:bar-card
title: Grass pollen forecast
direction: up
columns: 5
height: 50px
width: 100%
min: 0
max: 200
positions:
icon: 'off'
name: outside
value: inside
severity:- color: Green
from: 0
to: 29 - color: Orange
from: 30
to: 60 - color: Red
from: 61
to: 999
animation:
state: 'on'
speed: 1
entities: - entity: sensor.kleenex_pollen_radar_thuis_gras
name: Today - entity: sensor.thuis_grass_pollen_day_1
name: Today +1 - entity: sensor.thuis_grass_pollen_day_2
name: Today +2 - entity: sensor.thuis_grass_pollen_day_3
name: Today +3 - entity: sensor.thuis_grass_pollen_day_4
name: Today +4
card_mod:
style: |-
.card-header {
--ha-card-header-font-size: 20px;
}
bar-card-backgroundbar {
background-color: transparent;
}
bar-card-name {
font-size: 12px;
font-weight: bolder;
color: #727272;
}
- color: Green
- type: custom:bar-card
title: Tree pollen forecast
direction: up
columns: 5
height: 50px
width: 100%
min: 0
max: 208
positions:
icon: 'off'
name: outside
value: inside
severity:- color: Green
from: 0
to: 95 - color: Orange
from: 96
to: 207 - color: Red
from: 208
to: 999
animation:
state: 'on'
speed: 1
entities: - entity: sensor.kleenex_pollen_radar_thuis_kruiden
name: Today - entity: sensor.thuis_tree_pollen_day_1
name: Today +1 - entity: sensor.thuis_tree_pollen_day_2
name: Today +2 - entity: sensor.thuis_tree_pollen_day_3
name: Today +3 - entity: sensor.thuis_tree_pollen_day_4
name: Today +4
card_mod:
style: |-
.card-header {
--ha-card-header-font-size: 20px;
}
bar-card-backgroundbar {
background-color: transparent;
}
bar-card-name {
font-size: 12px;
font-weight: bolder;
color: #727272;
}
- color: Green
- type: custom:bar-card
title: Weed pollen forecast
direction: up
columns: 5
height: 50px
width: 100%
min: 0
max: 200
positions:
icon: 'off'
name: outside
value: inside
severity:- color: Green
from: 0
to: 20 - color: Orange
from: 21
to: 77 - color: Red
from: 78
to: 999
animation:
state: 'on'
speed: 1
entities: - entity: sensor.kleenex_pollen_radar_thuis_kruiden
name: Today - entity: sensor.kleenex_pollen_radar_thuis_kruiden
name: Today +1 - entity: sensor.thuis_ragweed_pollen_day_2
name: Today +2 - entity: sensor.thuis_ragweed_pollen_day_3
name: Today +3 - entity: sensor.thuis_ragweed_pollen_day_4
name: Today +4
card_mod:
style: |-
.card-header {
--ha-card-header-font-size: 20px;
}
bar-card-backgroundbar {
background-color: transparent;
}
bar-card-name {
font-size: 12px;
font-weight: bolder;
color: #727272;
}
`
- color: Green
- type: custom:bar-card
- entity: input_boolean.adaptive_dropdown
i was able to do this by making sensors
- platform: template sensors: grass_pollen_forecast_1: friendly_name: "grass ollen Forecast 1" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_gras', 'forecast')[0].value }}" grass_pollen_forecast_2: friendly_name: "grass pollen Forecast 2" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_gras', 'forecast')[1].value }}" grass_pollen_forecast_3: friendly_name: "grass pollen Forecast 3" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_gras', 'forecast')[2].value }}" grass_pollen_forecast_4: friendly_name: "grass pollen Forecast 4" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_gras', 'forecast')[3].value }}" tree_pollen_forecast_1: friendly_name: "tree pollen Forecast 1" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen', 'forecast')[0].value }}" tree_pollen_forecast_2: friendly_name: "tree pollen Forecast 2" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen', 'forecast')[1].value }}" tree_pollen_forecast_3: friendly_name: "tree pollen Forecast 3" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen', 'forecast')[2].value }}" tree_pollen_forecast_4: friendly_name: "tree pollen Forecast 4" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen', 'forecast')[3].value }}" weed_pollen_forecast_1: friendly_name: "weed pollen Forecast 1" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_kruiden', 'forecast')[0].value }}" weed_pollen_forecast_2: friendly_name: "weed pollen Forecast 2" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_kruiden', 'forecast')[1].value }}" weed_pollen_forecast_3: friendly_name: "weed pollen Forecast 3" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_kruiden', 'forecast')[2].value }}" weed_pollen_forecast_4: friendly_name: "weed pollen Forecast 4" value_template: "{{ state_attr('sensor.kleenex_pollen_radar_thuis_kruiden', 'forecast')[3].value }}"
and put those in a card:
`type: custom:stack-in-card
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: auto 33px
margin: '-4px -4px -10px -4px;'
cards:- type: grid
columns: 3
cards:-
type: custom:mushroom-template-card
primary: Grass pollen
icon: mdi:grass
layout: vertical
entity: sensor.kleenex_pollen_radar_thuis_gras
friendly_name: Grass Pollen Level (experiment)
icon_color: |-
{% if states(config.entity) | float(0) <= 29 %}
green
{% elif states(config.entity) | float(0) <= 60 %}
orange
{% elif states(config.entity) | float(0) <= 341 %}
red
{% elif states(config.entity) | float(0) > 341 %}
brown
{% else %}
grey
{% endif %}
secondary: >-
Today: {{ state_attr('sensor.kleenex_pollen_radar_thuis_gras',
'current').level }}Tomorrow: {{ state_attr('sensor.kleenex_pollen_radar_thuis_gras',
'forecast')[0].level }}
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
multiline_secondary: true
card_mod:
style: |
ha-card {
background: none;
--ha-card-box-shadow: 0px;
} -
type: custom:mushroom-template-card
primary: Tree pollen
icon: mdi:tree
layout: vertical
entity: sensor.kleenex_pollen_radar_thuis_bomen
icon_color: |-
{% if states(config.entity) | float(0) <= 95 %}
green
{% elif states(config.entity) | float(0) <= 207 %}
orange
{% elif states(config.entity) | float(0) <= 703 %}
red
{% elif states(config.entity) | float(0) > 703 %}
brown
{% else %}
grey
{% endif %}
secondary: >-
Today: {{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen',
'current').level }}Tomorrow: {{ state_attr('sensor.kleenex_pollen_radar_thuis_bomen',
'forecast')[0].level }}
double_tap_action:
action: none
tap_action:
action: more-info
hold_action:
action: none
multiline_secondary: true
card_mod:
style: |
ha-card {
background: none;
--ha-card-box-shadow: 0px;
} -
type: custom:mushroom-template-card
primary: Weed pollen
icon: mdi:spa
layout: vertical
entity: sensor.kleenex_pollen_radar_thuis_kruiden
icon_color: |-
{% if states(config.entity) | float(0) <= 20 %}
green
{% elif states(config.entity) | float(0) <= 77 %}
orange
{% elif states(config.entity) | float(0) <= 266 %}
red
{% elif states(config.entity) | float(0) > 266 %}
brown
{% else %}
grey
{% endif %}
secondary: >-
Today: {{ state_attr('sensor.kleenex_pollen_radar_thuis_kruiden',
'current').level }}Tomorrow: {{
state_attr('sensor.kleenex_pollen_radar_thuis_kruiden',
'forecast')[0].level }}
double_tap_action:
action: none
tap_action:
action: more-info
hold_action:
action: none
multiline_secondary: true
card_mod:
style: |
ha-card {
background: none;
--ha-card-box-shadow: 0px;
}
-
- type: custom:mushroom-template-card
entity: input_boolean.adaptive_dropdown
primary: ''
secondary: ''
icon: >-
{{ 'mdi:chevron-up' if is_state(entity, 'on') else 'mdi:chevron-down'
}}
icon_color: disabled
hold_action:
action: none
card_mod:
style: |
ha-card {
align-items: flex-end;
background: none;
--ha-card-box-shadow: 0px;
}
mushroom-shape-icon {
--shape-color: none !important;
}
- type: grid
- type: conditional
conditions:- entity: input_boolean.adaptive_dropdown
state: 'on'
card:
type: vertical-stack
cards:- type: custom:bar-card
title: Grass pollen forecast
direction: up
columns: 5
height: 50px
width: 100%
min: 0
max: 200
positions:
icon: 'off'
name: outside
value: inside
severity:- color: Green
from: 0
to: 29 - color: Orange
from: 30
to: 60 - color: Red
from: 61
to: 999
animation:
state: 'on'
speed: 1
entities: - entity: sensor.kleenex_pollen_radar_thuis_gras
name: Today - entity: sensor.grass_pollen_forecast_1
name: Today +1 - entity: sensor.grass_pollen_forecast_2
name: Today +2 - entity: sensor.grass_pollen_forecast_3
name: Today +3 - entity: sensor.grass_pollen_forecast_4
name: Today +4
card_mod:
style: |-
.card-header {
--ha-card-header-font-size: 20px;
}
bar-card-backgroundbar {
background-color: transparent;
}
bar-card-name {
font-size: 12px;
font-weight: bolder;
color: #727272;
}
- color: Green
- type: custom:bar-card
title: Tree pollen forecast
direction: up
columns: 5
height: 50px
width: 100%
min: 0
max: 208
positions:
icon: 'off'
name: outside
value: inside
severity:- color: Green
from: 0
to: 95 - color: Orange
from: 96
to: 207 - color: Red
from: 208
to: 999
animation:
state: 'on'
speed: 1
entities: - entity: sensor.kleenex_pollen_radar_thuis_bomen
name: Today - entity: sensor.thuis_tree_pollen_day_1
name: Today +1 - entity: sensor.thuis_tree_pollen_day_2
name: Today +2 - entity: sensor.thuis_tree_pollen_day_3
name: Today +3 - entity: sensor.thuis_tree_pollen_day_4
name: Today +4
card_mod:
style: |-
.card-header {
--ha-card-header-font-size: 20px;
}
bar-card-backgroundbar {
background-color: transparent;
}
bar-card-name {
font-size: 12px;
font-weight: bolder;
color: #727272;
}
- color: Green
- type: custom:bar-card
title: Weed pollen forecast
direction: up
columns: 5
height: 50px
width: 100%
min: 0
max: 200
positions:
icon: 'off'
name: outside
value: inside
severity:-
color: Green
from: 0
to: 20 -
color: Orange
from: 21
to: 77 -
color: Red
from: 78
to: 999
animation:
state: 'on'
speed: 1
entities: -
entity: sensor.kleenex_pollen_radar_thuis_kruiden
name: Today -
entity: sensor.weed_pollen_forecast_1
name: Today +1 -
entity: sensor.weed_pollen_forecast_2
name: Today +2 -
entity: sensor.weed_pollen_forecast_3
name: Today +3 -
entity: sensor.weed_pollen_forecast_4
name: Today +4
card_mod:
style: |-
.card-header {
--ha-card-header-font-size: 20px;
}
bar-card-backgroundbar {
background-color: transparent;
}
bar-card-name {
font-size: 12px;
font-weight: bolder;
color: #727272;
}`Nice result
-
- type: custom:bar-card
- entity: input_boolean.adaptive_dropdown
(i am unable to fix ppm and pm3 at the moment)
The kleenex tree pollen seem to be broken. the tree pollen are always zero on a couple of days
You are propably, same as me, living in the Northern hemosphere. The season of the tree pollen is over. That's why it's 0.
You are propably, same as me, living in the Northern hemosphere. The season of the tree pollen is over. That's why it's 0.
Sounds legit :)
Then AccuWeather is broken... well, i'll re-adjust the scripts when i've got the time..
Thanks for the response and knowledge!