FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
197 stars 13 forks source link

Error migrating to config entry version 6 (HA Core 2024.10) #143

Closed elcajon closed 2 months ago

elcajon commented 2 months ago

Version of home_assistant

The error occurs after updating integration to v2.1.7 on my dev instance (version 2024.10.0.dev202409060225), updating on my production instance with version 2024.9.0 worked without problems

Version of the custom_component

v2.1.7

Describe the bug

Replacing the following lines https://github.com/FL550/dwd_weather/blob/a7082df2c3f513c55cbcc9f7408b92f17461a599/custom_components/dwd_weather/__init__.py#L170-L171

with

hass.config_entries.async_update_entry(config_entry, data=new, version=7)

solves the problem.

Reference

https://github.com/home-assistant/core/pull/123729 https://developers.home-assistant.io/docs/config_entries_index/#modifying-a-config-entry

Debug log


2024-09-06 08:26:36.001 ERROR (MainThread) [homeassistant.config_entries] Error migrating entry 10729: Mannheim for dwd_weather
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 927, in async_migrate
result = await component.async_migrate_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dwd_weather/__init__.py", line 170, in async_migrate_entry
config_entry.data = {**new} # type: ignore
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 437, in __setattr__
raise AttributeError(
AttributeError: data cannot be changed directly, use async_update_entry instead