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] weather state is now exposed raw and untranslated #2910

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions responses/fr/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@ responses:
intents:
HassGetWeather:
default: >
{# Reuse weather condition already formatted and translated #}
{# just invert telling the condition then temperature #}
{{ state.state }}
{% set weather_condition = {
'clear-night': 'Nuit dégagée',
'cloudy': 'Nuageux',
'exceptional': 'Conditions exceptionnelles',
'fog': 'Brouillard',
'hail': 'Grêle',
'lightning': 'Orageux',
'lightning-rainy': 'Orageux avec de la pluie',
'partlycloudy': 'Éclaircies',
'pouring': 'Averses',
'rainy': 'Pluvieux',
'snowy': 'Neigeux',
'snowy-rainy': 'Neigeux avec pluie mêlée',
'sunny': 'Ensoleillé',
'windy': 'Venteux',
'windy-variant': 'Venteux et nuageux',
} %}
{{ weather_condition.get(state.state | string, "") }}
Copy link
Contributor Author

@bors-ltd bors-ltd Jan 24, 2025

Choose a reason for hiding this comment

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

I assumed the future behaviour already, so I don't "lower" like most weather intents do today.

Edit: But I kept their behaviour of having no fallback when the value is unknown/unavailable.


{% set temperature = state.attributes.get('temperature') %}
{% if temperature is number %}
Expand Down Expand Up @@ -131,8 +146,24 @@ responses:
{% endif %}

detailed_weather: >
{# Reuse weather condition already formatted and translated #}
{{ state.state }}
{% set weather_condition = {
'clear-night': 'Nuit dégagée',
'cloudy': 'Nuageux',
'exceptional': 'Conditions exceptionnelles',
'fog': 'Brouillard',
'hail': 'Grêle',
'lightning': 'Orageux',
'lightning-rainy': 'Orageux avec de la pluie',
'partlycloudy': 'Éclaircies',
'pouring': 'Averses',
'rainy': 'Pluvieux',
'snowy': 'Neigeux',
'snowy-rainy': 'Neigeux avec pluie mêlée',
'sunny': 'Ensoleillé',
'windy': 'Venteux',
'windy-variant': 'Venteux et nuageux'
} %}
{{ weather_condition.get(state.state | string, "") }}

{% set temperature = state.attributes.get('temperature') %}
{% if temperature is number %}
Expand Down
4 changes: 2 additions & 2 deletions tests/fr/_fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ entities:

- name: "Paris"
id: "weather.paris"
state: Pluvieux
state: rainy
attributes:
temperature: 10.3
temperature_unit: "°C"
Expand All @@ -780,7 +780,7 @@ entities:

- name: "Brest"
id: "weather.brest"
state: Ensoleillé
state: sunny
attributes:
temperature: 24.9
temperature_unit: "°C"
Expand Down
Loading