cremalink.domain.model_detection module
Automatic device-model detection for cloud-assisted onboarding.
Ported precedence order from delonghi_coffee’s
coordinator._detect_contentstack_pattern (constitution Principle IV),
but resolving to one of cremalink’s own existing device_map() ids
(e.g. ECAM452, ECAM610, ECAM612) instead of ContentStack
ECAM-family strings (constitution Principle II).
- Precedence (first match wins), per spec FR-004:
Plaintext model pattern parsed from the raw serial number.
Decoded binary-encoded serial number, mapped via a SKU lookup table.
Model/product-code metadata already present in the cloud device listing.
A static OEM-identifier-to-device-map table.
detect_model_id() MUST NOT guess: if no tier matches, it returns
None so the caller can fall back to the in-flow manual device-map
picker (spec FR-005) rather than ever auto-applying a wrong/default map.
- cremalink.domain.model_detection.detect_model_id(raw_serial: str | None, cloud_metadata: dict[str, Any] | None, oem_model: str | None) str | None[source]
Resolve a discovered device to an existing cremalink device-map id.
- Parameters:
raw_serial – The device’s raw serial number string, if known.
cloud_metadata – Additional cloud-reported fields (e.g.
product_name,model), if any.oem_model – The Ayla
oem_model/modelidentifier, if known.
- Returns:
A valid cremalink device-map id, or
Noneif no detection tier yielded a recognized model. Never returns a guessed or default id.