Skip to main content

HannaCloud Python Client

NOT OFFICIALLY SUPPORTED BY HANNA --

A Python client library for interacting with the HannaCloud API. This client provides methods for authentication and device data retrieval. Developped solely for the HannaCloud HomeAssistant integration. At least for now.

Installation

You can install the package using pip:

pip install hanna-cloud

Usage

Here's a basic example of how to use the client:

from hanna_cloud import HannaCloudClient

# Initialize the client
client = HannaCloudClient()

# Authenticate with your email and password
access_token = client.authenticate(email="your-email", password="your-password")
print(f"Access token: {access_token}")

# Get devices
devices = client.get_devices()
print(f"Devices: {devices}")

# Get user info
user_info = client.get_user()
print(f"User info: {user_info}")

# Get last device reading
last_reading = client.get_last_device_reading(device_id)
print(f"Last device reading: {last_reading}")

# Get device log history (example)
log_history = client.get_device_log_history(device_id=device_id)
print(f"Device log history: {log_history}")

# Disable Cl and pH pumps
client.set_remote_hold(device_id=device_id, setting=True)

# Enable Cl and pH pumps
client.set_remote_hold(device_id=device_id, setting=False)

Error Handling

The client provides comprehensive error handling with specific exception classes:

Exception Classes

  • HannaCloudError: Base exception for all HannaCloud API errors
  • AuthenticationError: Raised for authentication failures
  • DeviceNotFoundError: Raised when a device is not found
  • APIError: Raised for general API errors with status code and response data
  • RemoteHoldError: Raised when remote hold operations fail
  • DeviceLogError: Raised when device log operations fail
  • ValidationError: Raised for input validation errors

Example Error Handling

from hanna_cloud.client import (
    HannaCloudClient, 
    AuthenticationError, 
    DeviceNotFoundError, 
    ValidationError
)

client = HannaCloudClient()

try:
    # This will raise AuthenticationError if not authenticated
    devices = client.get_devices()
except AuthenticationError as e:
    print(f"Authentication required: {e}")
    # Authenticate first
    client.authenticate("your-email", "your-password")
    devices = client.get_devices()

try:
    # This will raise ValidationError for empty device_id
    client.get_last_device_reading("")
except ValidationError as e:
    print(f"Validation error: {e}")

try:
    # This will raise DeviceNotFoundError if device doesn't exist
    readings = client.get_last_device_reading("nonexistent_device")
except DeviceNotFoundError as e:
    print(f"Device not found: {e}")

Authentication

The client uses email and password authentication. Use the authenticate method to obtain and set the access token for subsequent requests.

API Methods

  • authenticate(email: str, password: str, key_base64: str) -> str: Authenticate and return access token
  • is_authenticated() -> bool: Check if client is authenticated
  • get_devices() -> list: Get list of user's devices
  • get_user() -> dict: Get current user information
  • get_last_device_reading(device_id: str) -> list: Get last reading for a device
  • get_device_log_history(device_id: str, from_dt: datetime, to_dt: datetime) -> list: Get device log history
  • set_remote_hold(device_id: str, setting: bool) -> dict: Set remote hold setting for a device

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for hanna-cloud 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hanna-cloud 0.0.7
File Size Uploaded Provenance Actions
hanna_cloud-0.0.7.tar.gz 7.6 kB With provenance Details for hanna_cloud-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hanna-cloud 0.0.7
File Interpreter ABI Platform Actions
hanna_cloud-0.0.7-py3-none-any.whl Python 3 none any Details for hanna_cloud-0.0.7-py3-none-any.whl

Total release size: 15.4 kB

Release files / hanna_cloud-0.0.7.tar.gz

Download URL hanna_cloud-0.0.7.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6ef3b796b1cdc7d115bd81c38fb8371e68582f398fd1cfd37c3b02103b53d26f
BLAKE2b-256 checksum
How to use checksums
f0bedf0d213e3c79badc751c0034eeca1837b6cebcc83a2c9ca54869830de4a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.

Transparency log

Release files / hanna_cloud-0.0.7-py3-none-any.whl

Download URL hanna_cloud-0.0.7-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84924aaff2f8a201bc353729d2d00333c450dce25e47214ddcbde6129149fabb
BLAKE2b-256 checksum
How to use checksums
5d5f241e5a5fb5ad5c6ad4bbb49ba4bcb1bfbd68822b8243717c92eec4d0866e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.

Transparency log

Security for hanna-cloud 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hanna_cloud-0.0.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page