FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
154 stars 12 forks source link

Error occurred loading flow for integration dwd_weather: Exception importing custom_components.dwd_weather.config_flow #124

Closed Pixelpampe closed 2 months ago

Pixelpampe commented 3 months ago

Home Assistant Core 2024.4.0 Frontend 20240403.1

v2.1.2

After installing with HACS. Integration can not be added. HA Logs:

Logger: homeassistant.loader Quelle: loader.py:1232 Erstmals aufgetreten: 13:15:26 (4 Vorkommnisse) Zuletzt protokolliert: 13:15:43

Unexpected exception importing platform custom_components.dwd_weather.config_flow Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 1232, in _load_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/dwd_weather/init.py", line 14, in from .connector import DWDMapData, DWDWeatherData File "/config/custom_components/dwd_weather/connector.py", line 8, in from suntimes import SunTimes File "/usr/local/lib/python3.12/site-packages/suntimes/init.py", line 1, in from .suntimes import SunTimes, SunFiles File "/usr/local/lib/python3.12/site-packages/suntimes/suntimes.py", line 8, in local_tz = get_localzone() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tzlocal/unix.py", line 219, in get_localzone _cache_tz = _get_localzone() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tzlocal/unix.py", line 176, in _get_localzone tzenv = utils._tz_from_env() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tzlocal/utils.py", line 109, in _tz_from_env raise zoneinfo.ZoneInfoNotFoundError( zoneinfo._common.ZoneInfoNotFoundError: 'tzlocal() does not support non-zoneinfo timezones like TZ=Europe/Berlin. \nPlease use a timezone in the form of Continent/City'

FL550 commented 2 months ago

Hi, what is your configured system timezone?

Pixelpampe commented 2 months ago

Hi. HA is installed in a Docker Container that runs with UTC. In the config of HA the timezone is set to GMT+1 Berlin.

FL550 commented 2 months ago

Strange, this has something to do with your timezone configuration. Unfortunately I'm not able to fix this, as I rely on the suntimes package to correctly change between daylight and nighttime based on configured location. The timezone information is not used by dwd_weather, however during the loading of the package suntimes there is a call to get_localzone() from the package tzlocal which causes this error.

Please try to configure the timezone within docker, as there are multiple issues with docker and timezones.

Pixelpampe commented 2 months ago

Thank you for your help. The hint with the timezone was very helpful. I had a spelling mistake setting the env variable "-e TZ=Europe/Berlin". So completly my fault.