Skip to content

Say that Home Assistant can hand out a shared unit - #216

Merged
balloob merged 4 commits into
mainfrom
document-shared-units
Aug 23, 2026
Merged

Say that Home Assistant can hand out a shared unit#216
balloob merged 4 commits into
mainfrom
document-shared-units

Conversation

@balloobbot

Copy link
Copy Markdown
Collaborator

The integration page carried a caution that shared connections were coming and this was not how to do it yet. They have landed in home-assistant/core#179658: the modbus integration hands out units over connections it shares, so two integrations on one device serialize behind a single connection rather than competing for the bus.

The caution becomes the instruction, with the call and a pointer to the official guide (documented in home-assistant/developers.home-assistant#3308).

What the caution said about migrating turned out to hold, which is why this is a small change: only the one place that turned config-flow values into a connection moves, and the library, coordinator and entities do not. The example below the callout still builds its own connection, which is what a standalone script does and what an integration does until the shared version reaches it.

npm run build passes, internal links valid.

The page carried a caution that shared connections were coming and this
was not how to do it yet. They have landed: the modbus integration hands
out units over connections it shares, so two integrations on one device
serialize behind a single connection rather than competing for the bus.

The caution becomes the instruction, with the call and a pointer to the
official guide. What it said about migrating holds, and is why this is a
small change: only the one place that turned config-flow values into a
connection moves, and the library, coordinator and entities do not.
Asking Home Assistant for a unit was a tip beside a page that still
taught building your own connection. That is how it works now, so it is
the instruction: "Setting up the entry" asks the modbus integration for
the unit, and building the connection yourself moves under it, for a
standalone script or a Home Assistant too old to hand one out.

Two things follow from not owning the connection, and both were wrong on
the page. There is no teardown to register, and calling close() on a
shared connection takes the link from whoever else holds a unit on it.
And the wedged-link recipe cannot apply: a unit carries no connection to
recycle, and dropping a shared link would hit integrations that never
asked for it.

Message spacing moves to the unit for the same reason. Pacing one slow
device should not pace everything else on the link.
A consumer gets a unit, so close() and disconnect() were never reachable
from where the page warned about them. Building the connection yourself
belongs to the pages that cover it, not to the Home Assistant one.
The checklist item on the config flow and the one on async_setup_entry
both moved on each side. Keeps #217's addition to the first, that the
flow asks nothing the library settles by probing, and this branch's
replacement of the second, which asks modbus for the unit.
@balloob
balloob merged commit ea3c330 into main Aug 23, 2026
6 checks passed
@balloob
balloob deleted the document-shared-units branch August 23, 2026 18:52
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.

2 participants