aiohortos 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ name: Test on Python ${{ matrix.python-version }}
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ python-version: ["3.13", "3.14"]
20
+ steps:
21
+ - uses: actions/checkout@v5
22
+ - uses: astral-sh/setup-uv@v7
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+ enable-cache: true
26
+ - name: Install
27
+ run: uv sync --group dev
28
+ - name: Ruff check
29
+ run: uv run ruff check .
30
+ - name: Ruff format
31
+ run: uv run ruff format --check .
32
+ - name: Mypy
33
+ run: uv run mypy src
34
+ - name: Pytest
35
+ run: uv run pytest --cov-fail-under=100
@@ -0,0 +1,48 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distributions
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v5
16
+ - uses: astral-sh/setup-uv@v7
17
+ with:
18
+ python-version: "3.13"
19
+ - name: Check the tag matches the project version
20
+ run: |
21
+ version="$(uv run --no-project python -c 'import tomllib,pathlib;print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])')"
22
+ if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
23
+ echo "Tag ${GITHUB_REF_NAME} does not match version ${version}" >&2
24
+ exit 1
25
+ fi
26
+ - name: Build
27
+ run: uv build
28
+ - uses: actions/upload-artifact@v4
29
+ with:
30
+ name: dist
31
+ path: dist/
32
+
33
+ publish:
34
+ name: Publish to PyPI
35
+ needs: build
36
+ runs-on: ubuntu-latest
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/aiohortos
40
+ permissions:
41
+ # Required for PyPI trusted publishing; no API token is stored anywhere.
42
+ id-token: write
43
+ steps:
44
+ - uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ htmlcov/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Willem Vooijs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: aiohortos
3
+ Version: 0.1.0
4
+ Summary: Async client for the Ridder HortOS Automation API (HortiMaX greenhouse controllers)
5
+ Project-URL: Homepage, https://github.com/wildekek/aiohortos
6
+ Project-URL: Issues, https://github.com/wildekek/aiohortos/issues
7
+ Project-URL: Changelog, https://github.com/wildekek/aiohortos/releases
8
+ Author-email: Willem Vooijs <willem@vooijs.eu>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: asyncio,greenhouse,horticulture,hortimax,hortos,ridder
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: AsyncIO
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Home Automation
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.13
20
+ Requires-Dist: aiohttp>=3.9
21
+ Requires-Dist: yarl>=1.9
22
+ Description-Content-Type: text/markdown
23
+
24
+ # aiohortos
25
+
26
+ Async Python client for the **Ridder HortOS Automation API**, the cloud API
27
+ behind [HortiMaX](https://www.ridder.com/) greenhouse process controllers.
28
+
29
+ The library is **read-only**: it authenticates with an API key and reads
30
+ controllers, their health, and their readouts. It never writes setpoints.
31
+
32
+ ```bash
33
+ pip install aiohortos
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ import asyncio
40
+
41
+ from aiohortos import HortosClient
42
+
43
+
44
+ async def main() -> None:
45
+ async with HortosClient("your-api-key") as client:
46
+ for device in await client.get_devices():
47
+ print(device.name, device.label)
48
+ for readout in await client.get_latest_readouts(device.name):
49
+ print(
50
+ f" {readout.source.display_name}: "
51
+ f"{readout.identifier} = {readout.value} {readout.unit or ''}"
52
+ )
53
+
54
+
55
+ asyncio.run(main())
56
+ ```
57
+
58
+ Pass an existing session to share a connection pool — which is what you want
59
+ inside an application that already has one:
60
+
61
+ ```python
62
+ async with aiohttp.ClientSession() as session:
63
+ client = HortosClient("your-api-key", session=session)
64
+ ```
65
+
66
+ The client also accepts a `base_url`, for on-premise HortOS installations that
67
+ serve the same API from your own network.
68
+
69
+ ## API surface
70
+
71
+ | Method | Returns |
72
+ | --- | --- |
73
+ | `authenticate()` | `TokenPair` — normally not needed; every call authenticates on demand |
74
+ | `get_device_names()` | `list[str]` of controller identifiers |
75
+ | `get_devices()` | `list[Device]` with the friendly label |
76
+ | `get_devices_health()` | `list[DeviceHealth]` — online state, sync state |
77
+ | `get_readout_definitions(device)` | `list[ReadoutDefinition]` |
78
+ | `get_latest_readouts(device)` | `list[Readout]` with the newest value each |
79
+ | `get_readout_history(...)` | `list[ReadoutValue]` over a window of ≤ 24 hours |
80
+
81
+ Errors all derive from `HortosError`:
82
+
83
+ - `HortosAuthenticationError` — the API key or token was rejected (HTTP 401/403)
84
+ - `HortosConnectionError` — the API could not be reached, or timed out
85
+ - `HortosResponseError` — an unexpected status or payload, with `.status`
86
+
87
+ ## Notes on the API
88
+
89
+ - Tokens live 15 minutes and are renewed with a refresh token valid 7 days.
90
+ The client handles both, and re-authenticates when a token is rejected.
91
+ - The API allows **100 requests per 15 seconds** per key. The library does not
92
+ throttle; pace your own polling.
93
+ - Unchanged readouts are refreshed at most every 5 minutes, so polling faster
94
+ than that gains nothing.
95
+ - Readout identifiers follow `<CamelCaseSubject>-<Kind>`, e.g.
96
+ `VentPositionLeewardSide-Measured`. One upstream typo exists in the wild:
97
+ `IrrigationVolume-Measuered`.
98
+ - Some readouts have `unitIdentifier: "Scalar"` and a numeric value that is
99
+ really an enumeration member id from a table the API does not expose. They
100
+ are returned as-is; decoding them is the caller's problem.
101
+ - `Readout.name` embeds the source's user-defined name and is a poor label on
102
+ its own — build names from `identifier` and `source` instead.
103
+
104
+ Ridder's Swagger UI documents the API at
105
+ <https://hortos.ridder.com/api/process-control/index.html>. The OpenAPI
106
+ document lives at `{base_url}/v1/swagger.json` and needs a bearer token.
107
+
108
+ ## Development
109
+
110
+ ```bash
111
+ uv venv && uv pip install -e . --group dev
112
+ pytest
113
+ ruff check . && ruff format --check . && mypy src
114
+ ```
115
+
116
+ ## Disclaimer
117
+
118
+ Unofficial and not affiliated with Ridder. "HortOS" and "HortiMaX" are their
119
+ trademarks.
@@ -0,0 +1,96 @@
1
+ # aiohortos
2
+
3
+ Async Python client for the **Ridder HortOS Automation API**, the cloud API
4
+ behind [HortiMaX](https://www.ridder.com/) greenhouse process controllers.
5
+
6
+ The library is **read-only**: it authenticates with an API key and reads
7
+ controllers, their health, and their readouts. It never writes setpoints.
8
+
9
+ ```bash
10
+ pip install aiohortos
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```python
16
+ import asyncio
17
+
18
+ from aiohortos import HortosClient
19
+
20
+
21
+ async def main() -> None:
22
+ async with HortosClient("your-api-key") as client:
23
+ for device in await client.get_devices():
24
+ print(device.name, device.label)
25
+ for readout in await client.get_latest_readouts(device.name):
26
+ print(
27
+ f" {readout.source.display_name}: "
28
+ f"{readout.identifier} = {readout.value} {readout.unit or ''}"
29
+ )
30
+
31
+
32
+ asyncio.run(main())
33
+ ```
34
+
35
+ Pass an existing session to share a connection pool — which is what you want
36
+ inside an application that already has one:
37
+
38
+ ```python
39
+ async with aiohttp.ClientSession() as session:
40
+ client = HortosClient("your-api-key", session=session)
41
+ ```
42
+
43
+ The client also accepts a `base_url`, for on-premise HortOS installations that
44
+ serve the same API from your own network.
45
+
46
+ ## API surface
47
+
48
+ | Method | Returns |
49
+ | --- | --- |
50
+ | `authenticate()` | `TokenPair` — normally not needed; every call authenticates on demand |
51
+ | `get_device_names()` | `list[str]` of controller identifiers |
52
+ | `get_devices()` | `list[Device]` with the friendly label |
53
+ | `get_devices_health()` | `list[DeviceHealth]` — online state, sync state |
54
+ | `get_readout_definitions(device)` | `list[ReadoutDefinition]` |
55
+ | `get_latest_readouts(device)` | `list[Readout]` with the newest value each |
56
+ | `get_readout_history(...)` | `list[ReadoutValue]` over a window of ≤ 24 hours |
57
+
58
+ Errors all derive from `HortosError`:
59
+
60
+ - `HortosAuthenticationError` — the API key or token was rejected (HTTP 401/403)
61
+ - `HortosConnectionError` — the API could not be reached, or timed out
62
+ - `HortosResponseError` — an unexpected status or payload, with `.status`
63
+
64
+ ## Notes on the API
65
+
66
+ - Tokens live 15 minutes and are renewed with a refresh token valid 7 days.
67
+ The client handles both, and re-authenticates when a token is rejected.
68
+ - The API allows **100 requests per 15 seconds** per key. The library does not
69
+ throttle; pace your own polling.
70
+ - Unchanged readouts are refreshed at most every 5 minutes, so polling faster
71
+ than that gains nothing.
72
+ - Readout identifiers follow `<CamelCaseSubject>-<Kind>`, e.g.
73
+ `VentPositionLeewardSide-Measured`. One upstream typo exists in the wild:
74
+ `IrrigationVolume-Measuered`.
75
+ - Some readouts have `unitIdentifier: "Scalar"` and a numeric value that is
76
+ really an enumeration member id from a table the API does not expose. They
77
+ are returned as-is; decoding them is the caller's problem.
78
+ - `Readout.name` embeds the source's user-defined name and is a poor label on
79
+ its own — build names from `identifier` and `source` instead.
80
+
81
+ Ridder's Swagger UI documents the API at
82
+ <https://hortos.ridder.com/api/process-control/index.html>. The OpenAPI
83
+ document lives at `{base_url}/v1/swagger.json` and needs a bearer token.
84
+
85
+ ## Development
86
+
87
+ ```bash
88
+ uv venv && uv pip install -e . --group dev
89
+ pytest
90
+ ruff check . && ruff format --check . && mypy src
91
+ ```
92
+
93
+ ## Disclaimer
94
+
95
+ Unofficial and not affiliated with Ridder. "HortOS" and "HortiMaX" are their
96
+ trademarks.
@@ -0,0 +1,86 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "aiohortos"
7
+ version = "0.1.0"
8
+ description = "Async client for the Ridder HortOS Automation API (HortiMaX greenhouse controllers)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.13"
13
+ authors = [{ name = "Willem Vooijs", email = "willem@vooijs.eu" }]
14
+ keywords = ["hortos", "ridder", "hortimax", "greenhouse", "horticulture", "asyncio"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Framework :: AsyncIO",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Topic :: Home Automation",
22
+ "Typing :: Typed",
23
+ ]
24
+ dependencies = ["aiohttp>=3.9", "yarl>=1.9"]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/wildekek/aiohortos"
28
+ Issues = "https://github.com/wildekek/aiohortos/issues"
29
+ Changelog = "https://github.com/wildekek/aiohortos/releases"
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "mypy==1.18.2",
34
+ "pytest==8.4.2",
35
+ "pytest-asyncio==1.2.0",
36
+ "pytest-cov==7.0.0",
37
+ "ruff==0.14.0",
38
+ ]
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/aiohortos"]
42
+
43
+ [tool.pytest.ini_options]
44
+ asyncio_mode = "auto"
45
+ testpaths = ["tests"]
46
+ addopts = "--cov=aiohortos --cov-report=term-missing"
47
+
48
+ [tool.ruff]
49
+ target-version = "py313"
50
+ line-length = 88
51
+
52
+ [tool.ruff.lint]
53
+ select = ["ALL"]
54
+ ignore = [
55
+ "ANN401", # Any is the honest type for raw JSON payloads
56
+ "COM812", # conflicts with the formatter
57
+ "D203", # incompatible with D211
58
+ "D213", # incompatible with D212
59
+ "ISC001", # conflicts with the formatter
60
+ "TRY003", # long messages in raises read fine here
61
+ "EM101", # ... and are clearer inline than via a variable
62
+ "EM102",
63
+ ]
64
+
65
+ [tool.ruff.lint.per-file-ignores]
66
+ "tests/*" = [
67
+ "ANN201", # test functions all return None
68
+ "C901", # the fake server is branchy on purpose
69
+ "D103", # test names say what they test
70
+ "D401",
71
+ "PLR2004", # literals in assertions are the point
72
+ "PT012", # a few raises blocks set up their own input
73
+ "S101", # pytest is built on assert
74
+ "S105", # "tokens" in fixtures are not secrets
75
+ "SLF001", # tests may reach into the client
76
+ "TC003",
77
+ ]
78
+
79
+ [tool.mypy]
80
+ python_version = "3.13"
81
+ strict = true
82
+ warn_unreachable = true
83
+
84
+ [[tool.mypy.overrides]]
85
+ module = "tests.*"
86
+ disallow_untyped_defs = false
@@ -0,0 +1,53 @@
1
+ """Async client for the Ridder HortOS Automation API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .client import HortosClient
6
+ from .const import (
7
+ DEFAULT_BASE_URL,
8
+ DEFAULT_TIMEOUT,
9
+ MAX_HISTORY_WINDOW,
10
+ RATE_LIMIT_REQUESTS,
11
+ RATE_LIMIT_WINDOW,
12
+ )
13
+ from .exceptions import (
14
+ HortosAuthenticationError,
15
+ HortosConnectionError,
16
+ HortosError,
17
+ HortosResponseError,
18
+ )
19
+ from .models import (
20
+ Device,
21
+ DeviceHealth,
22
+ OnlineStatus,
23
+ Organisation,
24
+ Readout,
25
+ ReadoutDefinition,
26
+ ReadoutValue,
27
+ ReadoutValueType,
28
+ Source,
29
+ TokenPair,
30
+ )
31
+
32
+ __all__ = [
33
+ "DEFAULT_BASE_URL",
34
+ "DEFAULT_TIMEOUT",
35
+ "MAX_HISTORY_WINDOW",
36
+ "RATE_LIMIT_REQUESTS",
37
+ "RATE_LIMIT_WINDOW",
38
+ "Device",
39
+ "DeviceHealth",
40
+ "HortosAuthenticationError",
41
+ "HortosClient",
42
+ "HortosConnectionError",
43
+ "HortosError",
44
+ "HortosResponseError",
45
+ "OnlineStatus",
46
+ "Organisation",
47
+ "Readout",
48
+ "ReadoutDefinition",
49
+ "ReadoutValue",
50
+ "ReadoutValueType",
51
+ "Source",
52
+ "TokenPair",
53
+ ]