Meteo-Swiss integration, fixed and properly working — beware: not the one available by default in HACS!

Thank you Rudd!. All good. Pity for the weather entity not being there. Cheers

Would you mind enabling debug logging and posting the logs in a Github issue? Thanks.

Hi there
Just managed to integrate OpenWeatherMap successfully but would like to switch to Meteo Swiss (forked) to get more detailed data for the area of interest. I think I followed the instructions but fetching data from the data provider doesn’t seem to be successful. The integration setup shows as failed in the HA ui:
image

The following records are printed to the log while setup is being rerun:

2023-07-24 13:32:48.633 DEBUG (MainThread) [custom_components.meteoswiss] Current configuration: {'postcode': [removed by eggenbef], 'forecast_name': '[removed by eggenbef]', 'update_interval': 5, 'station': 'UEB', 'real_time_name': 'Uetliberg'}
2023-07-24 13:32:48.633 DEBUG (MainThread) [custom_components.meteoswiss] Forecast [removed by eggenbef] will be provided for post code [removed by eggenbef] every 0:05:00
2023-07-24 13:32:48.633 DEBUG (MainThread) [custom_components.meteoswiss] Real-time Uetliberg will be updated from UEB every 0:05:00
2023-07-24 13:32:48.633 DEBUG (MainThread) [hamsclientfork.client] MS Client INIT
2023-07-24 13:32:48.633 DEBUG (MainThread) [hamsclientfork.client] INIT meteoswiss client : name = [removed by eggenbef] / Uetliberg station = UEB postcode = [removed by eggenbef] 
2023-07-24 13:32:48.633 DEBUG (MainThread) [custom_components.meteoswiss] Client obtained
2023-07-24 13:32:48.635 DEBUG (SyncWorker_7) [hamsclientfork.client] Start update forecast data
2023-07-24 13:32:49.052 DEBUG (SyncWorker_7) [hamsclientfork.client] End of forecast udate
2023-07-24 13:32:49.054 DEBUG (SyncWorker_7) [hamsclientfork.client] Update current condition
2023-07-24 13:32:49.232 DEBUG (SyncWorker_7) [hamsclientfork.client] Get current condition for : UEB
2023-07-24 13:32:49.240 DEBUG (MainThread) [custom_components.meteoswiss] Finished fetching meteoswiss data in 0.606 seconds (success: False)

I wonder whether an access key is required to get data from meteoswiss. I am running HA 2023.7.2 which has been set up in a virtual python 3.11 environment. Any hint what I would need to change to get Meteo Swiss data retrieval running in this environment would be very much appreciated.

No access key is needed. I don’t know why there was no exception when it says success=False. Please open a ticket on Github with your logs and I will take a look tomorrow — thanks.

Great - thank you Rudd. Issue #23 has been raised.

1 Like

Hello Rudd
If I try to install the Integration, i’ll get an Error: Der Konfigurationsfluss konnte nicht geladen werden: 500 Internal Server Error Server got itself in trouble

Any Idea how to fix
Greets Tom

Hi,

I have the same error
image

It seems that is because I’m using nginx proxy, is that possible ?

I need help :slight_smile:

Thanks a lot.

error log :

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 14:41:05 (1 occurrences)
Last logged: 14:41:05

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 3790, in get_loc return self._engine.get_loc(casted_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Altitude station m. s. mer'

I found the fix in the gitub issues channel, below the trick :

1: Install SSH & Web Terminal Add-on

2: Disable the protection mode and enable show in sidebar in the setting. Don’t forget to add a password in the config tab of this Add-on, if you don’t it won’t work.

3: Reboot VM or PI (maybe not necessary) but do it anyway. And start SSH & Web Terminal Add-on after reboot if start on boot is disabled.

4: Click on Terminal in the sidebar

5: Type or past this command: docker exec -it homeassistant /bin/bash
(You can use shift + insert to past it in the terminal.)
6: Type or past this command: vi /usr/local/lib/python3.10/site-packages/hamsclient/client.py

7: Edit this line: stationData[“altitude”] = line[“Altitude station m. s. mer”]
to this:
stationData[“altitude”] = line[“Altitude station m s. mer”] (no point after the “m”).

8: Shift z z to save and close.

9: Reboot the VM or PI

10: Add integration like you normaly do and enjoy

You installed the wrong version of the integration (the one in the HACS default repositories). The one I maintain uses hamsclientfork not hamsclient.

I applied to replace the one in the repositories but was treated rudely by the developers so I do not intend to apply again.

HI there, first of all thx for your work. I installed the custom repo and i can get the weather forecast but for some entities i get this error:

This error originated from a custom integration.

Logger: custom_components.meteoswiss.weather
Source: custom_components/meteoswiss/weather.py:100
Integration: Meteo Swiss (documentation, issues)
First occurred: 11:00:02 (2 occurrences)
Last logged: 11:00:02

Error converting pressure (qfe): [{'station': 'COY', 'date': 202311010950, 'tre200s0': 6.6, 'rre150z0': 0.0, 'sre000z0': None, 'gre000z0': None, 'ure200s0': 99.3, 'tde200s0': 6.5, 'dkl010z0': 103.0, 'fu3010z0': 3.6, 'fu3010z1': 5.4, 'prestas0': None, 'pp0qffs0': None, 'pp0qnhs0': None, 'ppz850s0': None, 'ppz700s0': None, 'dv1towz0': None, 'fu3towz0': None, 'fu3towz1': None, 'ta1tows0': None, 'uretows0': None, 'tdetows0': None}]
Traceback (most recent call last):
  File "/config/custom_components/meteoswiss/weather.py", line 100, in native_pressure
    return float(self._condition[0]["prestas0"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

Any ideas? It would also be nice to have the data a weater senosr so that is usable in mainstream weather cards.

Kind regards,

Jannis

COY is not returning prestas0 (pressure) — it comes out as None.

That sensor should be unavailable instead of giving you an error. Will fix this.

Hi Rudd

Do you plan to fix this?
grafik

Greetings from Switzerland
Tom

I do, but later this month.

As for the COY station, there should be no more exceptions as I just pushed a fix that simply returns None to Home Assistant for values not available for a particular station.

1 Like

Thx, i installed it and is working now.

Work is ongoing to future-proof the Meteo Swiss integration so it fits the new forecast attribute usage. I’ve requested the author of the PR that does this to rebase onto master, after which we will merge the changes, which will finally clear the deprecation notification on your Home Assistant instances.

2 Likes

Thanks Rudd. After some learning I got it to work (again) :slight_smile:

If it helps : I kept all releases of (OS and HA) constantly on most recent level. The original Meteoswiss integration kept working. It stopped only on Nov 3, 2023, with intermitted outages since then, see next.

unfortunately I get frequent unavailable. (though my internet is performing well)
the interruptions are for all sensors from Meteoswiss (obviously) , attached pattern is typical.

any clue why or how to circumvent its symptoms. Thanks - and thanks for having taken the initiative and fixed the integration.

1 Like

I get that too. Happens when the station gives out empty data. It resolves itself.

Good news everyone!

Thanks to contributions from the community, we have a few things to announce:

  • @mikispag helped validate data that sometimes comes from meteo stations, so that invalid data won’t cause issues we had before.
  • @TimMayle contributed new French translations.
  • @sebcou21 pointed out we could get long-term statistics support. That should be done now!

Enjoy!

1 Like