Skip to main content

husqvarnaapi

Strictly typed client for the Husqvarna Automower Connect API (pydantic v2, httpx, websocket-client): OAuth2 client credentials, the REST API (AutomowerClient) and the real-time WebSocket event stream (EventStream). Responses, commands and events are frozen pydantic models, unknown enum values are tolerated, the package ships py.typed and passes mypy --strict.

pip install somestuff-husqvarnaapi

You need an application key and secret from the Husqvarna developer portal with the Automower Connect API connected.

REST

from somestuff.husqvarnaapi import AutomowerClient, ClientCredentialsTokenSource

tokens = ClientCredentialsTokenSource("<client-id>", "<client-secret>")
with AutomowerClient(tokens, api_key="<client-id>") as client:
    for mower in client.list_mowers():
        print(mower.id, mower.attributes.mower.activity)

Every call returns typed models (MowerResource, Message, StayOutZones, CommandResult, ...). Failed calls raise subclasses of ApiError (AuthenticationError, TransportError, UnexpectedResponseError, ...).

Area Methods
Read list_mowers, get_mower, get_messages, get_stay_out_zones, list_work_areas, get_map
Actions start, park, pause, resume_schedule, confirm_error, park_until_next_schedule
Settings set_cutting_height, set_headlight_mode, set_calendar, update_work_area, set_stay_out_zone
Profiles list_profiles, create_profile, activate_profile, rename_current_profile, delete_profile

WebSocket events

from somestuff.husqvarnaapi import ClientCredentialsTokenSource, EventStream, PositionEvent, StreamEvent

tokens = ClientCredentialsTokenSource("<client-id>", "<client-secret>")


def on_event(event: StreamEvent) -> None:
    match event:
        case PositionEvent():
            print(event.id, event.attributes.position)


EventStream(tokens, on_event=on_event).run_forever()

EventStream reconnects with exponential backoff and sends keep-alive pings; stop() ends run_forever(). Use parse_event(frame) to turn a raw text frame into a typed event (unknown payloads become UnknownEvent instead of raising) and apply_event(state, event) to fold a state event into the last known MowerAttributes, which returns a new instance.

Dependencies

Package Used for
pydantic >= 2.5 Models and validation
httpx REST and token requests
websocket-client Event stream
loguru Logging

Python 3.13 or newer.

Metadata

Release files for somestuff-husqvarnaapi 0.1.0

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

Source distribution (sdist)

Source distribution for somestuff-husqvarnaapi 0.1.0
File Size Uploaded Provenance Actions
somestuff_husqvarnaapi-0.1.0.tar.gz 30.5 kB Without provenance Details for somestuff_husqvarnaapi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for somestuff-husqvarnaapi 0.1.0
File Interpreter ABI Platform Actions
somestuff_husqvarnaapi-0.1.0-py3-none-any.whl Python 3 none any Details for somestuff_husqvarnaapi-0.1.0-py3-none-any.whl

Total release size: 66.4 kB

Release files / somestuff_husqvarnaapi-0.1.0.tar.gz

Download URL somestuff_husqvarnaapi-0.1.0.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fe3271fe17e47112c9ab468e53d0e3f2d518f1c6dd23f5b4f6c6d8a4f3b223e7
BLAKE2b-256 checksum
How to use checksums
122226227da4d92c18f56e206451e7ffa85af376b287200dcf9e3f0d9a5cd346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.2 {"ci":null,"cpu":"x86_64","distro":{"id":"resolute","libc":{"lib":"glibc","version":"2.43"},"name":"Ubuntu","version":"26.04"},"implementation":{"name":"CPython","version":"3.14.4"},"installer":{"name":"hatch","version":"1.18.2"},"openssl_version":"OpenSSL 3.5.5 27 Jan 2026","python":"3.14.4","system":{"name":"Linux","release":"7.3.5-custom"}} HTTPX2/2.16.2

Release files / somestuff_husqvarnaapi-0.1.0-py3-none-any.whl

Download URL somestuff_husqvarnaapi-0.1.0-py3-none-any.whl
Size 35.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c2c4fc1ab18fce3a8726b040e0a6a09c69a2d5482e9811c3892dc7fb89286be
BLAKE2b-256 checksum
How to use checksums
a25ff31c868666728eb4780d4e2c66ba49db708ad2a71895c39706e885ca1217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.2 {"ci":null,"cpu":"x86_64","distro":{"id":"resolute","libc":{"lib":"glibc","version":"2.43"},"name":"Ubuntu","version":"26.04"},"implementation":{"name":"CPython","version":"3.14.4"},"installer":{"name":"hatch","version":"1.18.2"},"openssl_version":"OpenSSL 3.5.5 27 Jan 2026","python":"3.14.4","system":{"name":"Linux","release":"7.3.5-custom"}} HTTPX2/2.16.2

Security for somestuff-husqvarnaapi 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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