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:
objectHandles 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 register_with_device(state: LocalServerState, method: str | None = None) None[source]
Sends a
local_regrequest to the coffee machine.This tells the device to send its data updates (like monitor status) to this server’s
/local_lanendpoint. The HTTP method is load-bearing (lodzen/cremalink#4, verified against the Coffee Link app’sAylaLanModule.sendLocalRegistration): a live session gets a keep-alivePUT(never re-keys), while starting a session needsPOST, which always triggers a key exchange. Whenmethodis omitted it is chosen fromLocalServerState.session_live().- Parameters:
state – The current server state, containing device IP and scheme.
method –
"PUT"or"POST";Nonepicks automatically.
- Raises:
ValueError – If the device IP is not configured in the state.
ConnectionError – If the HTTP request to the device fails.