Rudd-O / homeassistant-meteoswiss

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

entitity not updating ? #2

Closed steuerzentrale closed 1 year ago

steuerzentrale commented 1 year ago

Hi there

I just installed this integration and followed this thread https://community.home-assistant.io/t/fixed-the-meteo-swiss-integration/520759 . I am not sure if this is a bug but I noticed that the forecast of my weather-entity (station DIT) is not updating despite an update-interval of 5min.

this is the weather-forecast I get via the integration (abbreviations highlighted compared to the forecast from today on Meteoswiss) the weather-entity has lastly been updated 13h ago.

Bildschirm­foto 2023-02-06 um 11 22 37

compared to the one frow February 6 11:36 UTC +1

Bildschirm­foto 2023-02-06 um 11 22 44

I must notice that I get the following message in the logs: Station DIT provided us with no real-time data

nonetheless it should update the forecast right? I dont need real-time data from the station, just the forecast.

Home Assistant 2023.2.2 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230202.0 - latest HACS 1.30.1

all the best

Andrew

HansPaulHansen commented 1 year ago

Hey There

I have the same Issue. The Forecast and Temp. is updating just when HA ist starting up. But afterwards ist not updating anymore.

Home Assistant 2023.1.6 Frontend 20230110.0 - latest HACS 1.30.1

Running in official Docker Image

Thanks in advance

Paul

molofsso commented 1 year ago

Hi,

Same issue for me. In the debug logger I found this:

2023-02-09 06:49:20.069 DEBUG (MainThread) [custom_components.meteo-swiss] Data will be updated through VEV at post code 1066 every 900 days, 0:00:00

--> Update every 900 days..

Anyone found a solution?

sebcou21 commented 1 year ago

Hello,

Same here, I ended up creating an automation to manually trigger the update every 10 minutes and everything gets updated.

Home Assistant 2023.2.2 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230202.0 - latest HACS 1.30.1

Thanks in advance.

molofsso commented 1 year ago

Hi,

Which automation did you create? Don't see the best option in the automation options.

Thanks.

sebcou21 commented 1 year ago

Hi,

Like this:

alias: "[Weather] Force update weather entity"
description: ""
trigger:
  - platform: time_pattern
    minutes: /10
condition: []
action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id:
        - weather.xxx
mode: single
molofsso commented 1 year ago

Thanks ;)

Does it work for you though? I ran the automation and get this trace: Executed: February 11, 2023 at 11:06:25 Result: params: domain: homeassistant service: update_entity service_data: {} target: entity_id:

But the weather entity says it last updated an hour ago (last restart of my HA).

sebcou21 commented 1 year ago

Yes it works and I get the same automation trace as you, the entity shows as updated though.

But since one hour ago or so, my weather station does not seem to return data anymore. I tried to add another one and get this in the logs:

2023-02-11 11:15:23.737 ERROR (MainThread) [custom_components.meteo-swiss.weather] Unable to convert windSpeed value: [{'Station/Location': 'BER', 'Date': 202302111000, 'tre200s0': '-', 'rre150z0': '0.00', 'sre000z0': '-', 'gre000z0': '-', 'ure200s0': '-', 'tde200s0': '-', 'dkl010z0': '-', 'fu3010z0': '-', 'fu3010z1': '-', 'prestas0': '-', 'pp0qffs0': '-', 'pp0qnhs0': '-', 'ppz850s0': '-', 'ppz700s0': '-', 'dv1towz0': '-', 'fu3towz0': '-', 'fu3towz1': '-', 'ta1tows0': '-', 'uretows0': '-', 'tdetows0': '-'}]

Not sure if it's an intermittent issue on MeteoSwiss side...

EDIT: now data is coming back again.

HansPaulHansen commented 1 year ago

Hey

The automation script from [sebcou21] is working great. But it seems that the update timestamp ist not updating when being forced to update via the automation schedule. I compared it to the regular meteo app and the values are changing, but not the timestamp. Thanks for the input.

Best Paul

2A44B1AC-CFE6-47A4-8BDE-D4ACCDF5A9AD 8AC32539-291D-4B84-BFC2-13A565101FF5

sebcou21 commented 1 year ago

Hi Paul, not sure to understand what you mean, because in your screenshots it shows that it was updated 2 and 3 hours ago. Maybe those are times when you restarted HA?

On my side if I use the following template in dev tools {{ states.weather.aigle.last_updated }} and the output timestamp corresponds to the last time the automation ran. The weather card reflects that as well, so no clue why you have a different behavior.

Nevertheless, this entity not updating by itself bug should be fixed so we don't have to work around :-)

Rudd-O commented 1 year ago

Hi.

If the data itself coming from the forecast station has not changed, then there will be no change reflected in the update time of the entity.

Not sure if it's an intermittent issue on MeteoSwiss side...

When you see problems like these, please post the log from Home Assistant.


I must notice that I get the following message in the logs: Station DIT provided us with no real-time data

So, recently, another user reported a similar issue. Turns out that the station listing used to build that dropdown you select the station during setup... bunches up weather and precipitation stations. Precipitation stations don't have real-time weather data. The code, foolishly, lets you select either, which is how you end up in a situation where you picked up DIT which can't give you real-time weather data (DIT is a precipitation station).

The very latest update to this repository lets you choose only from the weather stations. To fix your issue, you should update to the latest one, restart Home Assistant, delete the current integration and re-add a new one. You will notice that DIT is no longer an option (it never was, the code foolishly put it there).

All of this is separate from the forecast. The forecast comes from a different service, not the real-time station.

Rudd-O commented 1 year ago

https://github.com/Rudd-O/homeassistant-meteoswiss#known-issues now addresses the issue of the real-time weather sensors not updating for certain users. Please follow this process to resolve the problem of weather sensors not updating.

As for the forecast — this has nothing to do with the issue some of you encountered, and there seems to be no evidence that the forecast data is not updating in a timely manner. Please reopen if you find errors on the log pertaining to the update of the forecast specifically — and attach the log. Thanks.

Rudd-O commented 1 year ago

Context: https://github.com/Rudd-O/homeassistant-meteoswiss/issues/3

steuerzentrale commented 1 year ago

thanks Rudd-O for your ongoing support. I just removed the integration, the removed it in HACS and reinstalled it via HACS and then the integration itself, I get the following error and think that it maybe has to do with the update, thats why I post it in this thread.

Logger: homeassistant.config_entries Source: config_entries.py:816 First occurred: 18:56:32 (1 occurrences) Last logged: 18:56:32

Error occurred loading configuration flow for integration meteo-swiss: cannot import name 'StationType' from 'hamsclientfork' (/usr/local/lib/python3.10/site-packages/hamsclientfork/init.py)

Rudd-O commented 1 year ago

That's strange. It looks like the latest version of hamsclientfork did not get installed when the extension was installed. Let me check.

Rudd-O commented 1 year ago

Um. Something went wrong when you re-added the integration. Please remove the integration from your config, then from HACS, then restart Home Assistant, then ask HACS to reinstall the integration, then re-add the config. It should work this way.

Specific details: it does not look like upgrading your integration to the latest version caused the hamsclientfork library to update to version 0.2.5.

Rudd-O commented 1 year ago

I'm attempting a cleanroom setup here after deleting the library from my HA setup. Wish me luck:

[user@projects homeassistant-meteoswiss]$ ../homeassistant-core/venv/bin/pip uninstall hamsclientfork
Found existing installation: hamsclientfork 0.2.5
Uninstalling hamsclientfork-0.2.5:
  Would remove:
    /home/user/Projects/homeassistant-core/venv/lib/python3.10/site-packages/hamsclientfork-0.2.5.dist-info/*
    /home/user/Projects/homeassistant-core/venv/lib/python3.10/site-packages/hamsclientfork/*
Proceed (Y/n)? y
Rudd-O commented 1 year ago

I could not reproduce with a fresh install. You have to restart Home Assistant for the dependencies (updated today) to be picked up.

steuerzentrale commented 1 year ago

sorry to say, I did it exactly as you mentioned and to be sure for three times, always getting the error again. The integration worked fine before the update via HACS.

Please remove the integration from your config, then from HACS, then restart Home Assistant, then ask HACS to reinstall the integration, then re-add the config.

error: Error occurred loading configuration flow for integration meteo-swiss: cannot import name 'StationType' from 'hamsclientfork' (/usr/local/lib/python3.10/site-packages/hamsclientfork/init.py)

Bildschirm­foto 2023-02-11 um 19 21 48
Rudd-O commented 1 year ago

I appreciate the report. However, I cannot reproduce it myself, whether with a clean room setup or my long-running production Home Assistant system. Something is up with your current setup and I have no visibility into what might be happening.

If you are adventurous, try upgrading hamsclientfork inside your Home Assistant virtual environment to the latest version, then restarting Home Assistant.

steuerzentrale commented 1 year ago

I would try that but I dont how to upgrade hamsclientfork inside HA, neither could I find information in the internet how to do it. could you give me some advise?

I have recent backups in case something gets broken

Rudd-O commented 1 year ago

I would try that but I dont how to upgrade hamsclientfork inside HA, neither could I find information in the internet how to do it. could you give me some advise?

Usually you have to log in via SSH to the machine, find the Python interpreter used by HA, and then run /path/to/that/intepreter/python3 -m pip install hamsclientfork==0.2.5 then restart HA.

This is not something 99.9% of HA users are expected to know to do — it should just work, when you upgrade a HACS extension, all dependencies that must be updated should be installed without trouble.

Sorry.