cremalink.local_server_app.device_adapter module

This module provides an adapter for communicating directly with the coffee machine device on the local network. Its main purpose is to handle the device registration process.

class cremalink.local_server_app.device_adapter.DeviceAdapter(settings: ServerSettings, logger)[source]

Bases: object

Handles direct HTTP communication with the physical coffee machine.

This class is responsible for the ‘registration’ step, where this local proxy server informs the coffee machine of its presence, telling it where to send data pushes.

async close() None[source]

Closes the underlying httpx client if it exists.

async register_with_device(state: LocalServerState) None[source]

Sends a registration request to the coffee machine.

This tells the device to send its data updates (like monitor status) to this server’s /local_lan endpoint.

Parameters:

state – The current server state, containing device IP and scheme.

Raises:
  • ValueError – If the device IP is not configured in the state.

  • ConnectionError – If the HTTP request to the device fails.