MagicMirrorOrg / MagicMirror

MagicMirror² is an open source modular smart mirror platform. With a growing list of installable modules, the MagicMirror² allows you to convert your hallway or bathroom mirror into your personal assistant.
http://magicmirror.builders
MIT License
19.45k stars 4.16k forks source link

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

Closed JasonStieber closed 1 week ago

JasonStieber commented 1 year ago

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:

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 commented 1 year ago

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?