cremalink.parsing.properties package

This package handles the parsing and decoding of device ‘properties’.

Properties are key-value pairs that represent the static or semi-static attributes of the coffee machine, such as configuration settings or counters.

class cremalink.parsing.properties.PropertiesSnapshot(raw: dict[str, ~typing.Any], received_at: ~datetime.datetime | None, parsed: dict[str, ~typing.Any] = <factory>)[source]

Bases: object

A container for a snapshot of device properties at a specific time.

This class holds the raw property data as received from the device, the timestamp of when it was received, and a dictionary for any parsed or processed values. It provides a helper method to easily access property values from the potentially nested raw data structure.

raw

The raw dictionary of properties from the device.

Type:

dict[str, Any]

received_at

The timestamp when the snapshot was taken.

Type:

datetime.datetime | None

parsed

A dictionary to hold processed or parsed property values.

Type:

dict[str, Any]

get(name: str) Any[source]

Safely retrieves a property by its name from the raw data.

The properties data can come in different formats. This method checks for the property name as a direct key and also searches within the nested ‘property’ objects that are common in the API response.

Parameters:

name – The name of the property to retrieve.

Returns:

The property dictionary if found, otherwise None.

parsed: dict[str, Any]
raw: dict[str, Any]
received_at: datetime | None

Submodules