cremalink.parsing.monitor.profile module
This module defines the data structures for a “Monitor Profile”. A profile is a declarative configuration that describes how to interpret the raw bytes of a monitor frame for a specific device model.
- class cremalink.parsing.monitor.profile.FlagDefinition(source: str, byte: int, bit: int, invert: bool = False, description: str | None = None)[source]
Bases:
objectDefines how to extract a boolean flag from a specific bit in a byte array. This is used for parsing the ‘alarms’ and ‘switches’ byte fields.
- class cremalink.parsing.monitor.profile.MonitorProfile(flags: Dict[str, ~cremalink.parsing.monitor.profile.FlagDefinition]=<factory>, enums: Dict[str, ~typing.Dict[int, str]]=<factory>, predicates: Dict[str, ~cremalink.parsing.monitor.profile.PredicateDefinition]=<factory>)[source]
Bases:
objectA complete profile for parsing a device’s monitor frame.
This class holds all the definitions needed to translate the raw bytes of a monitor frame into meaningful, human-readable data. It is typically loaded from a device-specific JSON file.
- available_fields() list[str][source]
Returns a sorted list of all defined flag and predicate names.
- flags: Dict[str, FlagDefinition]
- classmethod from_dict(data: dict | None) MonitorProfile[source]
Constructs a MonitorProfile from a dictionary (e.g., from a JSON file).
- predicates: Dict[str, PredicateDefinition]
- class cremalink.parsing.monitor.profile.PredicateDefinition(kind: str, source: str | None = None, value: Any = None, values: Iterable[Any] | None = None, flag: str | None = None, byte: int | None = None, bit: int | None = None)[source]
Bases:
objectDefines a logical condition to be evaluated against the monitor frame data. Predicates are used to create higher-level boolean states, like “is_on” or “is_making_coffee”.