Async client library for the Mahlkönig X54 grinder
Project description
Mahlkönig X54 Client
A Python client for the Mahlkönig X54 coffee grinder with WebSocket API support.
Installation
uv add mahlkoenig
or
pip install mahlkoenig
Features
- Asynchronous WebSocket communication with the X54 grinder
- API coverage for common grinder operations
- Type-safe request and response handling
- Automatic connection management and authentication
- Easy access to grinder status, recipes, and statistics
Quick Start
import asyncio
from mahlkoenig import Grinder, AutoSleepTimePreset
async def main():
# Connect to your grinder (default password is empty)
async with X54Client(host="10.10.10.10") as client:
# Get machine information
machine_info = await client.request_machine_info()
print(f"Connected to X54 grinder: {machine_info.serial_no}")
print(f"Software version: {machine_info.sw_version}")
# Get all recipes
recipes = await client.request_recipe_list()
for recipe_no, recipe in recipes.items():
print(f"Recipe {recipe_no}: {recipe.name} - {recipe.grind_time}")
# Set auto sleep time to 10 minutes
await client.set_auto_sleep_time(AutoSleepTimePreset.MIN_10)
print(f"Set auto sleep time to 10min")
# Get grinding statistics
stats = await client.request_statistics()
print(f"Total grinding shots: {stats.total_grind_shots}")
print(f"Total grinding time: {stats.total_grind_time}")
if __name__ == "__main__":
asyncio.run(main())
API Reference
The Grinder class provides these main methods:
connect()- Establishes connection to the grinderclose()- Closes the connectionrequest_machine_info()- Gets machine informationrequest_wifi_info()- Gets WiFi settingsrequest_system_status()- Gets current grinder statusrequest_recipe_list()- Gets all programmed recipesrequest_auto_sleep_time()- Gets current auto-sleep settingset_auto_sleep_time()- Changes auto-sleep settingrequest_statistics()- Gets usage statistics
The client also supports context manager syntax for automatic connection management.
Development
See DEVELOP.md for instruction on how to use mitmproxy to intercept the communication between the app and the grinder
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mahlkoenig-0.2.1.tar.gz.
File metadata
- Download URL: mahlkoenig-0.2.1.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e7d51f64295c365828057f16f4896b8ecf903d0e75a30b5e8ebefa53d98f09
|
|
| MD5 |
04250b3de992bdf85d2ee2ff09b29864
|
|
| BLAKE2b-256 |
4d8c05bb4c6b68395bef5d201c0a329c143234f097c02f51bc3c6a89de8679e7
|
File details
Details for the file mahlkoenig-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mahlkoenig-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9634f2d8a5cb60f51cb6b4f7292fa464221429aca9ffde56089f629b4b3f37d9
|
|
| MD5 |
b639eaeba236bbfd7a3037edbd9bdc0e
|
|
| BLAKE2b-256 |
9db65c6cfe3a84027aafec6a2aca937ecb5c56c677f5ed37c2aba120de9a740a
|