jeroen85 / epaper-display

14 stars 2 forks source link

Breaking Change with 2024.4.0 #3

Closed ZorK766 closed 5 months ago

ZorK766 commented 5 months ago

Hi sorry for the Issue.

I've made my epaper base on Madelena's famous one then, found yours and make my own mix of both.

All was working great until the forecast attribute change introduce in 2024.4.0.

Since I'm trying to update my code, without success.

I'm wondering if you have update yours, so maybe I would manage to get mine working again by taking a look at it.

Best regards.

Here why I'm trying to do, but seems I'm missing something:

` - trigger: platform: time_pattern minutes: "/1"

  action:
    - service: weather.get_forecasts
      data:
        type: hourly
      target:
        - entity_id: weather.castetnau
        - entity_id: weather.openweathermap
      response_variable: hourly

  sensor:
    - name: e-paper display data
      unique_id: e_paper_display_data 
      icon: ios:display-2
      availability: "true"
      state: "OK"
      attributes:

        weather_condition_now: >
          {% set cond_now = states('weather.castetnau') %}
          {% if states('sun.sun') == 'below_horizon' %}
              {% if cond_now == 'sunny' %} night {% elif cond_now == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond_now }} {% endif %}
          {% else %}
              {{ cond_now }}
          {% endif %}

        weather_temperature_now: >
          {{ hourly['weather.openweathermap'].forecast[0].temperature | round(1) }}            

        weather_temperature_today: >
          {{ state_attr('weather.openweathermap', 'forecast')[0].temperature | round(1) }}

        weather_templow_today: >
          {{ state_attr('weather.openweathermap', 'forecast')[0].templow | round(1) }}  

        weather_rain_today: >
          {{ state_attr('weather.openweathermap', 'forecast')[0].precipitation | round(1) }}    

        weather_wind_speed_now: >
          {{ state_attr('weather.openweathermap', 'wind_speed') | round(1) }}  

        weather_wind_force_now: >
          {{ states('sensor.buienradar_wind_force') }}  

        weather_wind_direction_now: >
          {% set wind = state_attr('weather.openweathermap', 'wind_bearing') %}
          {% if wind >= 348.75 or wind <= 11.25 %}
          N
          {% elif wind >= 11.25 and wind <= 33.75 %}
          NNE
          {% elif wind >= 33.75 and wind <= 56.25 %}
          NE
          {% elif wind >= 56.25 and wind <= 78.75 %}
          ENE
          {% elif wind >= 78.75 and wind <= 101.25 %}
          E
          {% elif wind >= 101.25 and wind <= 123.75 %}
          ESE
          {% elif wind >= 123.75 and wind <= 146.25 %}
          SE
          {% elif wind >= 146.25 and wind <= 168.75 %}
          SSE
          {% elif wind >= 168.75 and wind <= 191.25 %}
          S
          {% elif wind >= 191.25 and wind <= 213.75 %}
          SSO
          {% elif wind >= 213.75 and wind <= 236.25 %}
          SO
          {% elif wind >= 236.25 and wind <= 258.75 %}
          OSO
          {% elif wind >= 258.75 and wind <= 281.25 %}
          O
          {% elif wind >= 281.25 and wind <= 303.75 %}
          ONO
          {% elif wind >= 303.75 and wind <= 326.25 %}
          NO
          {% elif wind >= 326.25 and wind <= 348.75 %}
          NNO
          {% else %}
          ?
          {% endif %}

        weather_condition_0: >
          {{ hourly['weather.openweathermap'].forecast[0+1].condition }}
        weather_temperature_0: >
          {{ hourly['weather.openweathermap'].forecast[0+1].temperature | round(1) }}
        weather_templow_0: >
          {{ hourly['weather.openweathermap'].forecast[0+1].templow | round(1) }}  
        weather_rain_0: >
          {{ hourly['weather.openweathermap'].forecast[0+1].precipitation | round(1) }}                        
        weather_day_0: >
          {% set days = ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'] %}
          {{ days[as_timestamp(state_attr('weather.openweathermap', 'forecast')[0+1].datetime) | timestamp_custom('%w') | int] }}`
ZorK766 commented 5 months ago

Sorry, finally found the issue.

It seems that OpenWeatherMap dosn't have (yet ?) integrated the full new forecast system and only works with "Daily".

So i finally switch to another metéo provider, change the "Hourly" to "Daily" in my code and all works as intended now:

I've choose the Norwegian Meteorological Institute integration because I'm French and the "Meteo France" prévisions sucks. Openweather map was more accurate and the Norvegian Ones seems to be close.

Posting it here anyway in case it help somebody.

Regards.

`