cremalink.parsing.monitor.frame module

This module defines the low-level structure of a “monitor” data frame. It handles the byte-level decoding of the raw payload from the device.

class cremalink.parsing.monitor.frame.MonitorFrame(direction: int, request_id: int, answer_required: int, accessory: int, switches: bytes, alarms: bytes, status: int, action: int, progress: int, timestamp: bytes, extra: bytes, raw: bytes, raw_b64: str)[source]

Bases: object

Represents the decoded, low-level structure of a monitor data frame.

This class takes the raw bytes from a monitor update and parses them into their fundamental components according to the device’s binary protocol. This includes separating headers, payload, checksums, and timestamps.

accessory: int
action: int
alarms: bytes
answer_required: int
as_dict() dict[source]

Returns a dictionary representation of the frame’s contents. This is useful for serialization or debugging.

direction: int
extra: bytes
classmethod from_b64(raw_b64: str) MonitorFrame[source]

Decodes a base64 string into a structured MonitorFrame.

This factory method performs the primary byte-level parsing, including: - Base64 decoding. - Length validation. - CRC-16 checksum verification. - Splitting the raw bytes into their respective fields (header, payload, etc.).

Parameters:

raw_b64 – The base64-encoded monitor data string.

Returns:

A populated MonitorFrame instance.

Raises:

ValueError – If the data is malformed, too short, or fails the CRC check.

progress: int
raw: bytes
raw_b64: str
request_id: int
status: int
switches: bytes
timestamp: bytes