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

Hi Ruddo-O,

Thanks for all your hard work. Happy that we found (and they ou fixed) the bugs. I have another, and hopefully last, question. Is it possible to get more detailed forecasts from meteoswiss? The forecast we get now is quite basic with cloudiness and temperature. Yet meteoswiss also forecasts sun irradiatiion (min/h) and chance of rain. Is there any way to get those informations??

Thanks again,

Magnus.

I’m not sure about forecasts, but I know that configuring a real-time weather station gives you the current Sun irradiation as a sensor in watts/m² and the last 10 minutes of Sun irradiation as another sensor expressed in minutes/minute. Check your entities tab for the Meteo-Swiss integration and you’ll see them.

I’m not even sure Home Assistant supports those values in the Weather platform, to be quite honest — but I would be willing to be proven wrong!

EDIT: I checked the source code, and the Weather entity does not support these values, sorry. And neither does the Forecast type:

class Forecast(TypedDict, total=False):
    """Typed weather forecast dict.

    All attributes are in native units and old attributes kept
    for backwards compatibility.
    """

    condition: str | None
    datetime: Required[str]
    precipitation_probability: int | None
    native_precipitation: float | None
    precipitation: None
    native_pressure: float | None
    pressure: None
    native_temperature: float | None
    temperature: None
    native_templow: float | None
    templow: None
    wind_bearing: float | str | None
    native_wind_speed: float | None
    wind_speed: None

Sorry bruh.

Hi,

I have the current sun irradiation from the stations working fine (excellent for checking potential solar power I could get, updated every 900sec). It would have been amazing to get the forecasted sun exposure (c.f. picture from metoswiss, forecasting sun exposure for saturday for example), would probably be even more accurate then Forecast.Solar and/or Solcast!
Can’t get everything in Home Assistant :slight_smile: But thank you again for all your work, appreciate it!

Ciao. Pretty new in integrations. I can’t find this meteoswiss, as custom repository in HACS. Any help please?
Thanks!

Thank you. It would indeed be great to get the Sun forecast inside the integration. Sadly, even though it’s available, I have not found a way to put that info in the weather forecast object. If someone figures this out, a pull request will always be welcome.

Follow the screenshots here, Claudio:

1 Like

Hi there, since the last update to Home Assistant 2023.3.0 applied just now the Meteo Swiss integration is not working anymore. It was working very well before. Notification says “Invalid Config” The following integrations and platforms could not be set up:

Here the log info:

Logger: homeassistant.setup
Source: setup.py:205
First occurred: 23:39:24 (1 occurrences)
Last logged: 23:39:24

Setup failed for custom integration meteo-swiss: Requirements for meteo-swiss not found: [‘hamsclientfork==0.2.6’].
23:39:24 – (ERROR) setup.py

Any idea why ?

Hi
I have the same problem
If i use a backup , (for test) , downgrad to Home Assistant 2023.2.5 , there is no problem.
now 2023.3.0 is not compatible with

1 Like

Sorry about that folks. Turns out 2023.3 is stricter. Now it should work properly for everyone.

1 Like

Yes!!!
Danke und ein schönes Wochenende :ok_hand:

1 Like

yes its working again, thanks so much

I can’t set it up, I jsut get stuck in a loading circle when I want to add the integration.
Does someone know what could cause this?

After many tries I did get up to the postal code but not further.

I need a copy of your Home Assistant debug log, posted in a Github ticket on the project. I cannot help you otherwise.

Hi @ Rudd-O. First of all thanks for the work! I have installed the integration and selected the appropriate location parameters. Whereas the real-time sensors are shown properly, the forecast sensor is shown as not available. Attached my log with the error message:

Logger: homeassistant.components.sensor
Source: custom_components/meteo-swiss/weather.py:139
Integration: Sensor (documentation, issues)
First occurred: 13:34:23 (1 occurrences)
Last logged: 13:34:23

meteo-swiss: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 444, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 211, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 95, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 237, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 349, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 146, in async_update_listeners
    update_callback()
  File "/config/custom_components/meteo-swiss/weather.py", line 80, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
    if (state := self.state) is None:
  File "/config/custom_components/meteo-swiss/weather.py", line 138, in state
    cond = next(
  File "/config/custom_components/meteo-swiss/weather.py", line 139, in <genexpr>
    (k for k, v in CONDITION_CLASSES.items() if int(symbolId) in v),
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Do you have any hints what went wrong?
I am running HA OS 10.1 with Home Assistant 2023.5.4

Thanks and Regads,
Aleardo

Nope, no clue what happened there. I will prepare a new release to add a bit of debugging there. Please stand by for update notification. Thank you.

EDIT: I have pushed the thing with more logging. You should be able to see any error logs in the integration logs.

Dear all,
Great news to see there is an integration that is maintained.
I just installed it on my machine, unfortunately there is no forecast for me.
I have 11 entities, all from the Real time weather station.

My logs:

Logger: homeassistant.setup
Source: setup.py:348
First occurred: 11:05:32 AM (1 occurrences)
Last logged: 11:05:32 AM

Unable to prepare setup for platform meteo-swiss.weather: Platform not found (No module named 'custom_components.meteoswiss').

Any ideas?

I installed the integration and everything works. Unfortunately I can not use the weather card, because the sensors are not weather. My sensors are called sensors.xx and not weather.xx

There must be at least one weather entity.

We are changing a few things in how the integration works (sorry, outside of my control). Please stand by and do not update just yet.

Good news is, as of latest integration push to Github, everything works fine again.

Bad news is, you’ll have to do some deinstallation of the existing integration. The README.md file contains instructions on how to solve the issues you’ll encounter during the transition. GitHub - Rudd-O/homeassistant-meteoswiss: 🌦 Meteo Swiss Integration for Home Assistant (forked from websylv) has the info.

So-so news, if you name your weather and sensor entities the same as they were before, your statistics will be preserved.