cremalink.transports.cloud.transport module

This module provides the CloudTransport class, which handles communication with a coffee machine via the manufacturer’s cloud API (Ayla Networks).

class cremalink.transports.cloud.transport.CloudTransport(dsn: str, access_token: str, device_map_path: str | None = None, token_refresher: Callable[[], str] | None = None)[source]

Bases: DeviceTransport

A transport for communicating with a device via the cloud API.

This transport interacts directly with the Ayla cloud service endpoints, using a short-lived access token for authentication. Upon initialization, it fetches key device metadata from the cloud and stores it.

command_map: dict[str, Any]
configure() → None[source]

Configuration is handled during __init__, so this is a no-op.

get_monitor() → Any[source]

Fetches, parses, and returns the device’s monitoring status.

This works by fetching the specific ‘monitor’ property, extracting its base64 value, and then decoding it into a structured snapshot.

get_properties() → Any[source]

Fetches all properties for the device from the cloud API.

get_property(name: str) → Any[source]

Fetches a single, specific property by name.

health() → Any[source]

Returns the device’s online status as determined during initialization. This does not perform a live health check.

pop_response() → bytes | None[source]

Not available over the cloud API — the data_response mailbox is LAN-only.

property_map: dict[str, Any]
refresh_monitor() → Any[source]

The cloud API does not provide a direct way to force a monitor refresh. This method is a no-op.

request_property(name: str) → Any[source]

Not available over the cloud API — refreshes happen on the device’s own republish cadence (native protocol features are LAN-only).

send_command(command: str, alternative_property: str | None = None) → Any[source]

Sends a command to the device by creating a new ‘datapoint’ via the cloud API.

set_mappings(command_map: dict[str, Any], property_map: dict[str, Any]) → None[source]

Stores the provided command and property maps on the instance.

supports_mailbox = False

The cloud API has no response mailbox and cannot ask the device to republish a property; answers arrive as republished dNNN properties instead. Device checks these flags before using pop_response / request_property.

supports_property_requests = False
write_property(name: str, value: Any) → Any[source]

Writes a single named property via a cloud datapoint.

cremalink.transports.cloud.transport.REQUEST_TIMEOUT = (5, 15)

(connect, read) seconds for every cloud call — a hung request must not block the caller (Home Assistant runs these in a shared executor).