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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| somestuff_husqvarnaapi-0.1.1.tar.gz | 30.5 kB | Without provenance | Details for somestuff_husqvarnaapi-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| somestuff_husqvarnaapi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for somestuff_husqvarnaapi-0.1.1-py3-none-any.whl |
Total release size: 66.5 kB
Release files / somestuff_husqvarnaapi-0.1.1.tar.gz
| Download URL | somestuff_husqvarnaapi-0.1.1.tar.gz |
|---|---|
| Size | 30.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94a99e5705dfc6c281a70140d9ff6ab462182a1e60c5e92e05e163ccf596a1cb
|
|
BLAKE2b-256 checksum How to use checksums |
e8154b0332b40126f79a3bce85184533533e10a52fc7042f4f5d1c59bbd48d00
|
| 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.1-py3-none-any.whl
| Download URL | somestuff_husqvarnaapi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 35.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9b975f6ba6d21a6d75a1cd812586794de40d8659897401966f9ec00b7caea99
|
|
BLAKE2b-256 checksum How to use checksums |
254278a768ee05fda90df463b1375eb5df5702284f3a55a070e87ade430b8e20
|
| 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.1
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.