Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMeteo weather provider uses "apparent temperature" in forecast data instead of actual temperatures #3466

Closed
btoconnor opened this issue Jun 14, 2024 · 2 comments

Comments

@btoconnor
Copy link
Contributor

btoconnor commented Jun 14, 2024

I found a bug in MagicMirror

Please make sure to only submit reproducible issues. You can safely remove everything above the dividing line.
When submitting a new issue, please supply the following information:

Platform: Running magicmirror in a vm, display is on a rpi4

Node Version: v20.11.1

MagicMirror² Version: 2.27.0

Description:

The OpenMeteo provider uses the "apparent temperature" for the forecast temperature, max and min temperatures. The apparent temperature is the "feels like", which is different from the actual temperature.

Steps to Reproduce: Set up a forecast module with openmeteo as the provider. Temperatures will differ from actual temperatures.

Expected Results: I expect to get real temperatures.

Actual Results: I get the "feels like" / "apparent" temperatures

Additional Notes:

The code to fix this is straightforward - I'm happy to open a PR. I've already fixed it locally. This was opened in #3273 but was closed by the author without a fix.

diff --git a/modules/default/weather/providers/openmeteo.js b/modules/default/weather/providers/openmeteo.js
index 5c4b2322..614aa9df 100644
--- a/modules/default/weather/providers/openmeteo.js
+++ b/modules/default/weather/providers/openmeteo.js
@@ -398,9 +398,9 @@ WeatherProvider.register("openmeteo", {
                        currentWeather.windFromDirection = weather.winddirection_10m_dominant;
                        currentWeather.sunrise = weather.sunrise;
                        currentWeather.sunset = weather.sunset;
-                       currentWeather.temperature = parseFloat((weather.apparent_temperature_max + weather.apparent_temperature_min) / 2);
-                       currentWeather.minTemperature = parseFloat(weather.apparent_temperature_min);
-                       currentWeather.maxTemperature = parseFloat(weather.apparent_temperature_max);
+                       currentWeather.temperature = parseFloat((weather.temperature_2m_max + weather.temperature_2m_min) / 2);
+                       currentWeather.minTemperature = parseFloat(weather.temperature_2m_min);
+                       currentWeather.maxTemperature = parseFloat(weather.temperature_2m_max);
                        currentWeather.weatherType = this.convertWeatherType(weather.weathercode, currentWeather.isDayTime());
                        currentWeather.rain = parseFloat(weather.rain_sum);
                        currentWeather.snow = parseFloat(weather.snowfall_sum * 10);
@khassel
Copy link
Collaborator

khassel commented Jun 14, 2024

I'm happy to open a PR. I've already fixed it locally

Thanks!

Looking at the code I think we have the same problem with current temp:

			currentWeather.temperature = parseFloat(weather.apparent_temperature);
			currentWeather.minTemperature = parseFloat(weathers.daily[h].apparent_temperature_min);
			currentWeather.maxTemperature = parseFloat(weathers.daily[h].apparent_temperature_max);

So if you provide a PR for forecast can you please include the same change for current?

@khassel khassel added the bug label Jun 14, 2024
@btoconnor
Copy link
Contributor Author

Happy to, yeah. I'll get that posted soon.

rejas added a commit that referenced this issue Jun 24, 2024
… not apparent temperatures (#3468)

As discussed in #3466, the Open-Meteo provider is using the apparent
temperature ("Feels like") in the forecast and hourly weather reporting.
This is contrary to expected behavior.

Note: I'm a little unclear on how I should be editing the `CHANGELOG.md`
file with this PR - happy to update this PR with a little guidance. This
is my first attempted PR in this project.

Let me know if there are any questions.

---------

Co-authored-by: veeck <[email protected]>
khassel added a commit that referenced this issue Jun 30, 2024
## [2.28.0] - 2024-07-01

Thanks to: @btoconnor, @bugsounet, @JasonStieber, @khassel,
@kleinmantara and @WallysWellies.

> ⚠️ This release needs nodejs version >= v20

### Added

- [calendar] Added config option "showEndsOnlyWithDuration" for default
calendar
- [compliments] Added `specialDayUnique` config option, defaults to
`false` (#3465)
- [weather] Provider weathergov: Use `precipitationLast3Hours` if
`precipitationLastHour` is `null` (#3124)

### Removed

- [tests] delete node v18 support (#3462)

### Updated

- [core] Update dependencies including electron to v31
- [core] use node >= v20 (#3462)
- [core] Update `config.js.sample` to use openmeteo as weather provider
which needs no api key
- [tests] Use latest@version of node for `automated-tests.yaml` (#3483)
- [updatenotification] Avoid using pm2 when running in docker container

### Fixed

- [core] Fixed crash possibility if `module: <name>` is not defined and
on `postion: <positon>` mistake (#3445)
- [weather] Fixed precipitationProbability in forecast for provider
openmeteo (#3446)
- [weather] Fixed type=daily for provider openmeteo having no data when
running after 23:00 (#3449)
- [weather] Fixed type=daily for provider openmeteo showing nightly
icons in forecast when current time is "nightly" (#3458)
- [weather] Fixed forecast and hourly weather for provider openmeteo to
use real temperatures, not apparent temperatures (#3466)
- [tests] Fixed e2e tests running in docker container which needs
`address: "0.0.0.0"` (#3479)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Michael Teeuw <[email protected]>
Co-authored-by: Kristjan ESPERANTO <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ross Younger <[email protected]>
Co-authored-by: Veeck <[email protected]>
Co-authored-by: Bugsounet - Cédric <[email protected]>
Co-authored-by: jkriegshauser <[email protected]>
Co-authored-by: illimarkangur <[email protected]>
Co-authored-by: sam detweiler <[email protected]>
Co-authored-by: vppencilsharpener <[email protected]>
Co-authored-by: veeck <[email protected]>
Co-authored-by: Paranoid93 <[email protected]>
Co-authored-by: Brian O'Connor <[email protected]>
Co-authored-by: WallysWellies <[email protected]>
Co-authored-by: Jason Stieber <[email protected]>
@khassel khassel closed this as completed Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants