Closed tetele closed 8 months ago
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.
@Odianosen25 Hey, can you help me out with this, not entirely sure how to implement that workaround as it's using async stuff.
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) https://github.com/joBr99/nspanel-lovelace-ui/commit/d94d937d776c9ca9dd5cf083c54fc4c51d02af5f https://github.com/joBr99/nspanel-lovelace-ui/commit/e5c1f0588a3dfc226f129c822bfa83571fd2d240
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
Thank you!
Something's a bit off. I'll debug when i have the time, but just letting you know @joBr99
looks like the entity you specified in your config doesn't exist
Right. I forgot to change the domain from weather
to sensor
, but even after changing it it has some issues
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 https://github.com/joBr99/nspanel-lovelace-ui/issues/1029
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!
Your template
sensor
needs a proper state
and a temperature
attribute @joBr99 , otherwise the current condition will look like this
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.
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)
I was not aware you can have one entity for current condition and another for forecast.
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.
That is what i was using, yes.
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?
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 ;)
Working good for me using this now. Took a while, I missed the bit about the upgrade to AppDaemon 15 https://github.com/joBr99/nspanel-lovelace-ui/issues/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.
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:
and this is what the configuration.yaml and apps.yaml files look like:
what am I doing wrong? Any ideas?
adjust the weather.k3ll3r
in your template to your weather entity weather.home
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?
I changed it here. So I understand that after 1 hour the trigger should change it?
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.
data in forecast home are visible correctly (daily and hourly):
please check on this page:
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
of course HA was restarted
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:
forecast seems to be working properly now:
but there is still no information about the next few days and the icons are also missing:
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) https://github.com/joBr99/nspanel-lovelace-ui/commit/d94d937d776c9ca9dd5cf083c54fc4c51d02af5f https://github.com/joBr99/nspanel-lovelace-ui/commit/e5c1f0588a3dfc226f129c822bfa83571fd2d240
Have you done that too?
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!
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~���~31728~PirateWeather~67��F~���~17299~Weather Forecast Daily~clou ~���~17299~Weather Forecast Daily~clou ~���~17299~Weather Forecast Daily~clou ~~~���~17299~Weather Forecast Daily~clou
apps.yaml
`screensaver:
entities:
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
Thank you so much! I had not configured app_dir: /homeassistant/appdaemon/apps/ in the appdaemon.yaml. All is well.
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.
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.
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
thanks, good idea added to the documentation
I have implemented the workaround configuration in my HA but this is the result I get in my nspanel:
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!
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: https://github.com/joBr99/nspanel-lovelace-ui/issues/1029
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...
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!
Hello @joBr99
Is there any way to resolve this condition??
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:
@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
i am having troubles setting this up: appdaemon crashes with the forecast error. What can i do?
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 forweather
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!
Log output here:
irrelevant