5 capability specs covering the integration as-built: - api-client: sign-in, Cognito refresh, auto-retry, endpoints - config-flow: credentials, token paste, reauth, options flow - data-coordinator: single poller, dynamic interval, error handling - entities: 9 sensors (temp, keg %, freshness, connection, door, pours, last pour, firmware, mode), device model, translations - hacs-packaging: repo structure, manifest, brand icon, README, GitHub mirror, translation constraints 331 lines of testable requirements with scenarios. Made-with: Cursor
1.7 KiB
1.7 KiB
Requirements
Requirement: Single DataUpdateCoordinator per config entry
The integration SHALL use one PerfectDraftDataUpdateCoordinator per config entry that polls the API on a configurable interval. All entities SHALL read from the coordinator's shared data.
Scenario: Coordinator polls successfully
- WHEN the update interval elapses
- THEN the coordinator SHALL call
get_machine_details(machine_id)using the machine ID from the config entry - THEN it SHALL store the full response in
coordinator.datawith an added_machine_idkey
Scenario: Machine ID not in config entry
- WHEN the config entry has no machine ID
- THEN the coordinator SHALL call
get_user_profile()to discover the machine ID fromperfectdraftMachines[0].id - THEN if no machines are found, it SHALL raise
UpdateFailed
Scenario: Authentication failure during poll
- WHEN the API client raises
AuthenticationError - THEN the coordinator SHALL raise
ConfigEntryAuthFailedto trigger HA's reauth flow
Scenario: API or connection error during poll
- WHEN the API client raises
PerfectDraftApiErrororPerfectDraftConnectionError - THEN the coordinator SHALL raise
UpdateFailedso HA marks entities as unavailable and retries with backoff
Requirement: Dynamic polling interval
The coordinator SHALL support changing the polling interval at runtime via config entry options.
Scenario: Options updated
- WHEN the user changes the polling interval in integration options
- THEN the coordinator SHALL update its
update_intervalto the new value - THEN the minimum interval SHALL be 60 seconds
- THEN the default interval SHALL be 900 seconds (15 minutes)