# ADR-0118: Multi-Panel Support with Single Session per Panel

Status: Accepted

## Context

Home Assistant commonly manages multiple devices of the same type, and users may
deploy more than one E27 panel (e.g., multiple buildings or independent systems).

At the same time, the E27 panel supports multiple simultaneous client sessions,
but:
- panel resources are constrained
- request concurrency is limited (ADR-0111)
- Home Assistant does not require multiple concurrent sessions to the same
  panel to function correctly

Allowing multiple sessions per panel from a single Home Assistant instance
would introduce:
- unnecessary resource consumption
- complex coordination and state consistency challenges
- increased risk of exhausting panel packet pools

## Decision

The Home Assistant E27 integration supports multiple panels, with a strict
single-session-per-panel model.

1. Home Assistant may configure and manage multiple E27 panels concurrently.
   - Each panel corresponds to one Home Assistant config entry.
   - Panels are distinguished by MAC address identity.

2. For each configured panel:
   - Exactly one active session is maintained at any given time.
   - All requests, subscriptions, and state updates for that panel flow
     through this single session.

3. Home Assistant must not:
   - open multiple simultaneous sessions to the same panel
   - shard domains or entities across multiple sessions

4. If a reconnect is required, the existing session is fully torn down and
   replaced with a new single session, following the reconnect policy
   (ADR-0113).

## Rationale

This model:
- aligns with the panel’s constrained resource environment
- simplifies request serialization and backpressure handling
- ensures a single authoritative state view per panel
- avoids subtle bugs caused by cross-session ordering or visibility issues

Supporting multiple panels while limiting each to a single session provides the
necessary scalability without unnecessary complexity.

## Consequences

- The library must enforce one session per panel identity.
- The HA integration maps one config entry to one session.
- Scaling across panels is achieved by running multiple independent hubs, one
  per panel.
- Concurrency across panels is allowed; concurrency within a panel is not.

## Scope / Non-Goals

- Does not prevent multiple Home Assistant instances from connecting to the
  same panel (outside the scope of this integration).
- Does not define session limits enforced by the panel firmware.
- Does not define cross-panel coordination or aggregation behavior.

## References

- ADR-0111: E27 Request Concurrency and Backpressure
- ADR-0113: E27 Reconnect and Rediscovery Policy
- Home Assistant multi-device integration model
