Rudd-O / homeassistant-meteoswiss

:sun_behind_rain_cloud: :switzerland: Meteo Swiss Integration for Home Assistant (forked from websylv)
74 stars 8 forks source link

Forecast data are missing in attribute #40

Open oliskippy opened 3 months ago

oliskippy commented 3 months ago

I accessed up to now the forecast values like temperature day +1, +2 through the attribute data. They disappeared this week.

oliskippy commented 3 months ago

It seems the forecast service in HA must be used, Weather: Get forecasts. But is not compatible with the integration, cannot be selected.

steuerzentrale commented 3 months ago

I experience the same issue and would be glad for a fix.

mbuerki84 commented 3 months ago

Hello, I have the same issue. I need this data every day for my morning routine. It would be nice if this could be fixed as soon as possible.

Thank you!

mbuerki84 commented 3 months ago

Hello, I have found a solution to the problem. It needs a template sensor to call the forcast data from the weather entity. An example of a template sensor you can find below.

#Wetter forcast
  - trigger:
      - platform: time_pattern
        minutes: /1
    action:
      - service: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.thun
        response_variable: daily
    sensor:
      - name: Weather Forecast Daily
        unique_id: weather_forecast_daily
        state: "{{ now().isoformat() }}"
        attributes:
          forecast: "{{ daily['weather.thun'].forecast }}"

.

oliskippy commented 3 months ago

I used this as a standard, and I always got a service error message. I completely removed and reinstalled the forked version, and now it works fine. Thanks for the incitation !

nliaudat commented 2 months ago

Here is a version to forecast the daily temp tomorrow :

##template: #it’s not a sensor template, it’s a template integration
  - trigger:
      - platform: time_pattern
        minutes: /1
    action:
      - service: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.meteoswiss
        response_variable: response_forecast_daily
    sensor:
      - name: Tomorrow Max Temp
        unique_id: d1b441ec-e9c6-43f8-a50a-c7c5c42c0ef5
        state: "{{ response_forecast_daily['weather.meteoswiss'].forecast[1].temperature }}"

      - name: Tomorrow Min Temp
        unique_id: b88a351c-8eb7-40ae-8a9e-dcfeaa224551
        state: "{{ response_forecast_daily['weather.meteoswiss'].forecast[1].templow }}"

      - name: Tomorrow Mean Temp
        unique_id: 6344f875-4569-4c3f-ad8d-ad6bccc5bc61
        state: "{{ ((response_forecast_daily['weather.meteoswiss'].forecast[1].temperature) + (response_forecast_daily['weather.meteoswiss'].forecast[1].templow)) /2}}"