mirror of
https://github.com/HASwitchPlate/HASPone.git
synced 2025-07-23 19:26:36 +00:00
Deal with breaking changes to weather forecasting
This commit is contained in:
parent
b2c263eee7
commit
a1ac604cba
@ -120,14 +120,24 @@ blueprint:
|
|||||||
selector:
|
selector:
|
||||||
entity:
|
entity:
|
||||||
domain: weather
|
domain: weather
|
||||||
|
forecast_interval:
|
||||||
|
name: "Forecast interval"
|
||||||
|
description: 'Forecast interval, one of "hourly", "twice daily", or "daily"'
|
||||||
|
default: "daily"
|
||||||
|
selector:
|
||||||
|
select:
|
||||||
|
options:
|
||||||
|
- "hourly"
|
||||||
|
- "twice_daily"
|
||||||
|
- "daily"
|
||||||
forecast_index:
|
forecast_index:
|
||||||
name: "Forecast index"
|
name: "Forecast index"
|
||||||
description: 'Weather forecasts are provided at intervals determined by your weather source. The next time interval will be index "0". Increment this number for future forecasts'
|
description: 'Select a specific forecast, the next time interval will be index "0". Increment this number for future forecasts'
|
||||||
default: 0
|
default: 0
|
||||||
selector:
|
selector:
|
||||||
number:
|
number:
|
||||||
min: 0
|
min: 0
|
||||||
max: 10
|
max: 48
|
||||||
mode: slider
|
mode: slider
|
||||||
unit_of_measurement: index
|
unit_of_measurement: index
|
||||||
forecast_attribute:
|
forecast_attribute:
|
||||||
@ -243,15 +253,16 @@ variables:
|
|||||||
hasppage: !input hasppage
|
hasppage: !input hasppage
|
||||||
haspbutton: !input haspbutton
|
haspbutton: !input haspbutton
|
||||||
weather_provider: !input weather_provider
|
weather_provider: !input weather_provider
|
||||||
|
forecast_interval: !input forecast_interval
|
||||||
forecast_index: !input forecast_index
|
forecast_index: !input forecast_index
|
||||||
forecast_attribute: !input forecast_attribute
|
forecast_attribute: !input forecast_attribute
|
||||||
prefix: !input prefix
|
prefix: !input prefix
|
||||||
font_select: !input font_select
|
font_select: !input font_select
|
||||||
font: '{{ font_select.split(" - ")[0] | int(default=8) }}'
|
font: '{{ font_select.split(" - ")[0] | int }}'
|
||||||
xcen_select: !input xcen_select
|
xcen_select: !input xcen_select
|
||||||
xcen: '{{ xcen_select.split(" - ")[0] | int(default=1) }}'
|
xcen: '{{ xcen_select.split(" - ")[0] | int }}'
|
||||||
ycen_select: !input ycen_select
|
ycen_select: !input ycen_select
|
||||||
ycen: '{{ ycen_select.split(" - ")[0] | int(default=1) }}'
|
ycen: '{{ ycen_select.split(" - ")[0] | int }}'
|
||||||
wrap: !input wrap
|
wrap: !input wrap
|
||||||
title_case: !input title_case
|
title_case: !input title_case
|
||||||
selected_fgcolor: !input selected_fgcolor
|
selected_fgcolor: !input selected_fgcolor
|
||||||
@ -261,15 +272,6 @@ variables:
|
|||||||
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
|
haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}'
|
||||||
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}'
|
||||||
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}'
|
||||||
text: >-
|
|
||||||
{%- if prefix|lower != "none" -%}
|
|
||||||
{{ prefix }}
|
|
||||||
{%- endif -%}
|
|
||||||
{%- if title_case -%}
|
|
||||||
{{ state_attr(weather_provider, "forecast")[forecast_index|int(default=0)].get(forecast_attribute)|replace("windy-variant","windy")|replace("clear-night","clear night")|replace("partlycloudy","partly cloudy")|replace("lightning-rainy","lightning & rain")|replace("snowy-rainy","snow & rain") | title }}
|
|
||||||
{%- else -%}
|
|
||||||
{{ state_attr(weather_provider, "forecast")[forecast_index|int(default=0)].get(forecast_attribute)|replace("windy-variant","windy")|replace("clear-night","clear night")|replace("partlycloudy","partly cloudy")|replace("lightning-rainy","lightning & rain")|replace("snowy-rainy","snow & rain") }}
|
|
||||||
{%- endif -%}
|
|
||||||
isbr: "{% if wrap == true %}1{% else %}0{% endif %}"
|
isbr: "{% if wrap == true %}1{% else %}0{% endif %}"
|
||||||
selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}'
|
selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}'
|
||||||
selectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedbackgroundcolor/rgb" }}'
|
selectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedbackgroundcolor/rgb" }}'
|
||||||
@ -380,6 +382,23 @@ condition:
|
|||||||
value_template: "{{ is_state(haspsensor, 'ON') }}"
|
value_template: "{{ is_state(haspsensor, 'ON') }}"
|
||||||
|
|
||||||
action:
|
action:
|
||||||
|
- service: weather.get_forecasts
|
||||||
|
target:
|
||||||
|
entity_id: !input weather_provider
|
||||||
|
data:
|
||||||
|
type: "{{forecast_interval}}"
|
||||||
|
response_variable: weather_forecast
|
||||||
|
- variables:
|
||||||
|
text: >-
|
||||||
|
{%- if prefix|lower != "none" -%}
|
||||||
|
{{ prefix }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if title_case -%}
|
||||||
|
{{ weather_forecast[weather_provider]['forecast'][forecast_index][forecast_attribute]|replace("windy-variant","windy")|replace("clear-night","clear night")|replace("partlycloudy","partly cloudy")|replace("lightning-rainy","lightning & rain")|replace("snowy-rainy","snow & rain") | title }}
|
||||||
|
{%- else -%}
|
||||||
|
{{ weather_forecast[weather_provider]['forecast'][forecast_index][forecast_attribute]|replace("windy-variant","windy")|replace("clear-night","clear night")|replace("partlycloudy","partly cloudy")|replace("lightning-rainy","lightning & rain")|replace("snowy-rainy","snow & rain") }}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
- choose:
|
- choose:
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Display attribute and apply text style when "RUN ACTIONS" is pressed by the user
|
# Display attribute and apply text style when "RUN ACTIONS" is pressed by the user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user