Skip to content

feat: round_temperature on weather forecast card#28103

Merged
MindFreeze merged 5 commits into
home-assistant:devfrom
flixlix:dev
Dec 3, 2025
Merged

feat: round_temperature on weather forecast card#28103
MindFreeze merged 5 commits into
home-assistant:devfrom
flixlix:dev

Conversation

@flixlix
Copy link
Copy Markdown
Contributor

@flixlix flixlix commented Nov 25, 2025

Proposed change

I noticed there's no ease way to round the temperature in the weather forecast card to the nearest integers, so I added the round_temperature functionality to it. This is a boolean and when enabled is used to round all temperature numbers to their nearest integer.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

type: weather-forecast
show_current: true
show_forecast: true
entity: weather.forecast_home
forecast_type: daily
round_temperature: true

Additional information

I used some checks to make sure that only temperatures are being rounded. From my testing this works for all values, including secondary_info's. For example, pressure is not being rounded, even with this turned on.

Before (or with `round_temperature: false)

Screenshot 2025-11-25 at 15 13 29

After (only with `round_temperature: true)

Screenshot 2025-11-25 at 15 13 14

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Copy link
Copy Markdown

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

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

Hi @flixlix

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Comment thread src/translations/en.json
},
"weather": {
"attributes": {
"dew_point": "Dew point",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also noticed that this was missing before in the translation file, leading to an error in my change at https://github.com/home-assistant/frontend/pull/28103/files#diff-4f7195942cc7cdfbd5ad6149411b2d6fb641035063b8711026e641d7f1a2a606R276

@flixlix flixlix marked this pull request as ready for review November 25, 2025 15:29
@MindFreeze
Copy link
Copy Markdown
Member

If the option is a number instead of a boolean, it would make it more flexible but I wonder if setting to 2+ digits (15.23 C) would be useful at all 🤔

@flixlix
Copy link
Copy Markdown
Contributor Author

flixlix commented Nov 27, 2025

@MindFreeze yeah, at first I had implemented that option but came to the same conclusion as you. it was specially confusing inside the editor, because there was a slider / number input for this option. nonetheless, I kept this logic inside the card, in case this should be changed in the future. Whatever the temperatureFractionDigits variable is, will be the precision set. https://github.com/home-assistant/frontend/pull/28103/files#diff-4f7195942cc7cdfbd5ad6149411b2d6fb641035063b8711026e641d7f1a2a606R270-R272

Comment thread src/data/weather.ts Outdated
Comment thread src/panels/lovelace/cards/hui-weather-forecast-card.ts
Comment thread src/panels/lovelace/cards/hui-weather-forecast-card.ts Outdated
@home-assistant home-assistant Bot marked this pull request as draft December 1, 2025 06:45
@flixlix
Copy link
Copy Markdown
Contributor Author

flixlix commented Dec 1, 2025

@MindFreeze thank you for the review, I've tried to correct all issues

@flixlix flixlix marked this pull request as ready for review December 1, 2025 14:50
@home-assistant home-assistant Bot requested a review from MindFreeze December 1, 2025 14:50
Comment thread src/data/weather.ts
Comment thread src/panels/lovelace/cards/hui-weather-forecast-card.ts Outdated
@flixlix flixlix marked this pull request as ready for review December 2, 2025 16:05
@home-assistant home-assistant Bot requested a review from MindFreeze December 2, 2025 16:06
@MindFreeze MindFreeze merged commit e7254b1 into home-assistant:dev Dec 3, 2025
15 checks passed
@oerix
Copy link
Copy Markdown

oerix commented Dec 4, 2025

Does this not support weather data from other sources? I can't seem to get it working.
Also, wouldn't it make sense to integrate this in the entity settings using Display precision instead, so it applies everywhere else?

Screenshot 2025-12-04 at 12 36 23

@MindFreeze
Copy link
Copy Markdown
Member

This is not in the 2025.12 release if you are trying it there. It will be in 2026.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants