Optional node level for Home Assistant discovery topics (#1195)#1220
Open
gskjold wants to merge 1 commit into
Open
Optional node level for Home Assistant discovery topics (#1195)#1220gskjold wants to merge 1 commit into
gskjold wants to merge 1 commit into
Conversation
Adds an opt-in "Nest sensors under a node level" toggle to the Home Assistant MQTT config. When enabled, sensor discovery topics use HA's optional node_id segment: <prefix>/sensor/<deviceUid>/<uid>/config instead of the flat <prefix>/sensor/<deviceUid>_<uid>/config keeping the 20+ entities tidy under a single node in the broker tree. uniq_id is unchanged (still <deviceUid>_<uid>), so HA entities are not duplicated. Default is off; existing installs are unaffected. HomeAssistantConfig gains a trailing nodeId byte; EEPROM_CHECK_SUM bumps to 105 with a relocateConfig104() migration that defaults the flag off (no offsets move, so it is a safe trailing-byte add). Cost: +812 B flash / +0 RAM on esp32dev, +592 B flash / +0 RAM on esp8266dev. Builds verified on both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔧 PR Build ArtifactsVersion: All environments built successfully. Download the zip files:
|
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.
Closes #1195.
What
Adds an opt-in "Nest sensors under a node level" checkbox to the Home Assistant MQTT configuration. When enabled, sensor discovery topics use HA's optional
node_idsegment:This keeps the 20+ discovery entities grouped under a single node in the broker topic tree instead of cluttering the
sensor/root, as requested in #1195.Why it's safe
uniq_idis built independently inhadiscover.json(still<deviceUid>_<uid>), so moving the topic does not change entity identity.HomeAssistantConfiggains a trailingnodeIdbyte in previously-unused space;EEPROM_CHECK_SUMbumps 104 → 105 with arelocateConfig104()step that defaults the flag off. No offsets move.Caveat
Toggling the option leaves the old retained discovery configs orphaned on the broker until manually cleared (noted in a code comment). The cosmetic nature is intentional — HA already groups entities via the
devblock; this only tidies the raw MQTT topic tree.Size cost
Most of the firmware cost is the one-time
relocateConfig104()migration, which can be removed in a future release once 104-era configs are gone.Verification
pio run -e esp32dev— SUCCESSpio run -e esp8266dev— SUCCESS (97.8% flash, ~22.5 KB headroom)Follow-up
New UI string
conf.mqtt.ha.nodeidadded tolocalazy/source/en.json; needs the usual Localazy upload after merge.🤖 Generated with Claude Code