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

[BUG] Weather card no longer works in HA 2024.4 #1204

Closed
2 tasks
tetele opened this issue Mar 28, 2024 · 46 comments
Closed
2 tasks

[BUG] Weather card no longer works in HA 2024.4 #1204

tetele opened this issue Mar 28, 2024 · 46 comments
Labels
bug Something isn't working

Comments

@tetele
Copy link

tetele commented Mar 28, 2024

PROBLEM DESCRIPTION

The weather card used as a screensaver cannot display anything when connected to HA 2024.4.0b0 due to the removal of the forecast attribute for weather entities. It worked well in 2024.3.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Provide your apps.yaml (or your config):
  apps.yaml here:
# irrelevant

  • Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:
  Log output here:
# irrelevant

TO REPRODUCE

Install HA 2024.4 beta and look at the NSPanel

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

SCREENSHOTS

If applicable, add screenshots/pictures to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.
Please note here in case you are using ioBroker

PANEL / FIRMWARE VERSION

Please add the Panel/Firmware Version you are using (EU, US-L or US-P)
EU panel, Tasmota 13.4.0, HA 2024.4 beta

@tetele tetele added the bug Something isn't working label Mar 28, 2024
@joBr99
Copy link
Owner

joBr99 commented Mar 28, 2024

Thanks for the heads-up, will try to fix this over the weekend.

Unfortunately this is still blocked by upstream, but it looks like there is now a workaround.

AppDaemon/appdaemon#1837

@joBr99

This comment was marked as outdated.

@joBr99
Copy link
Owner

joBr99 commented Mar 30, 2024

came up with a different workaround to keep home assistant providing the forecast as an entity

https://docs.nspanel.pky.eu/stable/prepare_ha/#workaround-for-homeassistant-202404

This also requires two slight changes in the backed to force the entity type of this newly created sensor to weather. So it also requires an update of the backend to current dev version.

(or you just do those two changes manually)
d94d937
e5c1f05

@joBr99
Copy link
Owner

joBr99 commented Mar 30, 2024

Released the changes in 4.4.0

For anyone updating please note that you need to have app_dir in your appdaemon.yaml for HACS to be working, see #1029

@joBr99 joBr99 pinned this issue Mar 30, 2024
@joBr99 joBr99 closed this as completed Mar 30, 2024
@joBr99 joBr99 changed the title [BUG] Weather card (used as screensaver) no longer works in HA 2024.4 [BUG] Weather card no longer works in HA 2024.4 Mar 30, 2024
@tetele
Copy link
Author

tetele commented Apr 1, 2024

Thank you!

@tetele
Copy link
Author

tetele commented Apr 1, 2024

Something's a bit off. I'll debug when i have the time, but just letting you know @joBr99

20240401_173504

@joBr99
Copy link
Owner

joBr99 commented Apr 1, 2024

looks like the entity you specified in your config doesn't exist

@tetele
Copy link
Author

tetele commented Apr 1, 2024

Right. I forgot to change the domain from weather to sensor, but even after changing it it has some issues

20240401_181157

@joBr99
Copy link
Owner

joBr99 commented Apr 1, 2024

don't change the first entity - also there's something wrong with your update to the latest version of the appdaemon app - either you forgot to restart appdaemon or you didn't follow all steps during the appdaemon 15 update and you are still accessing an old copy of the app
#1029

@tetele
Copy link
Author

tetele commented Apr 2, 2024

What I did was name the sensor differently and NOT add that name in the overrides you mentioned. Sorry, I was super tired yesterday and not able to pay attention to what I was doing.

I still have an issue with the current weather condition (it's not showing), but I'll debug that one myself. Thanks a lot for your help and swiftness!

@tetele
Copy link
Author

tetele commented Apr 2, 2024

Your template sensor needs a proper state and a temperature attribute @joBr99 , otherwise the current condition will look like this

20240402_173004

The full template i used is this:

template:
  - trigger:
      - platform: time_pattern
        hours: /1
    action:
      - service: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.home
        response_variable: daily
    sensor:
      - name: Weather Forecast Daily
        unique_id: weather_forecast_daily
        state: "{{ states('weather.home') }}"
        attributes:
          temperature: "{{ state_attr('weather.home', 'temperature') }}"
          temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}"
          forecast: "{{ daily['weather.home'].forecast }}"

Note that you can't trigger a manual update for the sensor, you have to either wait for XX:00 or add other triggers.

@joBr99
Copy link
Owner

joBr99 commented Apr 2, 2024

I just used the normal weather entity for the for the current condition, as this isn't part of the forecast and the workaround is only required for the forecast. (Thanks for the template, might be a good idea to exchange the one in the documentation, to avoid confusion)

@tetele
Copy link
Author

tetele commented Apr 2, 2024

I was not aware you can have one entity for current condition and another for forecast.

@joBr99
Copy link
Owner

joBr99 commented Apr 2, 2024

You can configure each item individually:

    screensaver:
      entities:
        - entity: weather.demo_weather_north
        - entity: weather.demo_weather_north
          type: 0
        - entity: weather.demo_weather_north
          type: 1
        - entity: weather.demo_weather_north
          type: 2
        - entity: sensor.energy_usage

I guess you are using the old config way with one weather entity for the screensaver? Didn't really think about that one.

@tetele
Copy link
Author

tetele commented Apr 2, 2024

That is what i was using, yes.

@TheGroundZero
Copy link

TheGroundZero commented Apr 3, 2024

Just a small remark.

If the state (and attributes) of weather.home is stored in the daily variable, you can pull all template data from said variable? Or skip the variable all together and use the source entity for the template?

# ...
sensor:
  - name: Weather Forecast Daily
    unique_id: weather_forecast_daily
    state: "{{ daily['weather.home'] }}"
    attributes:
      temperature: "{{ daily['weather.home'].temperature }}"
      temperature_unit: "{{ daily['weather.home'].temperature_unit }}"
      forecast: "{{ daily['weather.home'].forecast }}"

or

# ...
sensor:
  - name: Weather Forecast Daily
    unique_id: weather_forecast_daily
    state: "{{ states('weather.home') }}"
    attributes:
      temperature: "{{ state_attr('weather.home', 'temperature') }}"
      temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}}"
      forecast: "{{ state_attr('weather.home', 'forecast') }}"

The code on this project's docs also mixes 2 entities (weather.home and weather.k3ll3r).
https://docs.nspanel.pky.eu/stable/prepare_ha/#installing-lovelace-appdaemon-backend-application

Semantically it's also weird to use a variable named daily even though the trigger is hourly.
There's an example code snipper on the HA docs that closely matches the template used here and it uses hourly as variable name: https://www.home-assistant.io/integrations/template/#trigger-based-handling-of-service-response-data

I also don't see a real reason to make this a trigger-based template but I might be overlooking something?

@joBr99
Copy link
Owner

joBr99 commented Apr 3, 2024

With the upcoming homeassistant version the weather entities are no longer providing the forecast attribute and the forecast has to be pulled though the weather.get_forecasts service. As appdaemon currently doesn't support calling services with a response, we still need an entity containing this data - this entity is generated with the trigger template.

For the current temperature it doesn't really matter if you are using the variable or the current state.

In homeassistant's example they are using the data type hourly for the forecast. In my example the data type daily is used. (would be possible to rename the variable to forecast or something like that to make it a bit more universal)
However the daily forecast entity is updated hourly, as it's possible that the forecast is changing during the day ;)

@denislooby
Copy link

Working good for me using this now.
Took a while, I missed the bit about the upgrade to AppDaemon 15 #1029
So my update in HACS was having no effect.
If you are seeing ! instead of weather symbols follow that upgrade to appdaemon 15 how to.

@ppaciekq
Copy link

ppaciekq commented Apr 4, 2024

I used the workaround described here:
https://docs.nspanel.pky.eu/stable/prepare_ha/#installing-lovelace-appdaemon-backend-application

but I still have a problem.

The screen looks like this:
image

and this is what the configuration.yaml and apps.yaml files look like:

image
image

image

what am I doing wrong? Any ideas?

@joBr99
Copy link
Owner

joBr99 commented Apr 4, 2024

adjust the weather.k3ll3r in your template to your weather entity weather.home

@ppaciekq
Copy link

ppaciekq commented Apr 4, 2024

yes, I noticed it and after changing it it actually works - thanks! However, only today's weather is visible.
Is it possible to somehow add a view of the next few days?

@joBr99
Copy link
Owner

joBr99 commented Apr 4, 2024

319624684-b7026317-b8cf-4d88-b96e-fae92ed64fbf~2

@ppaciekq
Copy link

ppaciekq commented Apr 4, 2024

I changed it here. So I understand that after 1 hour the trigger should change it?

@joBr99
Copy link
Owner

joBr99 commented Apr 4, 2024

Check the data of the sensor.weather forecast daily entity - forecast data must be populated there

Maybe you can trigger the template by restarting HA, not sure.

@ppaciekq
Copy link

ppaciekq commented Apr 4, 2024

image

data in forecast home are visible correctly (daily and hourly):
image

@joBr99
Copy link
Owner

joBr99 commented Apr 4, 2024

please check on this page:

image

@tetele
Copy link
Author

tetele commented Apr 4, 2024

Maybe you can trigger the template by restarting HA, not sure.

It won't. Only triggers can update trigger-based sensors.

What I did was this

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: event
        event_type: event_template_reloaded
# everything else

then go to the Developer tools and reload Template entities.

If that doesn't work, try this

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: event
        event_type: manual_event_template_reloaded

and add this automation:

alias: Re-emit event_template_reloaded event
description: >-
  In order to update trigger-based `template` entities, to prevent a race
  condition, I need to re-emit the `event_template_reloaded` event.
trigger:
  - platform: event
    event_type: event_template_reloaded
    event_data: {}
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - event: manual_event_template_reloaded
    event_data: {}
mode: single

then reload the Template entities

@ppaciekq
Copy link

ppaciekq commented Apr 4, 2024

image
of course HA was restarted

@ppaciekq
Copy link

ppaciekq commented Apr 5, 2024

Maybe you can trigger the template by restarting HA, not sure.

It won't. Only triggers can update trigger-based sensors.

What I did was this

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: event
        event_type: event_template_reloaded
# everything else

then go to the Developer tools and reload Template entities.

If that doesn't work, try this

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: event
        event_type: manual_event_template_reloaded

and add this automation:

alias: Re-emit event_template_reloaded event
description: >-
  In order to update trigger-based `template` entities, to prevent a race
  condition, I need to re-emit the `event_template_reloaded` event.
trigger:
  - platform: event
    event_type: event_template_reloaded
    event_data: {}
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - event: manual_event_template_reloaded
    event_data: {}
mode: single

then reload the Template entities

I made the changes you wrote about and now the configuration looks like this:

image

forecast seems to be working properly now:

image

but there is still no information about the next few days and the icons are also missing:

image

@tetele
Copy link
Author

tetele commented Apr 5, 2024

Quoting joBr99's comment:

This also requires two slight changes in the backed to force the entity type of this newly created sensor to weather. So it also requires an update of the backend to current dev version.
(or you just do those two changes manually)
d94d937
e5c1f05

Have you done that too?

@ppaciekq
Copy link

ppaciekq commented Apr 5, 2024

Quoting joBr99's comment:

This also requires two slight changes in the backed to force the entity type of this newly created sensor to weather. So it also requires an update of the backend to current dev version.
(or you just do those two changes manually)
d94d937
e5c1f05

Have you done that too?

Actually - I missed it. I have already added it and the icons are visible. Thanks for the help!

@azsoccerpop
Copy link

Apologies for jumping on but I am stuck on the weather fix. I changed my weather integration to Pirate Weather which correctly response to the service.get_forecasts and populates sensor.weather_forecast_daily with all the correct information as verified in the developer tools States. AppDaemon is at latest version NSPanel Lovelace UI is v4.4.0. AppDaemon Log shows this: 2024-04-05 14:43:59.185926 INFO nspanel-1: Sending MQTT Message: weatherUpdate~~~���31728PirateWeather67��F~~~���17299Weather Forecast Dailyclou ~~~���17299Weather Forecast Dailyclou ~~~���17299Weather Forecast Dailyclou ~~~���17299Weather Forecast Daily~clou
apps.yaml
screensaver: entities: - entity: weather.pirateweather - entity: sensor.weather_forecast_daily type: 0 - entity: sensor.weather_forecast_daily type: 1 - entity: sensor.weather_forecast_daily type: 2 - entity: sensor.weather_forecast_daily type: 3
not sure what my next step is and any help is appreciated.

@joBr99
Copy link
Owner

joBr99 commented Apr 5, 2024

are you sure that you are on v4.4.0?
did you restart appdaemon?
is appdaemon using the stuff downloaded from hacs? (only the case if you have app_dir in your appdaemon.yaml) see #1029

@azsoccerpop
Copy link

Thank you so much!
I had not configured app_dir: /homeassistant/appdaemon/apps/ in the appdaemon.yaml.
All is well.

@rockyhopper
Copy link

Thank you so much!
I had not configured app_dir: /homeassistant/appdaemon/apps/ in the appdaemon.yaml.
All is well.

Same issue for me. Solved for me too.
Thanks a lot.

@filipsworks
Copy link

filipsworks commented Apr 13, 2024

came up with a different workaround to keep home assistant providing the forecast as an entity

https://docs.nspanel.pky.eu/stable/prepare_ha/#workaround-for-homeassistant-202404

This also requires two slight changes in the backed to force the entity type of this newly created sensor to weather. So it also requires an update of the backend to current dev version.

(or you just do those two changes manually) d94d937 e5c1f05

It would be great to add homeassistant start trigger to that template as at least for me restarting the HA does not update the template itself:

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: homeassistant
        event: start

@joBr99
Copy link
Owner

joBr99 commented Apr 13, 2024

thanks, good idea added to the documentation

@soyxan
Copy link

soyxan commented May 15, 2024

I have implemented the workaround configuration in my HA but this is the result I get in my nspanel:

20240515_091326

As you can see the current and forecast temperatures are fine, but the weather conditions icons and the weekdays names are missing. These were working fine before the AppDaemon issue.

This is my configuration.yaml:

template:
  - trigger:
      - platform: time_pattern
        hours: /1
      - platform: homeassistant
        event: start
    action:
      - service: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.aemet # change to your weather entity
        response_variable: daily
    sensor:
      - name: Weather Forecast Daily
        unique_id: weather_forecast_daily
        state: "{{ states('weather.aemet') }}" # # change to your weather entity in this line
        attributes:
          temperature: "{{ state_attr('weather.aemet', 'temperature') }}" # change to your weather entity
          temperature_unit: "{{ state_attr('weather.aemet', 'temperature_unit') }}" # change to your weather entity
          forecast: "{{ daily['weather.aemet'].forecast }}" # change to your weather entity

And this is my screensaver configuration in apps.yaml:

nspanel_salon:
  module: nspanel-lovelace-ui
  class: NsPanelLovelaceUIManager
  config:
    screensaver:
      entities:
        - entity: sensor.weather_forecast_daily
          value: '{{states("sensor.ewelink_th01_a6451925_temperature")}} º'
        - entity: sensor.weather_forecast_daily
          type: 0
          value: "{{state_attr('sensor.weather_forecast_daily', 'forecast')[0].temperature|round(0)}}º/{{state_attr('sensor.weather_forecast_daily', 'forecast')[0].templow|round(0)}}º"
        - entity: sensor.weather_forecast_daily
          type: 1
          value: "{{state_attr('sensor.weather_forecast_daily', 'forecast')[1].temperature|round(0)}}º/{{state_attr('sensor.weather_forecast_daily', 'forecast')[1].templow|round(0)}}º"
        - entity: sensor.weather_forecast_daily
          type: 2
          value: "{{state_attr('sensor.weather_forecast_daily', 'forecast')[2].temperature|round(0)}}º/{{state_attr('sensor.weather_forecast_daily', 'forecast')[2].templow|round(0)}}º"
        - entity: delete
        - entity: sensor.nspanel_salon_thermostat_temperature
          value: '{{states("sensor.nspanel_salon_thermostat_temperature")}} º'
          icon: mdi:home-thermometer-outline

Am I missing anything? Thanks!

@joBr99
Copy link
Owner

joBr99 commented May 15, 2024

You need to upgrade the backend to the latest version.

Note that you might run into an issue if you didn't follow all of the steps during migration from appdaemon 14 to 15. Appdaemon is only using files from HACS if you have app_dir configured in the appdaemon.yaml. Please see:
#1029

@soyxan
Copy link

soyxan commented May 15, 2024

I do not use the Appdaemon addon, I use it in docker, so my AppDaemon version is v4.4.2 (latest).

What do you mean by upgrade the backend? Are you referring to NSPanel Lovelace UI Backend in HACS? I am already using
v4.4.0 and I do not see any pending update in HACS...

@soyxan
Copy link

soyxan commented May 15, 2024

Now is working. While I was writing my previous reply I realized that rebooting HA did not reboot Appdaemon (both are independent docker instances). After rebooting Appdaemon docker everything is working as expected. Thanks and sorry for my confusion!

@tv4you2016
Copy link

Hello @joBr99

Is there any way to resolve this condition??

cf0e713c-8014-41b2-aa4e-28ca27c87960

image

@joBr99
Copy link
Owner

joBr99 commented Aug 8, 2024

Update your backend to the latest version and restart appdaemon.

And you need to have app_dir in your appdaemon.yaml so it picks the downloaded files from hacs:
#1029

@tv4you2016
Copy link

tv4you2016 commented Aug 8, 2024

@joBr99 I already have this done and it's working, but now when condition: exceptional
in sensor.weather_forecast_daily and I get this error

@sander816
Copy link

i am having troubles setting this up:
appdaemon crashes with the forecast error. What can i do?

@joBr99
Copy link
Owner

joBr99 commented Nov 19, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests