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

[FR] overhaul of the weather intent, with detailed report #2704

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

bors-ltd
Copy link
Contributor

@bors-ltd bors-ltd commented Dec 2, 2024

The current one would never give the weather condition, as the state was never "clear" or "sunny", but in French already.

The wind description is using the Beaufort scale.

Heavily inspired by the Hungarian template, kudos to RViktor!

I'd like to push it even further, with sentences like "va-t-il pleuvoir/neiger/geler ?", but it requires the Météo-France integration, which not everyone has. I stick to the built-in Met.no integration. Unless there is a way to ship intents along with the Météo-France integration itself.

A more reasonable next step would be "quelle est la météo pour demain ?".

Copy link
Contributor

@jlpouffier jlpouffier left a comment

Choose a reason for hiding this comment

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

Before I even start reviewing this one more closely ☺️ :

Why no test changes?
I would be more comfortable with test changes for this PR to be honest.

Additional note: The build is failing you have an issue in one of your templates ;)

@home-assistant home-assistant bot marked this pull request as draft December 2, 2024 10:38
@home-assistant
Copy link

home-assistant bot commented Dec 2, 2024

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.

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 2, 2024

My bad, I was so excited I forgot the tests. 😊

Working on it as we speak.

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 2, 2024

Tests (force) pushed. I'm open about adjusting the sentences.

@bors-ltd bors-ltd marked this pull request as ready for review December 2, 2024 12:42
@home-assistant home-assistant bot requested a review from jlpouffier December 2, 2024 12:42
responses/fr/HassGetWeather.yaml Outdated Show resolved Hide resolved
responses/fr/HassGetWeather.yaml Outdated Show resolved Hide resolved
responses/fr/HassGetWeather.yaml Outdated Show resolved Hide resolved
responses/fr/HassGetWeather.yaml Outdated Show resolved Hide resolved
responses/fr/HassGetWeather.yaml Outdated Show resolved Hide resolved
Comment on lines 42 to 64
- sentences:
- "(<quelest>|<donnemoi>) la vitesse du vent [<aujourdhui>]"
- "(À|A) <quel> vitesse le vent souffle [<aujourdhui>]"
- "(<quelest>|<donnemoi>) la météo du vent [<aujourdhui>]"
- "(<quelest>|<donnemoi>) le détail du vent [<aujourdhui>]"
response: wind
- sentences:
- "(<quelest>|<donnemoi>) la vitesse du vent [<aujourdhui>] à [<le>]{name}"
- "(À|A) <quel> vitesse le vent souffle [<aujourdhui>] à [<le>]{name}"
- "(<quelest>|<donnemoi>) la météo du vent [<aujourdhui>] (pour|à) [<le>]{name}"
- "(<quelest>|<donnemoi>) le détail du vent (pour|à) [<le>]{name}"
requires_context:
domain: weather
response: wind
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a specific device class under the sensor domain called wind_speed.
I do not think it's a problem we are removing most (if not all) sentences targeting specific device classes under the sensor domain.

@piitaya thoughts?

Copy link
Member

@piitaya piitaya Dec 3, 2024

Choose a reason for hiding this comment

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

If we only target by name, it shouldn't be a issue, right?

@home-assistant home-assistant bot marked this pull request as draft December 2, 2024 13:35
@jlpouffier
Copy link
Contributor

Awesome work ❤️

Review done, some comments added

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 2, 2024

I find myself duplicating too much code, and it's getting worse. But it doesn't seem possible to have macros shared by all of the response templates.

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 2, 2024

And forgot to ask, is there a way to tell if a response is meant to be read or spoken? I'm influenced by the fact my work is destined to my voice assistant. Nothing wrong about displaying "km/h" on the dashboard.

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 2, 2024

The more I test it, the more I doubt my own choices.

Like not trying to describe the wind, but just say "Vent de force 3", and you can ask details about the wind speed.

The same with atmospheric pressure, that may be too much information. Its value is in the trend up or down to predict the weather. I could move it to another intent, to begin with.

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 3, 2024

Updated with the changes I thought about overnight, like just saying the wind force in the detailed report. Instead I moved the air pressure in a separate intent.

I was thinking one way to reduce clutter was having the wind attribute itself provide the Beaufort value. Is that possible through calling the weather integration itself, or some Jinja filter? It looks like the Beaufort scale is used worldwide to justify its integration into HA itself.

I also allowed myself to use smaller sentences like "bulletin météo" or "météo du vent" which are convenient with the text assistant.

Again, I'm open to suggestions on sentences and responses, I'd like something to please everyone, or as many people as possible.

@bors-ltd bors-ltd marked this pull request as ready for review December 3, 2024 10:33
@home-assistant home-assistant bot requested a review from jlpouffier December 3, 2024 10:33
@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 4, 2024

Updated and rebased with "il y a du vent aujourd'hui". Also simplified the detailed report to just mention wind gusts if any.

@bors-ltd
Copy link
Contributor Author

bors-ltd commented Dec 7, 2024

Heavily simplified Beaufort scale computation, now I found about the conversion API in HA core, and borrowed their formula (and rebased).

Edit: ceil rounding is important 😊

@bors-ltd bors-ltd force-pushed the fr_weather branch 2 times, most recently from 4eab281 to cdda814 Compare December 10, 2024 12:47
sentences/fr/_common.yaml Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft December 13, 2024 21:40
@bors-ltd
Copy link
Contributor Author

Thanks, I'll also rebase my branch, I see lots of work have happened in the French section, and hit that "Ready for review" button for a final merge.

I was also thinking about posting on some forum to give people they keys to set up a weather report of their liking.

And I'm still around to maintain and evolve this weather intent.

@bors-ltd bors-ltd force-pushed the fr_weather branch 2 times, most recently from 7e45761 to c4b38b5 Compare December 14, 2024 15:25
@bors-ltd bors-ltd marked this pull request as ready for review December 14, 2024 15:26
@home-assistant home-assistant bot requested a review from jlpouffier December 14, 2024 15:26
The current one would never give the weather condition, as the state was
never "clear" or "sunny", but in French already.

The wind force is using the Beaufort scale.

Try to keep the detailed report both informative and concise.

Heavily inspired by the Hungarian template, kudos to RViktor!
@jlpouffier jlpouffier merged commit 2e30e7e into home-assistant:main Dec 16, 2024
2 checks passed
@bors-ltd bors-ltd deleted the fr_weather branch December 18, 2024 09:17
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.

4 participants