Closed colinhatfield closed 7 months ago
Hey there @danielhiversen, mind taking a look at this issue as it has been labeled with an integration (met
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
met documentation met source (message by IssueLinks)
I think it's link with this change https://github.com/home-assistant/core/pull/111863
I'm also using this entity in my e-paper screen.
Same here. Honestly I was expecting to receive the hourly attributes in the entity since it was mentioned in the blog post (unforutnately I did not check the github issues before updating... So the data is somewhere, but unusable at the moment :(
I have the same issue; all hourly weather-based automation failed now.
I was also surprised by this, I hope there is a workaround to get the hourly information since I had this on my main dashboard.
Why was this not listed in the backwards incompatible changes list of the 2024.03 release?
Edit: At least for the weather card, I was able to change the display configuration to display hourly, so it works correctly again for me. I'd still appreciate it if entity removals would be listed in backwards incompatible changes.
Edit 2: My mistake! 🙏 The breaking changes were listed in the "Met.no" integration, I just didn't make the connection between my weather entity that I have since day one and the Met.no integration :)
I'm also interrested in learning how I can access the hourly data in this new structure (e.g. {% for state in states.weather.home_hourly.attributes.forecast[0:1] -%} I was very grateful for the data I could get from this - I spent a lot of time making a 24 led ring light where the colour of each light represents the predicted temperature and the intensity with which the led flashes shows the likelihood of rain for that hour... .
Thanks to anyone who can point me in the right direction for this...
maybe this helps to someone:
template:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
sensor:
- name: Weather Hourly
state: "{{ states('weather.home') }}"
attributes:
temperature: "{{ state_attr('weather.home', 'temperature') }}"
dew_point: "{{ state_attr('weather.home', 'dew_point') }}"
temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}"
humidity: "{{ state_attr('weather.home', 'humidity') }}"
cloud_coverage: "{{ state_attr('weather.home', 'cloud_coverage') }}"
pressure: "{{ state_attr('weather.home', 'pressure') }}"
pressure_unit: "{{ state_attr('weather.home', 'pressure_unit') }}"
wind_bearing: "{{ state_attr('weather.home', 'wind_bearing') }}"
wind_speed: "{{ state_attr('weather.home', 'wind_speed') }}"
wind_speed_unit: "{{ state_attr('weather.home', 'wind_speed_unit') }}"
visibility_unit: "{{ state_attr('weather.home', 'visibility_unit') }}"
precipitation_unit: "{{ state_attr('weather.home', 'precipitation_unit') }}"
forecast: "{{ hourly['weather.home'].forecast }}"
maybe this helps to someone, extract hourly forecast into new sensor as attributes:
template:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
sensor:
- name: Weather Hourly
state: "{{ hourly['weather.home'].forecast[0].temperature }}"
attributes:
forecast: "{{ hourly['weather.home'].forecast }}"
Awesome, thanks! Was just about to start looking into something like this myself...
This is all awesome with the workaround and I'll give it a go but I really wonder if this is a bug or intended @Danielhiversen ?
maybe this helps to someone
Great, many thanks, works as expected!
Tagging the person who committed this change... @emontnemery are you able to share some details on how the hourly forecast is intended to be accessed?
So glad I found this thread - I have been tearing my hair out. Will try the work around and I hope it gets fixed soon.
I tried the templet above but I got Forecast NULL.
dew_point: 40
temperature_unit: °F
humidity: 64
cloud_coverage: 12.5
pressure: 30.06
pressure_unit: inHg
wind_bearing: 207.1
wind_speed: 3.6
wind_speed_unit: mph
visibility_unit: mi
precipitation_unit: in
forecast: null
friendly_name: Weather Hourly```
My templet
#weather forcast hourly sensor
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
- sensor:
- name: Weather Hourly
state: "{{ states('weather.home') }}"
attributes:
temperature: "{{ state_attr('weather.home', 'temperature') }}"
dew_point: "{{ state_attr('weather.home', 'dew_point') }}"
temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}"
humidity: "{{ state_attr('weather.home', 'humidity') }}"
cloud_coverage: "{{ state_attr('weather.home', 'cloud_coverage') }}"
pressure: "{{ state_attr('weather.home', 'pressure') }}"
pressure_unit: "{{ state_attr('weather.home', 'pressure_unit') }}"
wind_bearing: "{{ state_attr('weather.home', 'wind_bearing') }}"
wind_speed: "{{ state_attr('weather.home', 'wind_speed') }}"
wind_speed_unit: "{{ state_attr('weather.home', 'wind_speed_unit') }}"
visibility_unit: "{{ state_attr('weather.home', 'visibility_unit') }}"
precipitation_unit: "{{ state_attr('weather.home', 'precipitation_unit') }}"
forecast: "{{ hourly['weather.home'].forecast }}"
Call service weather.get_forecasts manually (in dev tools) and check if there is any hourly forecast data.
Call service weather.get_forecasts manually (in dev tools) and check if there is any hourly forecast data.
im not following? your screen shot shows the forcast and datetime mine just says null. what my goal is to fix my templets I had before the change to show +2 hour and so on weather forecast data to some screens. here is my old one and trying to figure out how to do with using the new service call way.
- obj: "p5b21" # Forecast time +1h
properties:
"text": >
{%- if not is_state('weather.barb_s_place_hourly','unavailable') %}
{%- set update = states('sensor.date') %}
{%- set midnight = now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() %}
{%- set event = as_timestamp(strptime(state_attr('weather.barb_s_place_hourly','forecast')[1]['datetime'], '%Y-%m-%dT%H:%M:%S%z', default='2020-01-00T00:00:00+00:00')) %}
{%- set delta = ((event - midnight) // 86400) | int %}
{%- if delta == 0 %}
Today
{%- elif delta == 1 %}
Tomorrow
{%- endif %}
{{- event | timestamp_custom(" %-I %p") }}
{%- endif %}
- obj: "p5b22" # Forecast temp +1h
properties:
"text": "{{ state_attr('weather.barb_s_place_hourly','forecast')[1]['temperature'] if not is_state('weather.barb_s_place_hourly','unavailable') else '-' }}"
- obj: "p5b23" # Forecast condition +1h
properties:
"src": >
{%- if not is_state('weather.barb_s_place_hourly','unavailable') %}
L:/w-32-{{ state_attr('weather.barb_s_place_hourly','forecast')[1]['condition'] }}.png
{%- endif %}
to show in a panel.
thanks ahead of time for the help.
yes
Ok, i see... remove "minus" sign before "sensor:"
Ok, i see... remove "minus" sign before "sensor:" DUH that fixed it. see im a dumb ass. Now I have to figure out how to implement this in a way i did the the other templet to get +1 +2 +3 +4 and so on Again thanks for your help
yhaa I got it.
- obj: "p5b51" # Forecast time +8h
properties:
"text": >
{%- if not is_state('sensor.weather_hourly','unavailable') %}
{%- set update = states('sensor.date') %}
{%- set midnight = now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() %}
{%- set event = as_timestamp(strptime(state_attr('sensor.weather_hourly','forecast')[8]['datetime'], '%Y-%m-%dT%H:%M:%S%z', default='2020-01-00T00:00:00+00:00')) %}
{%- set delta = ((event - midnight) // 86400) | int %}
{%- if delta == 0 %}
Today
{%- elif delta == 1 %}
Tomorrow
{%- endif %}
{{- event | timestamp_custom(" %-I %p") }}
{%- endif %}
- obj: "p5b52" # Forecast temp +8h
properties:
"text": "{{ state_attr('sensor.weather_hourly','forecast')[8]['temperature'] if not is_state('sensor.weather_hourly','unavailable') else '-' }}"
- obj: "p5b53" # Forecast condition +8h
properties:
"src": >
{%- if not is_state('sensor.weather_hourly','unavailable') %}
L:/w-32-{{ state_attr('sensor.weather_hourly','forecast')[8]['condition'] }}.png
{%- endif %}
I documented for my future self and others for help open hasp
I must say, this doesn't look like an issue with the code but a support request. Please use the appropriate channels for that like discord or the forums.
I'll close the issue because of that reason
this doesn't look like an issue with the code
I tend to disagree. The release notes state: "The met.no integration now only creates a single entity that provides both daily and hourly weather forecasts." but the hourly forecast attributes are missing. So it is either problem with the code that should be fixed or wrong information in the documenation.
Just asked one of the people helping out with these kinds of issues and there are 2 forum threads talking about exactly this.
https://community.home-assistant.io/t/petition-dont-delete-the-forecast-attribute/609298/ https://community.home-assistant.io/t/how-to-migrate-from-weather-integration-approach-to-new-weather-get-forecast-service/619481/
I mean if there was an issue with the code (which you say there is) I would expect this issue not to be called "unsure how to use X" and have the content look like a forum post.
If you still do think there is an issue with the integration, please create a new issue with reproduction steps telling what steps you tried and what you expect what would happen.
OK, looks like there is one already: https://github.com/home-assistant/core/issues/112583 Switching over to that one for either of the fixes.
The problem
Since updating to 2024.3.0 I'm unsure how to use hourly forecast information.
Previously the weather.forecast_hourly entity had attributes for each hour of the day, these could then be displayed on cards etc (I used a template like
state_attr('weather.forecast_home','hourly')[0])['temperature']
for example).Now only the weather.forecast_home exists, and I can only see the daily attributes for the entity.
I can see the hourly data by navigating to the service itself:
but I can't figure out how to use this data.
Any advice would be greatly appreciated
What version of Home Assistant Core has the issue?
2024.3.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
met
Link to integration documentation on our website
https://www.home-assistant.io/integrations/met
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Entity Attributes:
friendly_name: Forecast Home supported_features: 3 temperature: 6.9 dew_point: 3.4 temperature_unit: °C humidity: 78 cloud_coverage: 100 pressure: 1022.3 pressure_unit: hPa wind_bearing: 95.9 wind_speed: 14.98 wind_speed_unit: mph visibility_unit: mi precipitation_unit: mm forecast:
attribution: Weather forecast from met.no, delivered by the Norwegian Meteorological Institute.