mirror of
https://github.com/home-assistant/core.git
synced 2026-08-29 18:25:07 -05:00
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