Skip to content

fix parsing of feels like for weathergov#2810

Merged
MichMich merged 1 commit intoMagicMirrorOrg:developfrom
philnagel:weatherModule-weathergov-feelsLikeFix
Mar 11, 2022
Merged

fix parsing of feels like for weathergov#2810
MichMich merged 1 commit intoMagicMirrorOrg:developfrom
philnagel:weatherModule-weathergov-feelsLikeFix

Conversation

@philnagel
Copy link
Contributor

weather.gov API does not seem to consistently provide a feels like value. The API specs mention an apparentTemperature value, which seems to not be provided most of the time in responses. There is a consistent value of windChill and heatIndex, which according to docs, only has a value when the value falls within a certain threshold.

Before this fix, feels like would only be read from heatIndex and it would be coerced to 0 if the value was null, thus showing a consistent feels like temp of 0 celsius/ 32 fahrenheit.

This pull request uses either windChill or heatIndex for feels like temp if one of them is available. If none are available, it will fall back to the current actual temperature.

@codecov-commenter
Copy link

Codecov Report

Merging #2810 (d0838d5) into develop (880e216) will decrease coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2810      +/-   ##
===========================================
- Coverage    65.26%   64.91%   -0.36%     
===========================================
  Files            8        8              
  Lines          285      285              
===========================================
- Hits           186      185       -1     
- Misses          99      100       +1     
Impacted Files Coverage Δ
js/server.js 66.21% <0.00%> (-1.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 880e216...d0838d5. Read the comment docs.

@rejas
Copy link
Collaborator

rejas commented Feb 18, 2022

Thanks for the PR.

Might it be usefull to check first for apparentTemperature so that IF it is provided it is used for the feelsLike value? And if not, then the other values are taken into account?

@philnagel
Copy link
Contributor Author

philnagel commented Feb 21, 2022

I think I was actually mistaken with the link I included for the reference. That one only refers to the gridpoints endpoint, but in this case for the current conditions, we're using the observation endpoint. The schema for that is found here , under Schemas -> Observation and does not reference apparentTemperature at all, only heatIndex and windChill.
I think based on that, the logic should be sufficient as is. Let me know your thoughts.

@MichMich
Copy link
Collaborator

Thanks for your contribution! My apologies for my slow response. Life got in the way.

@MichMich MichMich merged commit 5def02f into MagicMirrorOrg:develop Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants