cremalink.transports.local.transport module
This module provides the LocalTransport class, which handles communication with a coffee machine over the local network (LAN) via a proxy server.
- class cremalink.transports.local.transport.LocalTransport(dsn: str, lan_key: str, device_ip: str | None, server_host: str = '127.0.0.1', server_port: int = 10280, device_scheme: str = 'http', auto_configure: bool = False, command_map: dict[str, Any] | None = None, property_map: dict[str, Any] | None = None)[source]
Bases:
DeviceTransportA transport for communicating with a device on the local network.
This transport does not connect to the device directly. Instead, it sends requests to a local proxy server (cremalink.local_server), which then forwards them to the coffee machine. This architecture simplifies direct device communication and authentication.
- configure() None[source]
Configures the local proxy server with the device’s connection details. This must be called before other methods can be used.
- get_properties() PropertiesSnapshot[source]
Retrieves all device properties from the local proxy server.
- get_property(name: str) Any[source]
Retrieves a single property value from the local proxy server.
The server-side lookup already covers both the bulk snapshot and the per-name datapoint store — no need for a /get_properties round-trip (which would also re-queue the bulk GET) per probe.
- pop_response() bytes | None[source]
Returns the oldest unconsumed data_response frame as raw bytes.
- refresh_monitor() None[source]
Requests a refresh of the monitoring data via the local proxy server.
- request_property(name: str) dict[str, Any][source]
Queues a GET for a single named datapoint on the device.
- send_command(command: str, alternative_property: str | None = None) dict[str, Any][source]
Sends a command to the device via the local proxy server.
alternative_propertyoverrides the configured command datapoint (e.g. striker app_data_request); it is sent as a single-property write carrying the command string.
- set_mappings(command_map: dict[str, Any], property_map: dict[str, Any]) None[source]
Sets the command and property maps and re-configures the server if needed. If the name of the monitoring property changes, the server is reconfigured.