cremalink.parsing.monitor.view module

This module provides the MonitorView class, which offers a high-level, user-friendly interface for accessing data from a MonitorSnapshot.

class cremalink.parsing.monitor.view.MonitorView(snapshot: MonitorSnapshot, profile: MonitorProfile | dict[str, Any] | None = None)[source]

Bases: object

A user-friendly view of a MonitorSnapshot, powered by a MonitorProfile.

This class acts as a wrapper around a MonitorSnapshot. It uses a given MonitorProfile to translate raw, low-level data (like integer codes and bit flags) into human-readable values (like enum names and boolean predicates).

It provides dynamic attribute access (__getattr__) to resolve flags and predicates from the profile on the fly. For example, view.is_on or view.has_descaling_alarm.

property accessory_code: int | None

The raw integer code for the currently detected accessory.

property accessory_name: str | None

The human-readable name of the accessory (e.g., ‘Milk Carafe’).

property action_code: int | None

The raw integer code for the device’s current action.

property action_name: str | None

The human-readable name of the device’s action (e.g., ‘Brewing’).

property available_fields: list[str]

A list of all available dynamic fields (flags and predicates).

property parsed: dict[str, Any]

The dictionary of initially parsed, low-level fields.

property profile_summary: dict[str, Any]

A summary of the loaded profile.

property progress_percent: int | None

The progress percentage (0-100) of the current action.

property raw: bytes

The raw bytes of the monitor payload.

property raw_b64: str

The base64-encoded string of the monitor payload.

property received_at

The timestamp when the snapshot was received.

property status_code: int | None

The raw integer code for the device’s main status.

property status_name: str | None

The human-readable name of the device’s status (e.g., ‘Standby’).