Skip to content

Commit e44d483

Browse files
Copilotballoob
andcommitted
Fix awair integration runtime_data AttributeError
Move update listener registration after runtime_data is set to prevent AttributeError when the listener is triggered. The listener accesses entry.runtime_data.title, so runtime_data must be set first. Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
1 parent 8cb3f94 commit e44d483

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

homeassistant/components/awair/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ async def async_setup_entry(
2626

2727
if CONF_HOST in config_entry.data:
2828
coordinator = AwairLocalDataUpdateCoordinator(hass, config_entry, session)
29-
config_entry.async_on_unload(
30-
config_entry.add_update_listener(_async_update_listener)
31-
)
3229
else:
3330
coordinator = AwairCloudDataUpdateCoordinator(hass, config_entry, session)
3431

3532
await coordinator.async_config_entry_first_refresh()
3633

3734
config_entry.runtime_data = coordinator
3835

36+
if CONF_HOST in config_entry.data:
37+
config_entry.async_on_unload(
38+
config_entry.add_update_listener(_async_update_listener)
39+
)
40+
3941
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
4042

4143
return True

0 commit comments

Comments
 (0)