Skip to content

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

Merged
nrbrt merged 1 commit into
nrbrt:mainfrom
ermitovski:fix/group-sub-devices-by-relation-id
Feb 18, 2026
Merged

Fix: group VALLHORN/MYGGSPRAY sub-devices under a single HA device#8
nrbrt merged 1 commit into
nrbrt:mainfrom
ermitovski:fix/group-sub-devices-by-relation-id

Conversation

@ermitovski
Copy link
Copy Markdown

@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>
@nrbrt nrbrt merged commit 55b8728 into nrbrt:main Feb 18, 2026
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

2 participants