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

[weather] add humidity to hourly view, fix spacing error when using UV Index, add config option to hide precipitation entries that are zero #3526

Closed
wants to merge 14 commits into from
Closed
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ _This release is scheduled to be released on 2024-10-01._

### Added

- [weather] Added option Humidity to hourly View
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to move your changelog entries into the latest develop section....

Copy link
Contributor Author

@OWL4C OWL4C Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this worked? I replaced the entire file with the current one and then added back the changes
EDIT: nevermind.

- [weather] Added option to hide hourly entries that are Zero, hiding the entire column if empty.

### Removed

- [core] removed installer only files (#3492)
Expand All @@ -29,6 +32,7 @@ _This release is scheduled to be released on 2024-10-01._
- [weather] Fixed issue with the UK Met Office provider following a change in their API paths and header info.
- [core] add check for node_helper loading for multiple instances of same module (#3502)
- [weather] Fixed issue for respecting unit config on broadcasted notifications
- [weather] Fixed minor spacing issues when using UV Index in Hourly
- [tests] Fixes calendar test by moving it from e2e to electron with fixed date (#3532)

## [2.28.0] - 2024-07-01
Expand Down
20 changes: 15 additions & 5 deletions modules/default/weather/hourly.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
<td class="day">{{ hour.date | formatTime }}</td>
<td class="bright weather-icon">
<span class="wi weathericon wi-{{ hour.weatherType }}"></span>
<i class="wi weathericon wi-{{ hour.weatherType }}"></i>
</td>
<td class="align-right bright">
{{ hour.temperature | roundValue | unit("temperature") }}
Expand All @@ -21,15 +21,25 @@
{% endif %}
</td>
{% endif %}
{% if config.showHumidity %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the new config options to the defaults object at the top of the file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the defaults in the weather.js?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is a new config property, so it needs to havea default value set, and the defaults:{} object contains those
as documented in the developers guide for modules

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no progress here, @rejas is the missing config.showHumidity the only thing (beside changelog merge conflicts) which is preventing this from merging?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

besides that i had one question above...

Copy link
Contributor Author

@OWL4C OWL4C Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showHumidity is a string due to current.njk implementing multiple options. I only ever implemented a binary True/False. Since js' Boolean("none") == True this will not work as intended without changes. (For that matter all strings that aren't empty are true, so it will always have to check against strings)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the if to check against "none", but other than that it is still undefined what the correct string should be to turn it on, since the current.njk Humidity has multiple placements, which is inapplicable here. Since the current config comment isn't listing possible values right now, i would suggest changing it to something along the lines of // current: "none", "wind", "below"; hourly: "none", "on". While this wouldn't be clean it would work.
Alternatively it could be split into "ShowHumidity: True/False" + "CurrentHumidityPosition: wind, below" etc; whatever is preferable. Changing the comment is a band aid but works, adding options could become convoluted but has less ambiguity.

<td class="align-left bright humidity-hourly">
{{ hour.humidity }}
<i class="wi wi-humidity humidity-icon"></i>
</td>
{% endif %}
{% if config.showPrecipitationAmount %}
<td class="align-right bright precipitation-amount">
{{ hour.precipitationAmount | unit("precip", hour.precipitationUnits) }}
</td>
{% if (!config.hideZeroes or hour.precipitationAmount>0) %}
<td class="align-right bright precipitation-amount">
{{ hour.precipitationAmount | unit("precip", hour.precipitationUnits) }}
</td>
{% endif %}
{% endif %}
{% if config.showPrecipitationProbability %}
{% if (!config.hideZeroes or hour.precipitationAmount>0) %}
<td class="align-right bright precipitation-prob">
{{ hour.precipitationProbability | unit('precip', '%') }}
{{ hour.precipitationProbability | unit('precip', '%') }}
</td>
{% endif %}
{% endif %}
</tr>
{% set currentStep = currentStep + 1 %}
Expand Down
1 change: 1 addition & 0 deletions modules/default/weather/weather.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

.weather .precipitation-amount,
.weather .precipitation-prob,
.weather .humidity-hourly,
.weather .uv-index {
padding-left: 20px;
padding-right: 0;
Expand Down
Loading