Skip to content

Adding experimental UV Index support for weather module#3108

Merged
rejas merged 22 commits intoMagicMirrorOrg:developfrom
OWL4C:develop
May 22, 2023
Merged

Adding experimental UV Index support for weather module#3108
rejas merged 22 commits intoMagicMirrorOrg:developfrom
OWL4C:develop

Conversation

@OWL4C
Copy link
Contributor

@OWL4C OWL4C commented May 21, 2023

This pr adds (config.js toggleable) showUV_Index to the hourly and current weather modules, with right now only openmeteo configured to supply the data. Other providers could have support too by adding uv_index to current and hourly.

For example the current weather looks like image positioned after sunset in the top row.

The following "hacks" are included and could be fixed to make it cleaner, but the functionality is wanted and it works without problem.

  • To hide entries where the UV Index is 0 i added an if statement to the hourly.njk which is not how precipitation is handled.
    The following are minor things that might not need fixing:
  • The forecast option does not have UV support. This might not be relevant since UV changes throughout the day but i tried to implement a "max_UV" to openmeteo.js, but am not confident enough in JS to accomplish that.
  • The UV Icon is wi-hot and manually added to the .njk's. This could be made changeable by a config but does not seem relevant since wi-hot is not used by anything else as far as i can tell.

@codecov-commenter
Copy link

codecov-commenter commented May 21, 2023

Codecov Report

Merging #3108 (7ef005d) into develop (0573d6e) will increase coverage by 0.02%.
The diff coverage is 0.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@             Coverage Diff             @@
##           develop    #3108      +/-   ##
===========================================
+ Coverage    25.61%   25.64%   +0.02%     
===========================================
  Files           53       53              
  Lines        11427    11435       +8     
===========================================
+ Hits          2927     2932       +5     
- Misses        8500     8503       +3     
Impacted Files Coverage Δ
modules/default/weather/providers/openmeteo.js 0.00% <0.00%> (ø)
modules/default/weather/weather.js 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

@OWL4C
Copy link
Contributor Author

OWL4C commented May 21, 2023

The last batch of tests failed because "uv_index" is not Kebap Case, which is unfixable since the API provides it only as such.

@sdetweil
Copy link
Collaborator

you can use
/* eslint-disable /
.....
/
eslint-enable */

around the troublesome block

@rejas
Copy link
Collaborator

rejas commented May 21, 2023

The last batch of tests failed because "uv_index" is not Kebap Case, which is unfixable since the API provides it only as such.

The error comes from modules/default/weather/weather.css where you define a class with that name (and reference in the njk template). So those places you can fix. The API param name doesnt trigger the error.

@rejas
Copy link
Collaborator

rejas commented May 21, 2023

But thanks for the PR. COuld you provide a screenshot of the whole weather look now?

…nges, fixed look to conform to other module data
@OWL4C
Copy link
Contributor Author

OWL4C commented May 22, 2023

I am pretty sure i fixed everything and made it look nice
weather
.
The icon is still set manually and the "ugly" UV == 0 still there but the api already supports daily UV so i added that too

@rejas rejas merged commit eceec82 into MagicMirrorOrg:develop May 22, 2023
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