Skip to main content

Stand With Ukraine Made in Ukraine Stand With Ukraine Russian Warship Go Fuck Yourself

Gaggiuino REST API Wrapper for Python

The Gaggiuino REST API Wrapper is a Python library that provides a simple and efficient way to interact with Gaggiuino-enabled espresso machines. This asynchronous client allows users to manage coffee profiles, retrieve shot data, and control their Gaggiuino-modified espresso machines through a REST API interface.

The library offers comprehensive profile management capabilities, including retrieving and selecting brewing profiles, accessing historical shot data, and handling machine communication with built-in error handling and connection management. It leverages modern Python features and async/await patterns to provide non-blocking operations, making it suitable for integration into larger applications or automation systems.

Usage Instructions

Prerequisites

  • Python 3.11 or higher
  • A running Gaggiuino-enabled espresso machine
  • Network access to the Gaggiuino device (default: http://gaggiuino.local:80)

Installation

pip install gaggiuino_api

Quick Start

import asyncio
from gaggiuino_api import GaggiuinoAPI


async def main():
    async with GaggiuinoAPI() as client:
        # Get the status
        status = await client.get_status()
        print(f"Status: {status}")

        # Get all available profiles
        profiles = await client.get_profiles()

        # Select a profile by ID
        await client.select_profile(profiles[0])

        # Get shot data
        shot = await client.get_shot(1)
        print(f"Shot duration: {shot.duration}ms")


if __name__ == "__main__":
    asyncio.run(main())

More Detailed Examples

Working with Profiles

from gaggiuino_api import GaggiuinoAPI


async def profile_management():
    async with GaggiuinoAPI(base_url="http://custom.gaggiuino.local") as client:
        # Get all profiles
        profiles = await client.get_profiles()

        # Print profile details
        for profile in profiles:
            print(f"Profile: {profile.name} (ID: {profile.id})")
            print(f"Water Temperature: {profile.waterTemperature}°C")

            # Print phases
            for phase in profile.phases:
                print(f"Phase Type: {phase.type.type}")
                print(f"Restriction: {phase.restriction}")

Retrieving Shot Data

from gaggiuino_api import GaggiuinoAPI


async def analyze_shot():
    async with GaggiuinoAPI() as client:
        latest_shot_id_result = await client.get_latest_shot_id()
        latest_shot_id = latest_shot_id_result.lastShotId
        shot = await client.get_shot(latest_shot_id)

        # Access shot metrics
        print(f"Latest Shot ID: {latest_shot_id}")
        print(f"Duration: {shot.duration}ms")
        print(f"Timestamp: {shot.timestamp}")

        # Access datapoints
        pressure_points = shot.datapoints.pressure
        flow_points = shot.datapoints.pumpFlow
        temperature_points = shot.datapoints.temperature

Troubleshooting

Connection Issues

  • Problem: Unable to connect to Gaggiuino device
    from gaggiuino_api import GaggiuinoAPI, GaggiuinoConnectionError
    
    
    async def main():
        try:
            async with GaggiuinoAPI() as client:
                profiles = await client.get_profiles()
        except GaggiuinoConnectionError:
            print("Check if Gaggiuino is powered on and connected to network")
            print("Verify the device is accessible at gaggiuino.local")
    

Endpoint Not Found

  • Problem: API endpoint returns 404
    from gaggiuino_api import GaggiuinoAPI, GaggiuinoEndpointNotFoundError
    
    
    async def main():
        try:
            async with GaggiuinoAPI() as client:
                shot = await client.get_shot(999)
        except GaggiuinoEndpointNotFoundError:
            print("Shot ID not found - verify the shot exists")
    

Data Flow

The Gaggiuino API wrapper manages communication between your Python application and the Gaggiuino-enabled espresso machine through HTTP requests.

[Python App] <-> [GaggiuinoAPI] <-> [HTTP/REST] <-> [Gaggiuino Device]
     |              |                                      |
     |              |                                      |
     +--- Profiles  +---- HTTP Requests ------------------- Machine Control
     |              |                                      |
     +--- Shot Data +---- Response Parsing --------------- Sensor Data

Key component interactions:

  • GaggiuinoAPI class handles all HTTP communication using aiohttp
  • Async context manager ensures proper connection handling and resource cleanup
  • JSON responses are automatically parsed into typed data models
  • Error handling provides specific exceptions for common failure modes
  • Connection management includes automatic session creation and cleanup
  • All API operations are asynchronous for non-blocking operation

I have no idea what this readme is about. It's all ChatGPT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gaggiuino_api-0.2.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gaggiuino_api-0.2.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file gaggiuino_api-0.2.0.tar.gz.

File metadata

  • Download URL: gaggiuino_api-0.2.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gaggiuino_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ebc5ef5fba6abf910ce8807b085bf3eff3b70e0edd59830841072bd4db7a0378
MD5 9150be4673809ce8a15f80065f83d6aa
BLAKE2b-256 495b60568292054a3f175d1e73daa2cfeebef7c9e8fc9468cea9f242f053b04d

See more details on using hashes here.

File details

Details for the file gaggiuino_api-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gaggiuino_api-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gaggiuino_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bc630465e723cd13f8d240ddc73c72c063eeb3e91d5fcb649c8964dff500e3b
MD5 3f934d0e038e95974cd1fcae23e1784b
BLAKE2b-256 87ed6c79f4abe2daa1d2d98f1357577e46c06a3d733fcd9775c2a6e56a0f432e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page