Skip to content

Commit

Permalink
Deprecated forecast array in met.no default weather sensor, moved to …
Browse files Browse the repository at this point in the history
…get_forecasts daily service
  • Loading branch information
chunkysteveo authored Apr 3, 2024
1 parent 171d94f commit 41fd65a
Showing 1 changed file with 41 additions and 35 deletions.
76 changes: 41 additions & 35 deletions ha-configuration.yaml
Original file line number Diff line number Diff line change
@@ -10,6 +10,12 @@ template:
data:
type: hourly
response_variable: weather_home_hourly
- service: weather.get_forecasts
target:
entity_id: weather.home
data:
type: daily
response_variable: weather_home_daily
sensor:
- name: Weatherman Data Tag
state: "{{ now().isoformat() }}"
@@ -145,77 +151,77 @@ template:
wm_time_3: >
{{ as_timestamp(weather_home_hourly['weather.home']['forecast'][3].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(weather_home_hourly['weather.home']['forecast'][3].datetime) | timestamp_custom('%p') }}
wm_cond_4: >
{% set cond4 = state_attr('weather.home', 'forecast')[1].condition %}
{% set cond4 = weather_home_hourly['weather.home']['forecast'][1].condition %}
{% if cond4 == 'partlycloudy' %} partly-cloudy {% else %} {{ cond4 }} {% endif %}
wm_temp_4: >
{{ state_attr('weather.home', 'forecast')[1].temperature | round }}
{{ weather_home_hourly['weather.home']['forecast'][1].temperature | round }}
wm_precipitation_4: >
{{ state_attr('weather.home', 'forecast')[1].precipitation }}
{{ weather_home_hourly['weather.home']['forecast'][1].precipitation }}
wm_temp_4_low: >
{{ state_attr('weather.home', 'forecast')[1].templow | round }}
{{ weather_home_hourly['weather.home']['forecast'][1].templow | round }}
wm_wind_speed_4: >
{{ state_attr('weather.home', 'forecast')[1].wind_speed | round }}
{{ weather_home_hourly['weather.home']['forecast'][1].wind_speed | round }}
wm_wind_dir_4: >
{{ state_attr('weather.home', 'forecast')[1].wind_bearing | round }}
{{ weather_home_hourly['weather.home']['forecast'][1].wind_bearing | round }}
wm_time_4: >
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(state_attr('weather.home', 'forecast')[1].datetime) | timestamp_custom('%w') | int]) }}
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(weather_home_hourly['weather.home']['forecast'][1].datetime) | timestamp_custom('%w') | int]) }}
wm_cond_5: >
{% set cond5 = state_attr('weather.home', 'forecast')[2].condition %}
{% set cond5 = weather_home_hourly['weather.home']['forecast'][2].condition %}
{% if cond5 == 'partlycloudy' %} partly-cloudy {% else %} {{ cond5 }} {% endif %}
wm_temp_5: >
{{ state_attr('weather.home', 'forecast')[2].temperature | round }}
{{ weather_home_hourly['weather.home']['forecast'][2].temperature | round }}
wm_precipitation_5: >
{{ state_attr('weather.home', 'forecast')[2].precipitation }}
{{ weather_home_hourly['weather.home']['forecast'][2].precipitation }}
wm_temp_5_low: >
{{ state_attr('weather.home', 'forecast')[2].templow | round }}
{{ weather_home_hourly['weather.home']['forecast'][2].templow | round }}
wm_wind_speed_5: >
{{ state_attr('weather.home', 'forecast')[2].wind_speed | round }}
{{ weather_home_hourly['weather.home']['forecast'][2].wind_speed | round }}
wm_wind_dir_5: >
{{ state_attr('weather.home', 'forecast')[2].wind_bearing | round }}
{{ weather_home_hourly['weather.home']['forecast'][2].wind_bearing | round }}
wm_time_5: >
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(state_attr('weather.home', 'forecast')[2].datetime) | timestamp_custom('%w') | int]) }}
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(weather_home_hourly['weather.home']['forecast'][2].datetime) | timestamp_custom('%w') | int]) }}
wm_cond_6: >
{% set cond6 = state_attr('weather.home', 'forecast')[3].condition %}
{% set cond6 = weather_home_hourly['weather.home']['forecast'][3].condition %}
{% if cond6 == 'partlycloudy' %} partly-cloudy {% else %} {{ cond6 }} {% endif %}
wm_temp_6: >
{{ state_attr('weather.home', 'forecast')[3].temperature | round }}
{{ weather_home_hourly['weather.home']['forecast'][3].temperature | round }}
wm_precipitation_6: >
{{ state_attr('weather.home', 'forecast')[3].precipitation }}
{{ weather_home_hourly['weather.home']['forecast'][3].precipitation }}
wm_temp_6_low: >
{{ state_attr('weather.home', 'forecast')[3].templow | round }}
{{ weather_home_hourly['weather.home']['forecast'][3].templow | round }}
wm_wind_speed_6: >
{{ state_attr('weather.home', 'forecast')[3].wind_speed | round }}
{{ weather_home_hourly['weather.home']['forecast'][3].wind_speed | round }}
wm_wind_dir_6: >
{{ state_attr('weather.home', 'forecast')[3].wind_bearing | round }}
{{ weather_home_hourly['weather.home']['forecast'][3].wind_bearing | round }}
wm_time_6: >
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(state_attr('weather.home', 'forecast')[3].datetime) | timestamp_custom('%w') | int]) }}
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(weather_home_hourly['weather.home']['forecast'][3].datetime) | timestamp_custom('%w') | int]) }}
wm_cond_7: >
{% set cond7 = state_attr('weather.home', 'forecast')[4].condition %}
{% set cond7 = weather_home_hourly['weather.home']['forecast'][4].condition %}
{% if cond7 == 'partlycloudy' %} partly-cloudy {% else %} {{ cond7 }} {% endif %}
wm_temp_7: >
{{ state_attr('weather.home', 'forecast')[4].temperature | round }}
{{ weather_home_hourly['weather.home']['forecast'][4].temperature | round }}
wm_precipitation_7: >
{{ state_attr('weather.home', 'forecast')[4].precipitation }}
{{ weather_home_hourly['weather.home']['forecast'][4].precipitation }}
wm_temp_7_low: >
{{ state_attr('weather.home', 'forecast')[4].templow | round }}
{{ weather_home_hourly['weather.home']['forecast'][4].templow | round }}
wm_wind_speed_7: >
{{ state_attr('weather.home', 'forecast')[4].wind_speed | round }}
{{ weather_home_hourly['weather.home']['forecast'][4].wind_speed | round }}
wm_wind_dir_7: >
{{ state_attr('weather.home', 'forecast')[4].wind_bearing | round }}
{{ weather_home_hourly['weather.home']['forecast'][4].wind_bearing | round }}
wm_time_7: >
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(state_attr('weather.home', 'forecast')[4].datetime) | timestamp_custom('%w') | int]) }}
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(weather_home_hourly['weather.home']['forecast'][4].datetime) | timestamp_custom('%w') | int]) }}
wm_cond_8: >
{% set cond8 = state_attr('weather.home', 'forecast')[5].condition %}
{% set cond8 = weather_home_hourly['weather.home']['forecast'][5].condition %}
{% if cond8 == 'partlycloudy' %} partly-cloudy {% else %} {{ cond8 }} {% endif %}
wm_temp_8: >
{{ state_attr('weather.home', 'forecast')[5].temperature | round }}
{{ weather_home_hourly['weather.home']['forecast'][5].temperature | round }}
wm_temp_8_low: >
{{ state_attr('weather.home', 'forecast')[5].templow | round }}
{{ weather_home_hourly['weather.home']['forecast'][5].templow | round }}
wm_precipitation_8: >
{{ state_attr('weather.home', 'forecast')[5].precipitation }}
{{ weather_home_hourly['weather.home']['forecast'][5].precipitation }}
wm_wind_speed_8: >
{{ state_attr('weather.home', 'forecast')[5].wind_speed | round }}
{{ weather_home_hourly['weather.home']['forecast'][5].wind_speed | round }}
wm_wind_dir_8: >
{{ state_attr('weather.home', 'forecast')[5].wind_bearing | round }}
{{ weather_home_hourly['weather.home']['forecast'][5].wind_bearing | round }}
wm_time_8: >
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(state_attr('weather.home', 'forecast')[5].datetime) | timestamp_custom('%w') | int]) }}
{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(weather_home_hourly['weather.home']['forecast'][5].datetime) | timestamp_custom('%w') | int]) }}

0 comments on commit 41fd65a

Please sign in to comment.