Forecast 1-7 jour de Météo France sur openhasp

Bonjour tout le monde,

Je recherche a utiliser les données de Météo France et de les envoyer sur un écran déporté tournant sous openhasp.
J’ai déjà pu récupéré des infos du jour en cours, le temps qu’il fait la température et autre, mais je n’arrive pas pour les jours à venir.
Je précise que je suis tout nouveau sur home assistant et openhasp.
Je vous remercie tous par avance pour votre aide

Bonjour,
regarde mon sujet sur OpenHASP, je met le code pour le template et pour openhasp.yaml

tu dois créer un template, pour récupérer les forecasts des jours :

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: homeassistant
        event: start
    action:
      - action: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.xxxxx
        response_variable: daily
    sensor:
      - name: Weather Forecast Jour XXXX
        unique_id: weather_forecast_jour_XXXXX
        state: "{{ daily['weather.xxxxx'].forecast[0].condition }}"
        attributes:
          forecast: "{{ daily['weather.xxxxx'].forecast }}"

puis un template pour openhasp:

template:
  - sensor:
      - name: Météo xxxx J0
        unique_id: meteo_xxxx_j0
        state: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[0].condition | default(0) }}"
        attributes: 
          temperature: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[0].temperature | float(0) }}"
          templow: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[0].templow | float(0) }}"
          humidite: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[0].humidity | int(0) }}"
          precipitation: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[0].precipitation | float(0) }}"
        availability:  "{{ states('sensor.weather_forecast_jour_xxxx') not in ['unknown', 'unavailable', 'none'] }}"
      - name: Météo xxxx J1
        unique_id: meteo_xxxx_j1
        state: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[1].condition | default(0) }}"
        attributes: 
          temperature: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[1].temperature | float(0) }}"
          templow: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[1].templow | float(0) }}"
          humidite: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[1].humidity | int(0) }}"
          precipitation: "{{ state_attr('sensor.weather_forecast_jour_xxxx','forecast')[1].precipitation | float(0) }}"
        availability:  "{{ states('sensor.weather_forecast_jour_xxxx') not in ['unknown', 'unavailable', 'none'] }}"

Les templates se mettent dans le configuration.yaml ( verifier la configuration de HA, avant de redémarrer dans outils de dev / verifier configuration ).
Tu dois déclaré une seule fois le template: , le - trigger: et - sensor: ce mettent a la suite.

Regarde la doc pour plus d’information:

Merci beaucoup pour votre aide.
J’ai cependant 2-3 interrogation.
Si je me trompe pas le 1er template avec le trigger, ce ne serait pas une automatisation? Si telle est le cas pourquoi le mettre dans le fichier configuration et pas créer directement une automatisation? il y a une raison à cela?
J’ai aussi un fichier qui s’appelle openhasp.yaml je ne pourrais pas mettre directment un des attributs du 2eme template dans ce fichier.
Merci encore pour m’avoir aidé

Non, ce n’est pas une automatisation, c’est bien un template trigger. C’est comme une automatisation, mais pour un sensor.

Oui, c’est possible. J’utilisais ce template pour un ESP à la base pour me faciliter les données. Je l’ai réutilisé pour openhasp.

Exemple de mon openhasp.yaml :

      - obj: "p2b149" # Current weather icon j0
        properties:
          "text": >
             {% if states('sensor.meteo_xxxx_j0') == "clear-night" -%}
             {{ "\uE594" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'cloudy' -%}
             {{ "\uE590" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'fog' -%}
             {{ "\uE591" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'hail' -%}
             {{ "\uE592" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'lightning' -%}
             {{ "\uE593" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'lightning-rainy' -%}
             {{ "\uE67E" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'partlycloudy' -%}
             {{ "\uE595" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'pouring' -%}
             {{ "\uE596" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'rainy' -%}
             {{ "\uE597" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'snowy' -%}
             {{ "\uE598" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'snowy-rainy' -%}
             {{ "\uE67F" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'sunny' -%}
             {{ "\uE5A8" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'windy' -%}
             {{ "\uE59D" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'windy-variant' -%}
             {{ "\uE59E" }}
             {% elif states('sensor.meteo_xxxx_j0') == 'unavailable' -%}
             {{ "\uE156" }}
             {% else -%}
             {{ "\uE5A8" }}
             {% endif -%}
      - obj: "p2b150" # Current weather icon j1
        properties:
          "text": >
             {% if states('sensor.meteo_xxxx_j1') == "clear-night" -%}
             {{ "\uE594" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'cloudy' -%}
             {{ "\uE590" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'fog' -%}
             {{ "\uE591" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'hail' -%}
             {{ "\uE592" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'lightning' -%}
             {{ "\uE593" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'lightning-rainy' -%}
             {{ "\uE67E" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'partlycloudy' -%}
             {{ "\uE595" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'pouring' -%}
             {{ "\uE596" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'rainy' -%}
             {{ "\uE597" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'snowy' -%}
             {{ "\uE598" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'snowy-rainy' -%}
             {{ "\uE67F" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'sunny' -%}
             {{ "\uE5A8" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'windy' -%}
             {{ "\uE59D" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'windy-variant' -%}
             {{ "\uE59E" }}
             {% elif states('sensor.meteo_xxxx_j1') == 'unavailable' -%}
             {{ "\uE156" }}
             {% else -%}
             {{ "\uE5A8" }}
             {% endif -%}
      - obj: "p2b151"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j0','temperature') }}°C"
      - obj: "p2b152"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j0','templow') }}°C"
      - obj: "p2b155"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j0','humidite') }}%"
      - obj: "p2b157"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j0','precipitation') |float(0) |round(0)}}mm"
      - obj: "p2b159"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j1','temperature') }}°C"
      - obj: "p2b160"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j1','templow') }}°C"
      - obj: "p2b163"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j1','humidite') }}%"
      - obj: "p2b165"
        properties:
          "text": "{{ state_attr('sensor.meteo_xxxx_j1','precipitation') |float(0) |round(0) }}mm"

exemple du page.jsonl:

{"page":2,"id":102,"obj":"label","x":575,"y":45,"w":140,"h":25,"text":"Aujourd'hui","text_font":16,"align":1,"text_color":"#2C3E50"}
{"page":2,"id":103,"obj":"label","x":695,"y":45,"w":100,"h":25,"text":"Demain","text_font":16,"align":1,"text_color":"#2C3E50"}
{"page":2,"id":149,"obj":"btn","x":615,"y":75,"w":58,"h":60,"toggle":false,"text":"\uE5A8","text_font":50,"border_side":0,"bg_color":"#2C3E50","text_color":"#FFFFFF"}
{"page":2,"id":150,"obj":"btn","x":715,"y":75,"w":58,"h":60,"toggle":false,"text":"\uE5A8","text_font":50,"border_side":0,"bg_color":"#2C3E50","text_color":"#FFFFFF"}
{"page":2,"id":151,"obj":"label","x":625,"y":145,"w":70,"h":22,"text":"00.0°C","text_font":22,"align":0,"text_color":"#ff0000"}
{"page":2,"id":152,"obj":"label","x":625,"y":169,"w":70,"h":22,"text":"00.0°C","text_font":22,"align":0,"text_color":"#0000ff"}
{"page":2,"id":153,"obj":"label","x":596,"y":142,"w":24,"h":26,"text":"\uE50F","text_font":24,"align":0,"text_color":"#ff0000"}
{"page":2,"id":154,"obj":"label","x":596,"y":166,"w":24,"h":26,"text":"\uE50F","text_font":24,"align":0,"text_color":"#0000ff"}
{"page":2,"id":155,"obj":"label","x":625,"y":194,"w":70,"h":22,"text":"00%","text_font":22,"align":0,"text_color":"#0000ff"}
{"page":2,"id":156,"obj":"label","x":596,"y":191,"w":24,"h":26,"text":"\uE58E","text_font":24,"align":0,"text_color":"#0000ff"}
{"page":2,"id":157,"obj":"label","x":625,"y":218,"w":75,"h":22,"text":"00.0mm","text_font":22,"align":0,"text_color":"#2C3E50"}
{"page":2,"id":158,"obj":"label","x":596,"y":215,"w":24,"h":26,"text":"\uE58C","text_font":24,"align":0,"text_color":"#2C3E50"}
{"page":2,"id":159,"obj":"label","x":725,"y":145,"w":70,"h":22,"text":"00.0°C","text_font":22,"align":0,"text_color":"#ff0000"}
{"page":2,"id":160,"obj":"label","x":725,"y":169,"w":70,"h":22,"text":"00.0°C","text_font":22,"align":0,"text_color":"#0000ff"}
{"page":2,"id":161,"obj":"label","x":696,"y":142,"w":24,"h":26,"text":"\uE50F","text_font":24,"align":0,"text_color":"#ff0000"}
{"page":2,"id":162,"obj":"label","x":696,"y":166,"w":24,"h":26,"text":"\uE50F","text_font":24,"align":0,"text_color":"#0000ff"}
{"page":2,"id":163,"obj":"label","x":725,"y":194,"w":70,"h":22,"text":"00%","text_font":22,"align":0,"text_color":"#0000ff"}
{"page":2,"id":164,"obj":"label","x":696,"y":191,"w":24,"h":26,"text":"\uE58E","text_font":24,"align":0,"text_color":"#0000ff"}
{"page":2,"id":165,"obj":"label","x":725,"y":218,"w":75,"h":22,"text":"00.0mm","text_font":22,"align":0,"text_color":"#2C3E50"}

Résultat sur l’écran :

Après, tu adaptes à ton besoin :wink:

Merci pour ton aide et les explications.
Ca fais plaisir de voir de la réactivité sur un forum.
Cordialement