Skip to content

Fix: group VALLHORN/MYGGSPRAY sub-devices under a single HA device#8

Open
ermitovski wants to merge 1 commit intonrbrt:mainfrom
ermitovski:fix/group-sub-devices-by-relation-id
Open

Fix: group VALLHORN/MYGGSPRAY sub-devices under a single HA device#8
ermitovski wants to merge 1 commit intonrbrt:mainfrom
ermitovski:fix/group-sub-devices-by-relation-id

Conversation

@ermitovski
Copy link

@ermitovski ermitovski commented Feb 13, 2026

Summary

  • Use 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 devices
  • Sub-devices without a custom_name now inherit the name from a sibling, avoiding garbled device IDs in entity names
  • Fix device_trigger.py identity check to use unique_id instead of device info identifiers, preventing breakage for controllers with relation_id

Fixes #7

Migration note

Changing the device identifier from id to relation_id means 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 (without relation_id) are unaffected.

Test plan

  • All modified files pass syntax check (py_compile)
  • VALLHORN appears as one device with motion + illuminance entities
  • Illuminance entity name shows the user-assigned name instead of raw ID

🤖 Generated with Claude Code

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>
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.

VALLHORN device duplicated

1 participant