The integration borrows a ModbusUnit from a modbus_connection entry. When that
connection drops, modbus_connection rebuilds it, but the borrowed unit is still
bound to the old (closed) connection. Subscribe to the unit's on_connection_lost
and reload so we re-borrow a unit on the fresh connection.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016huRs96kGdQbNQopXseC4H
Port the Samson Trovis 557x heating-controller integration into core,
consuming the shared modbus_connection integration for its Modbus link
instead of owning a connection.
The config flow lets the user pick an existing modbus_connection config
entry (via ConfigEntrySelector) plus a unit ID, dedupes on
(connection, unit) via the config-entry unique ID, and borrows a
ModbusUnit through async_get_unit at setup, handing it to the
trovis-modbus library. The modbus_connection entry owns connection
lifecycle/reloads, so this integration never opens, closes, or watches
the connection.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016huRs96kGdQbNQopXseC4H
Layer 2 of the shared-Modbus-connection design: a new integration whose only job
is to own Modbus connection config entries (one per physical link) and publish a
live, backend-neutral connection that consumer integrations borrow units from.
- config flow: Network (TCP / RTU-over-TCP) or Serial (RTU, including network
serial proxies). A duplicate link aborts before the connection is opened;
otherwise the connection is opened to validate it
- runtime_data holds the live ModbusConnection (built via the tmodbus-backed
modbus_connection.tmodbus connect functions); the entry owns close() and
reloads on connection loss
- async_get_unit(hass, entry_id, unit_id): the only consumer touchpoint -
returns a backend-neutral ModbusUnit, or raises ConnectionNotReady (a
ConfigEntryNotReady, so consumers get setup-retry, and a ModbusError)
- quality_scale.yaml at bronze with strict typing (unique-config-entry exempt:
Modbus endpoints have no hardware unique ID; entity/action rules exempt: the
integration has no entities)
- tests: setup/unload, connect-failure retry, reload-on-loss, the config flow
(network/serial happy paths, cannot_connect, cannot_open_serial_port, and a
parametrized duplicate check) and the async_get_unit accessor
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016huRs96kGdQbNQopXseC4H