core icon indicating copy to clipboard operation
core copied to clipboard

Met Eireann integration always showing max as current weather

Open lutzky opened this issue 2 years ago • 5 comments

The problem

The Met Eireann weather integration reports, as the "current" weather, the daily maximal temperature. This is because that's what the underlying implementation does. The upstream XML does not have a separate "current conditions" field, only a forecast.

Perhaps instead of relying on the underlying implementation's "current" data (which is actually a series of daily estimates, as can be seen in the link above), we should use the nearest available hourly forecast?

What version of Home Assistant Core has the issue?

core-2023.9.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

met_eireann

Link to integration documentation on our website

https://www.home-assistant.io/integrations/met_eireann

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

This is what the code does, effectively on purpose. Here's a sample; as you can see, the current temperature is actually more like 18, but the daily max is 20.6, so that's what is shown.

temperature: 20.6
temperature_unit: °C
humidity: 77
pressure: 1022.2
pressure_unit: hPa
wind_bearing: 147.6
wind_speed: 16.6
wind_speed_unit: km/h
visibility_unit: km
precipitation_unit: mm
forecast:
  - precipitation: 0
    wind_bearing: 158.9
    condition: cloudy
    datetime: '2023-10-08T13:00:00+00:00'
    temperature: 18
    pressure: 1021.8
    wind_speed: 10.1
  - precipitation: 0
    wind_bearing: 194.5
    condition: cloudy
    datetime: '2023-10-08T14:00:00+00:00'
    temperature: 19.4
    pressure: 1021.5
    wind_speed: 2.9
  - precipitation: 0
    wind_bearing: 316
    condition: cloudy
    datetime: '2023-10-08T15:00:00+00:00'
    temperature: 20.1
    pressure: 1021.8
    wind_speed: 8.6
  - precipitation: 0
    wind_bearing: 315.2
    condition: cloudy
    datetime: '2023-10-08T16:00:00+00:00'
    temperature: 19.7
    pressure: 1021.8
    wind_speed: 6.8
  - precipitation: 0
    wind_bearing: 276.8
    condition: cloudy
    datetime: '2023-10-08T17:00:00+00:00'
    temperature: 19.8
    pressure: 1021.6
    wind_speed: 4.3
  - precipitation: 0
    wind_bearing: 253.9
    condition: cloudy
    datetime: '2023-10-08T18:00:00+00:00'
    temperature: 19.5
    pressure: 1021.6
    wind_speed: 9.7
  - precipitation: 0
    wind_bearing: 270.9
    condition: cloudy
    datetime: '2023-10-08T19:00:00+00:00'
    temperature: 20.6
    pressure: 1021.7
    wind_speed: 14.4
  - precipitation: 0
    wind_bearing: 299.9
    condition: partlycloudy
    datetime: '2023-10-08T20:00:00+00:00'
    temperature: 20.4
    pressure: 1021.8
    wind_speed: 6.8
  - precipitation: 0
    wind_bearing: 327.4
    condition: partlycloudy
    datetime: '2023-10-08T21:00:00+00:00'
    temperature: 18.1
    pressure: 1022.2
    wind_speed: 5.8
  - precipitation: 0
    wind_bearing: 271.8
    condition: partlycloudy
    datetime: '2023-10-08T22:00:00+00:00'
    temperature: 20.4
    pressure: 1022.4
    wind_speed: 16.6
  - precipitation: 0
    wind_bearing: 252.3
    condition: partlycloudy
    datetime: '2023-10-08T23:00:00+00:00'
    temperature: 20
    pressure: 1022.2
    wind_speed: 9.4
  - precipitation: 0
    wind_bearing: 297.5
    condition: partlycloudy
    datetime: '2023-10-09T00:00:00+00:00'
    temperature: 18.6
    pressure: 1022
    wind_speed: 1.4
  - precipitation: 0
    wind_bearing: 302
    condition: partlycloudy
    datetime: '2023-10-09T01:00:00+00:00'
    temperature: 17.2
    pressure: 1022.3
    wind_speed: 6.1
  - precipitation: 0
    wind_bearing: 264.7
    condition: partlycloudy
    datetime: '2023-10-09T02:00:00+00:00'
    temperature: 17.8
    pressure: 1021.6
    wind_speed: 10.1
  - precipitation: 0
    wind_bearing: 339.4
    condition: cloudy
    datetime: '2023-10-09T03:00:00+00:00'
    temperature: 16.9
    pressure: 1021.6
    wind_speed: 5.8
  - precipitation: 0
    wind_bearing: 300.9
    condition: cloudy
    datetime: '2023-10-09T04:00:00+00:00'
    temperature: 16.5
    pressure: 1021.7
    wind_speed: 6.8
  - precipitation: 0
    wind_bearing: 183.2
    condition: cloudy
    datetime: '2023-10-09T05:00:00+00:00'
    temperature: 15.8
    pressure: 1022
    wind_speed: 1.4
  - precipitation: 0
    wind_bearing: 175.3
    condition: partlycloudy
    datetime: '2023-10-09T06:00:00+00:00'
    temperature: 15.1
    pressure: 1022.3
    wind_speed: 4
  - precipitation: 0
    wind_bearing: 205.6
    condition: partlycloudy
    datetime: '2023-10-09T07:00:00+00:00'
    temperature: 14.9
    pressure: 1022.4
    wind_speed: 5.8
  - precipitation: 0
    wind_bearing: 201.5
    condition: partlycloudy
    datetime: '2023-10-09T08:00:00+00:00'
    temperature: 15.9
    pressure: 1022.4
    wind_speed: 5.4
  - precipitation: 0
    wind_bearing: 144.1
    condition: partlycloudy
    datetime: '2023-10-09T09:00:00+00:00'
    temperature: 18.1
    pressure: 1022.3
    wind_speed: 6.8
  - precipitation: 0
    wind_bearing: 106.9
    condition: partlycloudy
    datetime: '2023-10-09T10:00:00+00:00'
    temperature: 18
    pressure: 1022.1
    wind_speed: 11.2
  - precipitation: 0
    wind_bearing: 119.4
    condition: partlycloudy
    datetime: '2023-10-09T11:00:00+00:00'
    temperature: 17.9
    pressure: 1021.8
    wind_speed: 14
  - precipitation: 0
    wind_bearing: 134.5
    condition: partlycloudy
    datetime: '2023-10-09T12:00:00+00:00'
    temperature: 20.2
    pressure: 1021.1
    wind_speed: 15.1
attribution: Data provided by Met Éireann
friendly_name: Home Hourly
supported_features: 3

lutzky avatar Oct 08 '23 12:10 lutzky

Hey there @dylangore, mind taking a look at this issue as it has been labeled with an integration (met_eireann) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of met_eireann can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign met_eireann Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


met_eireann documentation met_eireann source (message by IssueLinks)

home-assistant[bot] avatar Oct 08 '23 12:10 home-assistant[bot]

Workaround in configuration.yaml:

weather:
  - platform: template
    name: "Met Eireann Now"
    condition_template: "{{ state_attr('weather.home_hourly', 'forecast')[0].condition }}"
    humidity_template: "{{ state_attr('weather.home_hourly', 'humidity') }}" # Required, but absent in forecast
    temperature_template: "{{ state_attr('weather.home_hourly', 'forecast')[0].temperature }}"
    temperature_unit: "°C"
    wind_speed_template: "{{ state_attr('weather.home_hourly', 'forecast')[0].wind_speed }}"
    wind_bearing_template: "{{ state_attr('weather.home_hourly', 'forecast')[0].wind_bearing }}"
    wind_speed_unit: "km/h"

lutzky avatar Oct 08 '23 15:10 lutzky

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still relevant

lutzky avatar Jan 06 '24 22:01 lutzky

If https://github.com/DylanGore/PyMetEireann/pull/7 gets merged, it can fix this issue. Otherwise, we can fix within homeassistant like so:

diff --git a/homeassistant/components/met_eireann/__init__.py b/homeassistant/components/met_eireann/__init__.py
index 5edecbbac0..e406c5aa86 100644
--- a/homeassistant/components/met_eireann/__init__.py
+++ b/homeassistant/components/met_eireann/__init__.py
@@ -84,8 +84,8 @@ class MetEireannWeatherData:
     async def fetch_data(self) -> Self:
         """Fetch data from API - (current weather and forecast)."""
         await self._weather_data.fetching_data()
-        self.current_weather_data = self._weather_data.get_current_weather()
         time_zone = dt_util.DEFAULT_TIME_ZONE
+        self.current_weather_data = self._weather_data.get_forecast(time_zone, True)[0]
         self.daily_forecast = self._weather_data.get_forecast(time_zone, False)
         self.hourly_forecast = self._weather_data.get_forecast(time_zone, True)
         return self

lutzky avatar Jan 14 '24 22:01 lutzky

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Not stale, keep open please

lutzky avatar May 05 '24 11:05 lutzky

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.