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

Current Weather Display Issue due to API Response Format Change #3124

Closed
JasonStieber opened this issue Jun 16, 2023 · 1 comment
Closed

Comments

@JasonStieber
Copy link
Contributor

Description:

Issue Description

While using the weathergov.js file from the MagicMirror2 codebase, I encountered an issue where the current weather wasn't being displayed properly. The root cause of the issue is on line 213, where currentWeather.precipitationAmount is set.

Current code:

currentWeather.precipitationAmount = currentWeatherData.precipitationLastHour.value;

However, it seems that the weather API has changed its response format and it no longer includes the precipitationLastHour variable. This results in the currentWeather.precipitationAmount variable not being set correctly, which in turn causes the MagicMirror to fail to display the current weather when using weathergov.

Proposed Solution

To resolve the issue, I propose to use the precipitationLast3Hours variable, which seems to be the new format in the API's response. The updated line of code would be:

currentWeather.precipitationAmount = currentWeatherData.precipitationLast3Hours.value;

I have tested this change locally and confirmed that it fixes the issue. I will submit a pull request with this proposed change.

System Information

MagicMirror version: 2.23.0

OS:

  • Distributor ID: Ubuntu
  • Description: Ubuntu 22.04.2 LTS
  • Release: 22.04
  • Codename: jammy

Device:
Linux jason-X570-AORUS-ELITE-WIFI 5.19.0-45-generic #46~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 7 15:06:04 UTC 20 x86_64 x86_64 x86_64 GNU/Linux

@rejas
Copy link
Collaborator

rejas commented Jun 17, 2023

Thanks for reporting this. I dont seem to find any information about this on https://www.weather.gov/documentation/services-web-api.
Maybe the API has just a hiccup? Ho wlong has this issue been occuring?

khassel added a commit that referenced this issue Jun 28, 2024
Pull request fixes small big in weathergov api format mismatch #3124

---------

Co-authored-by: Karsten Hassel <[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

3 participants