Skip to content

Set up platforms only after the first refresh has data - #22

Merged
Nailik merged 2 commits into
Nailik:mainfrom
lackas:fix/setup-platforms-after-first-refresh
Sep 4, 2026
Merged

Set up platforms only after the first refresh has data#22
Nailik merged 2 commits into
Nailik:mainfrom
lackas:fix/setup-platforms-after-first-refresh

Conversation

@lackas

@lackas lackas commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Since #21 the first refresh runs in a background task, so coordinator.data is still None when the platforms are forwarded. binary_sensor, select and sensor read coordinator.data.device_type in their async_setup_entry and fail with AttributeError: 'NoneType' object has no attribute 'device_type', leaving only button and number. Reported in #2 for 0.0.11.

The platforms are now forwarded from the background task once the first refresh has produced data, retrying every 60 seconds while the device is unreachable. Startup is still not blocked on BLE.

The platform setups read coordinator.data.device_type to decide which
entities exist. Since Nailik#21 the first refresh runs in a background task, so
the data is still None when the platforms are forwarded and binary_sensor,
select and sensor abort with AttributeError.

Forward the platforms from that background task once the first refresh has
produced data, retrying while the device is unreachable.
@Nailik
Nailik merged commit 982257f into Nailik:main Sep 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants