Bonjour,
Je cherche à recevoir une notif chaque matin sur le temps du jour ainsi que les min/max.
J’ai vu ce code template :
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- action: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.xxxx
response_variable: daily
sensor:
- name: Weather Forecast Jour xxxx
unique_id: weather_forecast_jour_xxxx
state: "{{ daily['weather.xxxx'].forecast[0].condition }}"
attributes:
forecast: "{{ daily['weather.xxxx'].forecast }}"
availability: "{{ states('weather.xxxx') not in ['unknown', 'unavailable', 'none'] }}"
Mais actuellement dans mon template.yaml, j’ai ça :
sensor:
- name: "Vigilance_Vent"
state: "{{ state_attr('sensor.28_weather_alert', 'Vent violent') }}"
et l’ajout du trigger à la suite me met une erreur ? comment ajouter le code à la suite ?
Merci
Hello,
Tu ne prends pas la bonne entité météo, tu a pris les alertes météo
les alertes remontent juste les alertes
cdt
sensor:
- name: "Vigilance_Vent"
state: "{{ state_attr('sensor.28_weather_alert', 'Vent violent') }}"
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- action: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.xxx
response_variable: daily
sensor:
- name: Weather Forecast Jour xxxx
unique_id: weather_forecast_jour_xxxx
state: "{{ daily['weather.xxxx'].forecast[0].condition }}"
attributes:
forecast: "{{ daily['weather.xxxx'].forecast }}"
availability: "{{ states('weather.xxxx') not in ['unknown', 'unavailable', 'none'] }}"
C’était un exemple mon sensor vigilance, j’essaie juste de mettre le trigger à la suite mais sans succès
Re,
Regarde le topic que j’ai linké, l’indentation de ton code n’est pas bonne
cdt
Justement, je ne vois pas comment ajouter ce trigger aux autres sensors déjà créés
edit : j’ai trouvé l’indentation correcte
Par contre, comment avoir l’état en français ?
j’ai essayé ça mais il me retourne une erreur
- name: "Traduction Meteo"
state: >
{% if is_state("weather_forecast_jour_xxxx","clear") or is_state("weather_forecast_jour_xxxx","clear-night")%}
clair
{% elif is_state("weather_forecast_jour_xxxx","sunny")%}
ensoleillé
{% elif is_state("weather_forecast_jour_xxxx","cloudy")%}
nuageux
{% elif is_state("weather_forecast_jour_xxxx","partlycloudy")%}
part. nuageux
{% elif is_state("weather_forecast_jour_xxxx","rainy")%}
pluvieux
{% endif %}
Bonjour,
la bonne syntaxe :
- sensor:
- name: "Vigilance_Vent"
state: "{{ state_attr('sensor.28_weather_alert', 'Vent violent') }}"
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- action: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.xxxx
response_variable: daily
sensor:
- name: Weather Forecast Jour xxxx
unique_id: weather_forecast_jour_xxxx
state: "{{ daily['weather.xxxx'].forecast[0].condition }}"
attributes:
forecast: "{{ daily['weather.xxxx'].forecast }}"
availability: "{{ states('weather.xxxx') not in ['unknown', 'unavailable', 'none'] }}"
c’est sensor.weather_forecast_jour_xxxx et pas weather_forecast_jour_xxxx.
sinon, tu as state_translated qui traduit directement une entité.
{{ state_translated("weather.pas_de_la_case") }}