Fix: group VALLHORN/MYGGSPRAY sub-devices under a single HA device#8
Open
ermitovski wants to merge 1 commit intonrbrt:mainfrom
Open
Fix: group VALLHORN/MYGGSPRAY sub-devices under a single HA device#8ermitovski wants to merge 1 commit intonrbrt:mainfrom
ermitovski wants to merge 1 commit intonrbrt: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>
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
relation_id(shared across sibling sub-devices) as the HA device identifier so multi-function devices like VALLHORN and MYGGSPRAY appear as one device with multiple entities instead of two separate devicescustom_namenow inherit the name from a sibling, avoiding garbled device IDs in entity namesdevice_trigger.pyidentity check to useunique_idinstead of device info identifiers, preventing breakage for controllers withrelation_idFixes #7
Migration note
Changing the device identifier from
idtorelation_idmeans existing HA devices for multi-function sensors will be orphaned and new (correctly grouped) ones created on first restart after upgrade. Users may need to delete the orphaned devices in the HA device registry. This is a one-time issue. Standalone devices (withoutrelation_id) are unaffected.Test plan
py_compile)🤖 Generated with Claude Code