fix: register ikea_bulb_device_set with registry_entry and handle connection errors with ConfigEntryNotReady#196
Open
pablotoledo wants to merge 6 commits intosanjoyg:mainfrom
Conversation
VALLHORN and MYGGSPRAY expose multiple sub-devices (motion + illuminance) with different IDs but the same relation_id. Using the raw device ID as the HA device identifier caused each sub-device to appear separately. Use relation_id as the HA device identifier so sibling sub-devices are grouped under one device. Falls back to id for standalone devices. Also resolves sub-device naming: when a sub-device has no custom_name, it inherits the name from a sibling that does, avoiding garbled IDs. Fixes nrbrt#7 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nection errors with ConfigEntryNotReady
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related bugs that together caused the Dirigera integration to require multiple manual reloads before successfully loading after a Home Assistant restart. Both issues were reproduced and verified on a production HA 2025.10.3 instance with the integration running inside a Docker bridge network.
Bug 1:
ikea_bulb_device_setcrashes the hub event listener immediately after setupRoot cause
In
light.py,ikea_bulb_device_setregisters itself directly into thehub_event_listenerdevice registry:All other entities (via
base_classes.py) register aregistry_entrywrapper:When
sync_all_device_areas()iterates the device registry and callsregistry_entry.entity, it works for all normal entities (because their registry value is aregistry_entryobject with an.entityproperty). But forikea_bulb_device_set, the registry value is the entity itself — aLightEntitysubclass with no.entityattribute — causing an immediateAttributeError.Observed log errors
This crash happens on every startup that has bulbs grouped in a device set. Once the listener dies, the integration enters a broken state and all subsequent device polling fails.
Fix
registry_entryis already imported inlight.pyfrom.hub_event_listener, so no import changes are needed.Bug 2:
async_setup_entrydoes not handle connection failures gracefullyRoot cause
async_setup_entrycallsmake_devices()with no exception handling. If the hub is temporarily unreachable during HA startup (e.g., brief network unavailability in Docker bridge environments, hub booting up, any transient OS-level network error), theConnectionErrororOSErrorpropagates uncaught.Home Assistant interprets this as a permanent failure and marks the entry as
setup_error— which has no automatic retry. The correct HA pattern for transient connection failures is to raiseConfigEntryNotReady, which triggers HA's built-in exponential backoff retry mechanism.Observed behaviour
setup_error(permanent, no retry)[Errno 101] Network unreachableduringget_scenes/get_blinds/get_lightscalls withinmake_devicesFix
Results after both fixes
Tested on HA 2025.10.3,
dirigera_platforminstalled via HACS, Dirigera hub at 192.168.0.80, HA running in Docker bridge network:setup_error(no retry)loadedin ~10sikea_bulb_device_setAttributeErrorFailed to create listenerFiles changed
custom_components/dirigera_platform/light.py— 1 line changedcustom_components/dirigera_platform/__init__.py— 6 lines added