aiowinet 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.
Files changed (48) hide show
  1. aiowinet-0.1.0/.github/ISSUE_TEMPLATE/bug.yml +29 -0
  2. aiowinet-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. aiowinet-0.1.0/.github/ISSUE_TEMPLATE/feature.yml +17 -0
  4. aiowinet-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +9 -0
  5. aiowinet-0.1.0/.github/dependabot.yml +10 -0
  6. aiowinet-0.1.0/.github/workflows/ci.yml +32 -0
  7. aiowinet-0.1.0/.github/workflows/release.yml +42 -0
  8. aiowinet-0.1.0/.gitignore +10 -0
  9. aiowinet-0.1.0/CHANGELOG.md +185 -0
  10. aiowinet-0.1.0/CONTRIBUTING.md +35 -0
  11. aiowinet-0.1.0/LICENSE +21 -0
  12. aiowinet-0.1.0/PKG-INFO +241 -0
  13. aiowinet-0.1.0/README.md +213 -0
  14. aiowinet-0.1.0/SECURITY.md +8 -0
  15. aiowinet-0.1.0/pyproject.toml +43 -0
  16. aiowinet-0.1.0/src/aiowinet/__init__.py +71 -0
  17. aiowinet-0.1.0/src/aiowinet/_profile.py +80 -0
  18. aiowinet-0.1.0/src/aiowinet/_register.py +69 -0
  19. aiowinet-0.1.0/src/aiowinet/client.py +617 -0
  20. aiowinet-0.1.0/src/aiowinet/const.py +9 -0
  21. aiowinet-0.1.0/src/aiowinet/dialects/__init__.py +38 -0
  22. aiowinet-0.1.0/src/aiowinet/dialects/base.py +42 -0
  23. aiowinet-0.1.0/src/aiowinet/dialects/params.py +241 -0
  24. aiowinet-0.1.0/src/aiowinet/dialects/ram_eep.py +167 -0
  25. aiowinet-0.1.0/src/aiowinet/dialects/registers.py +249 -0
  26. aiowinet-0.1.0/src/aiowinet/dialects/rest_api.py +23 -0
  27. aiowinet-0.1.0/src/aiowinet/discovery.py +142 -0
  28. aiowinet-0.1.0/src/aiowinet/exceptions.py +41 -0
  29. aiowinet-0.1.0/src/aiowinet/models.py +213 -0
  30. aiowinet-0.1.0/src/aiowinet/py.typed +0 -0
  31. aiowinet-0.1.0/src/aiowinet/registers.py +72 -0
  32. aiowinet-0.1.0/src/aiowinet/testing.py +393 -0
  33. aiowinet-0.1.0/tests/__init__.py +0 -0
  34. aiowinet-0.1.0/tests/conftest.py +25 -0
  35. aiowinet-0.1.0/tests/test_clear_alarm.py +89 -0
  36. aiowinet-0.1.0/tests/test_client.py +397 -0
  37. aiowinet-0.1.0/tests/test_decode.py +58 -0
  38. aiowinet-0.1.0/tests/test_dialects.py +140 -0
  39. aiowinet-0.1.0/tests/test_discovery.py +73 -0
  40. aiowinet-0.1.0/tests/test_models.py +22 -0
  41. aiowinet-0.1.0/tests/test_module_info.py +94 -0
  42. aiowinet-0.1.0/tests/test_params.py +171 -0
  43. aiowinet-0.1.0/tests/test_params_scales.py +57 -0
  44. aiowinet-0.1.0/tests/test_power_guard.py +120 -0
  45. aiowinet-0.1.0/tests/test_profiles.py +132 -0
  46. aiowinet-0.1.0/tests/test_real_server.py +134 -0
  47. aiowinet-0.1.0/tests/test_testing.py +72 -0
  48. aiowinet-0.1.0/tests/test_thermorossi.py +222 -0
@@ -0,0 +1,29 @@
1
+ name: Bug report
2
+ description: Report a reproducible problem with aiowinet.
3
+ body:
4
+ - type: input
5
+ id: versions
6
+ attributes:
7
+ label: Versions
8
+ description: Include the aiowinet version and the Python version and operating system.
9
+ validations:
10
+ required: true
11
+ - type: input
12
+ id: device
13
+ attributes:
14
+ label: Device model and firmware
15
+ description: Share the model and firmware version if relevant. Omit serial numbers and device IDs.
16
+ - type: textarea
17
+ id: steps
18
+ attributes:
19
+ label: Steps to reproduce
20
+ description: Include what happened and what you expected instead.
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: diagnostics
25
+ attributes:
26
+ label: Diagnostics and logs
27
+ description: >-
28
+ Include the traceback and a synthetic request or response if available.
29
+ Remove private IP addresses, hostnames, identifiers, credentials and location details before posting.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Report a security vulnerability privately
4
+ url: https://github.com/docteurzoidberg/aiowinet/security/advisories/new
5
+ about: Use GitHub private vulnerability reporting for security issues.
@@ -0,0 +1,17 @@
1
+ name: Feature request
2
+ description: Suggest an improvement to aiowinet.
3
+ body:
4
+ - type: textarea
5
+ id: use-case
6
+ attributes:
7
+ label: Use case
8
+ description: What are you trying to do, and where do you get stuck?
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ id: proposal
13
+ attributes:
14
+ label: Proposed behavior
15
+ description: Describe the result you would like and any alternatives you considered.
16
+ validations:
17
+ required: true
@@ -0,0 +1,9 @@
1
+ ## Changes
2
+
3
+ Describe the problem and how the change addresses it. Link a related issue if
4
+ there is one.
5
+
6
+ ## Verification
7
+
8
+ List the checks you ran and their results. Use synthetic or redacted data in
9
+ examples and logs.
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,32 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ permissions: {}
7
+ concurrency:
8
+ group: ${{ github.workflow }}-${{ github.ref }}
9
+ cancel-in-progress: true
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ timeout-minutes: 10
14
+ permissions:
15
+ contents: read
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ python: ["3.11", "3.12", "3.13", "3.14"]
20
+ steps:
21
+ - uses: actions/checkout@v7
22
+ - uses: actions/setup-python@v7
23
+ with:
24
+ python-version: ${{ matrix.python }}
25
+ cache: pip
26
+ cache-dependency-path: pyproject.toml
27
+ - run: python -m pip install -e '.[dev]'
28
+ - run: ruff check .
29
+ - run: ruff format --check .
30
+ - run: mypy --strict src
31
+ - run: pytest -q
32
+ - run: python -m build
@@ -0,0 +1,42 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags: ["v*"]
5
+ permissions: {}
6
+ concurrency:
7
+ group: release-${{ github.ref }}
8
+ cancel-in-progress: false
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ timeout-minutes: 10
13
+ permissions:
14
+ contents: read
15
+ steps:
16
+ - uses: actions/checkout@v7
17
+ - uses: actions/setup-python@v7
18
+ with:
19
+ python-version: "3.13"
20
+ cache: pip
21
+ cache-dependency-path: pyproject.toml
22
+ - run: python -m pip install build
23
+ - run: python -m build
24
+ - uses: actions/upload-artifact@v7
25
+ with:
26
+ name: distributions
27
+ path: dist/
28
+ publish:
29
+ needs: build
30
+ runs-on: ubuntu-latest
31
+ timeout-minutes: 10
32
+ environment:
33
+ name: pypi
34
+ url: https://pypi.org/p/aiowinet
35
+ permissions:
36
+ id-token: write
37
+ steps:
38
+ - uses: actions/download-artifact@v8
39
+ with:
40
+ name: distributions
41
+ path: dist/
42
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,10 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ .coverage
8
+ htmlcov/
9
+ dist/
10
+ *.egg-info/
@@ -0,0 +1,185 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.1.0] - 2026-12-01
8
+
9
+ First release under the name **aiowinet** (`pip install aiowinet`, `import aiowinet`), a fork
10
+ of aiopelletstove 1.1.0. Changes since aiopelletstove 1.1.0 are listed below; the breaking ones
11
+ are marked **Breaking**.
12
+
13
+ Not included yet from aiopelletstove 1.2.0: reading each category twice with a settle delay,
14
+ and the cache of preferences and diagnostics. They are planned with a measurement of how WiNET
15
+ modules refresh their categories, for every dialect. The status category is read last, as in
16
+ 1.2.0.
17
+
18
+ ### Added
19
+
20
+ - The `params` dialect (`aiowinet.dialects.params`), spoken by WiNET
21
+ modules of Invicta, Ravelli, Piazzetta and other stoves: room temperature,
22
+ status, set point in half degrees, power level, stand-by mode, buzzer, room
23
+ fan in percent, and the alarms decoded from register 3 (`StoveAlarm`,
24
+ `StoveState.alarms`). Register map of module model 1, verified on an Invicta
25
+ Fontica 8 with module firmware 0.42; request bodies are identical to the module's
26
+ own web application. The status category is read last. An answer for
27
+ another category than the one asked for is rejected.
28
+ - Profiles: the register map of one kind of stove board, as data (`Profile`,
29
+ `PROFILES`), separate from the dialect (the shape of the answers). The
30
+ existing maps become the `ram_eep_micronova` and `params_model1` profiles,
31
+ chosen automatically; `PelletStove(profile=...)` forces one by name or takes
32
+ a profile built by the caller, to try a new stove without a new release.
33
+ - `StoveStatus` and `Activity`: each profile has its own status table, whose
34
+ codes map to a common activity; `PowerState` is the Micronova table. Power
35
+ commands and the guard reason on activities, so that boards with another
36
+ numbering need no change in the client. A start is now also confirmed by
37
+ ashpan cleaning (activity "on"), not only by the lighting and running
38
+ statuses.
39
+ - The `registers` dialect and the `thermorossi` profile, **experimental**:
40
+ Thermorossi boards, from the register map of notarobot63/thermorossi-ha
41
+ (MIT). Reads the status (`ThermorossiStatus`, its own 0-9 table), set point,
42
+ room temperature (`None` without a room probe), power level, fan level, flue
43
+ temperature, low pellets and 17 alarms over registers 8 and 9.
44
+ `FakeRegistersStove` in `aiowinet.testing`.
45
+ - `PowerSwitch`: boards with an absolute on/off command instead of the toggle.
46
+ Thermorossi boards write `0x5A00` (on) or `0xA500` (off) to register 1, as
47
+ thermorossi-ha does; turning off also clears an alarm, so
48
+ `async_clear_alarm` uses it there. `async_set_power` sends it in every
49
+ status but alarms and unknown statuses; the command is tracked as pending
50
+ like a toggle, but a new command replaces a pending one instead of being
51
+ refused, since it cannot cancel it by mistake. Boards without a toggle
52
+ refuse `async_toggle_power` (`PelletStoveUnsupportedError`).
53
+ - `params` dialect: the scales some firmwares (0.79) send with the values,
54
+ `tempDiv`, `setTempDiv` and `numPower`, are applied to the room
55
+ temperature, the set point and the highest power level, as the module web
56
+ application does (reported by notarobot63/thermorossi-ha). Without them
57
+ (firmware 0.42), the profile's own scales apply. `key=019` is not read:
58
+ firmwares 0.42 and 0.43 answer it with `{"result": false}`. A customisation
59
+ code other than the default 65535 is logged as a warning, since statuses
60
+ and alarms may then be named wrongly.
61
+ - `async_set_fan_level()` (Thermorossi fan level 1 to 6). The Thermorossi
62
+ power level is written from 1 to 5 only: on some of these boards 0 stops the
63
+ stove, and a level setting must not double as an off command.
64
+ - `StoveState.fan_level` and `StoveState.low_pellets`; `StoveAlarm` gains the
65
+ Thermorossi alarms and `UNKNOWN`, reported for a set bit a profile does not
66
+ name.
67
+ - `aiowinet.dialects.rest_api` documents the local REST `/api` of some
68
+ firmwares (a separate transport, not served by firmware 0.42).
69
+ - `aiowinet.testing`: fake RAM/EEPROM and `params` modules served over
70
+ real HTTP, for tests of the library and of the applications that use it.
71
+ They record requests and reproduce quirks of real modules: stray data after
72
+ the JSON body, an answer for another category, stale values, slow answers,
73
+ HTTP errors and rejected commands.
74
+ - `module_model`, `module_name` and `module_signal`: the module model number,
75
+ name and Wi-Fi level sent along with register answers (`params` dialect).
76
+ - `async_get_module_info()` and `ModuleInfo`: firmware version, firmware update
77
+ availability, Wi-Fi level and RSSI of the module, from `/ajax/get-status`.
78
+ The IP addresses and network name of that answer are not kept.
79
+ - `async_clear_alarm()`. In alarm the stove is neither on nor off: it stopped
80
+ burning and waits for the user, and the only way out is to turn it off,
81
+ which clears the alarm and starts the final cleaning; the stove then goes to
82
+ off and can be lit again. Version 1 refuses every power command in alarm, so
83
+ a user had to walk to the stove. Allowing `async_set_power(False)` in alarm
84
+ would blur two intents, "stop heating" and "acknowledge this alarm", so a
85
+ dedicated method keeps `async_set_power` unchanged (still `blocked` in
86
+ alarm), makes the intent explicit, sends nothing unless the status read under
87
+ the request lock is an alarm, and lets each dialect use its own mechanism:
88
+ the power toggle in the `params` dialect, verified on an Invicta Fontica 8
89
+ with module firmware 0.42. The mechanism of the `ram_eep` dialect is not
90
+ established yet: it raises `PelletStoveUnsupportedError` for now.
91
+ - `async_set_target_temperature`, `async_set_power_level` and
92
+ `async_set_room_fan`, which use the registers of the stove's dialect.
93
+ - Dialect detection: the answer format is recognised on the first read, and
94
+ `PelletStove.dialect` names it. `PelletStove(..., dialect="ram_eep")` skips
95
+ detection. A module that answers in a known format not supported yet
96
+ (`registers`) raises `PelletStoveUnsupportedDialectError` naming it.
97
+ - `PowerState.is_off` and `PowerState.is_alarm`, and `ALARM_STATES`: an alarm
98
+ is neither on nor off.
99
+ - **Breaking:** `PowerResult.PENDING`. After a toggle, `async_set_power`
100
+ returns `pending` and sends nothing until a read confirms the command:
101
+ lighting or running confirms "on"; final cleaning or off confirms "off",
102
+ since every shutdown ends with final cleaning; an alarm ends the attempt.
103
+ Intermediate statuses keep the command pending. The guard is dropped after
104
+ `power_guard` seconds (default 900) without confirmation, or by
105
+ `clear_pending_power()`; `pending_power` tells what is pending. A lost
106
+ acknowledgement keeps the guard. Version 1 left this to every caller, and a
107
+ second toggle cancels the first.
108
+ - `PelletStoveUnsupportedError` for operations a dialect does not have, such
109
+ as the fan regulation outside the RAM/EEPROM dialect.
110
+ - `aiowinet.dialects`: the answer format of the module ("dialect") is now
111
+ a separate layer. The current RAM/EEPROM register map moves to
112
+ `aiowinet.dialects.ram_eep`; `aiowinet.registers` still exports
113
+ every name it exported before, so existing imports keep working. This
114
+ prepares support for the other formats spoken by WiNET modules.
115
+ - `Register.raw_check`, an optional check on the raw value to write, used by
116
+ the packed fan regulation register.
117
+
118
+ ### Changed
119
+
120
+ - `async_get_state` reads the category of the status last (from the second call: the
121
+ first one reuses the category read to detect the dialect).
122
+ - **Breaking:** `StoveState.target_temperature` is a `float`: other dialects
123
+ set it in half degrees.
124
+ - **Breaking:** `StoveState.flue_temperature`, `current_power`, `fan_speed`,
125
+ `standby_mode`, `buzzer` and `enable_fan` may be `None`, for dialects that
126
+ do not have them. The RAM/EEPROM dialect always sets them.
127
+ - A client that does not know its dialect yet reads category 2 before its
128
+ first write, to recognise it.
129
+ - **Breaking:** `StoveState.air_temperature` may be `None`, for stoves
130
+ without a room probe.
131
+ - **Breaking:** `StoveState.power_state` and `PowerCommandOutcome.state` are
132
+ typed `StoveStatus`, the base of every status table; with the existing
133
+ profiles they are still `PowerState` members. Dialect objects no longer carry
134
+ registers (`power_state`, `target_temperature`, `power_level`, `room_fan`,
135
+ `alarm_clear_request`, `state_registers`): profiles do, and `build_state`
136
+ takes the profile.
137
+ - Development: every test runs against the fake modules of
138
+ `aiowinet.testing` instead of aioresponses, which does not support
139
+ aiohttp 3.14 (pnuckowski/aioresponses#289). The development extra no longer
140
+ holds aiohttp below 3.14, so CI tests the aiohttp version Home Assistant
141
+ ships.
142
+ - An HTTP error status (4xx or 5xx) now raises `PelletStoveResponseError`
143
+ instead of `PelletStoveConnectionError`, with the status in the message. The
144
+ stove was reached and answered; only transport failures and timeouts remain
145
+ connection errors. Callers that retry on connection errors no longer retry a
146
+ request the stove refused. A power toggle answered with an HTTP error still
147
+ raises `PelletStovePowerOutcomeUnknownError`.
148
+
149
+ ### Fixed
150
+
151
+ - Accept a response whose JSON body is followed by stray data. Some WiNET
152
+ modules append bytes after the JSON document, such as the start of another
153
+ HTTP response; the first JSON value is now used and the rest is ignored
154
+ (logged at debug level). Previously the request failed with
155
+ `PelletStoveResponseError`.
156
+
157
+ ## [1.1.0] - 2026-11-19
158
+
159
+ ### Changed
160
+
161
+ - Each client sends one request at a time and waits at least 100 ms after a read
162
+ or 150 ms after a write or toggle before sending the next request. Polling
163
+ cannot interleave with a command's requests.
164
+ - `async_set_power` returns a `PowerCommandOutcome` with the result and the
165
+ power state read under the request lock.
166
+ - `async_set_power` no longer toggles in standby or alarm states, where the
167
+ effect of the toggle is undocumented.
168
+ - `async_set_power` raises `PelletStovePowerOutcomeUnknownError` when the
169
+ toggle was sent but its acknowledgement was lost or unreadable, and
170
+ `PelletStoveRejectedError` (a `PelletStoveResponseError`) when the stove
171
+ rejects a request.
172
+
173
+ ## [1.0.0] - 2026-11-18
174
+
175
+ ### Added
176
+
177
+ - Typed async register reads, validated writes, and power and fan controls.
178
+ - Immutable state snapshots, optional diagnostics, and specific exception types.
179
+ - Keep supported readings available when a power code, fan code, or Boolean
180
+ reading is outside the usual range. Writes still validate their inputs.
181
+ - Block absolute power toggles for unknown power states and zero stale readings.
182
+
183
+ [0.1.0]: https://github.com/docteurzoidberg/aiowinet/releases/tag/v0.1.0
184
+ [1.1.0]: https://github.com/voluzi/aiopelletstove/tree/v1.1.0
185
+ [1.0.0]: https://github.com/voluzi/aiopelletstove/tree/v1.0.0
@@ -0,0 +1,35 @@
1
+ # Contributing to aiowinet
2
+
3
+ [Search existing issues](https://github.com/docteurzoidberg/aiowinet/issues) before starting. For a
4
+ new bug, include the software versions, the device model and firmware if
5
+ relevant, and a minimal reproduction. See [SECURITY.md](SECURITY.md) for
6
+ vulnerability reports.
7
+
8
+ ## Development
9
+
10
+ Run these commands from the repository root:
11
+
12
+ ```sh
13
+ python3.13 -m venv .venv
14
+ source .venv/bin/activate
15
+ python -m pip install -e '.[dev]'
16
+ ruff check .
17
+ ruff format --check .
18
+ mypy --strict src
19
+ pytest -q
20
+ python -m build
21
+ ```
22
+
23
+ Tests use synthetic protocol traffic; no physical device is needed. They run
24
+ against the fake modules of `aiowinet.testing`, served over real HTTP on
25
+ a local port, so they also cover HTTP framing and work with every aiohttp
26
+ version.
27
+
28
+ ## Pull requests
29
+
30
+ Keep changes focused. Include a regression test for a behavior change when
31
+ practical, and update the README and changelog when users need to know about
32
+ the change. Describe what changed and how you verified it.
33
+
34
+ Use synthetic or redacted logs, configuration and fixtures. Remove private
35
+ addresses, hostnames, device identifiers, credentials and location information.
aiowinet-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Voluzi
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,241 @@
1
+ Metadata-Version: 2.5
2
+ Name: aiowinet
3
+ Version: 0.1.0
4
+ Summary: Async client for pellet stoves with a WiNET Control Wi-Fi module
5
+ Project-URL: Homepage, https://github.com/docteurzoidberg/aiowinet
6
+ Project-URL: Changelog, https://github.com/docteurzoidberg/aiowinet/blob/main/CHANGELOG.md
7
+ Project-URL: Issues, https://github.com/docteurzoidberg/aiowinet/issues
8
+ Author: DrZoid, Voluzi
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: asyncio,home assistant,micronova,pellet stove,winet
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: AsyncIO
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Home Automation
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: aiohttp<4,>=3.9
21
+ Provides-Extra: dev
22
+ Requires-Dist: build>=1.2; extra == 'dev'
23
+ Requires-Dist: mypy>=1.13; extra == 'dev'
24
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
25
+ Requires-Dist: pytest>=8; extra == 'dev'
26
+ Requires-Dist: ruff>=0.9; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # aiowinet
30
+
31
+ [![PyPI version](https://img.shields.io/pypi/v/aiowinet)](https://pypi.org/project/aiowinet/)
32
+ [![Python versions](https://img.shields.io/badge/Python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3776AB)](https://pypi.org/project/aiowinet/)
33
+ [![Latest GitHub release](https://img.shields.io/github/v/release/docteurzoidberg/aiowinet)](https://github.com/docteurzoidberg/aiowinet/releases/latest)
34
+ [![CI](https://github.com/docteurzoidberg/aiowinet/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/docteurzoidberg/aiowinet/actions/workflows/ci.yml)
35
+ [![MIT license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
36
+
37
+ A typed asyncio client for reading and controlling Wi-Fi pellet stoves over
38
+ the local Micronova-style HTTP register interface of WiNET-style modules. It
39
+ speaks three of the module's answer formats ("dialects"): RAM/EEPROM
40
+ addresses (`ram_eep`), parameter lists (`params`) and register lists
41
+ (`registers`, experimental); see [which profile for which stove](#profiles).
42
+ What is known about the local REST `/api` of some firmwares is documented in
43
+ `aiowinet.dialects.rest_api`. Read a complete stove state, write
44
+ individual settings, or use the higher level power and fan controls.
45
+
46
+
47
+ ## Origin
48
+
49
+ aiowinet started as a fork of [aiopelletstove](https://github.com/voluzi/aiopelletstove) by Voluzi (MIT), which
50
+ spoke the RAM/EEPROM dialect of Micronova boards. It adds the other answer formats of WiNET Control modules, stove
51
+ profiles, discovery and the module identifier. The `ram_eep_micronova` profile keeps the aiopelletstove 1.x map.
52
+
53
+ ## Install
54
+
55
+ ```sh
56
+ python -m pip install aiowinet
57
+ ```
58
+
59
+ ## Quick start
60
+
61
+ Set `PELLET_STOVE_HOST` to your stove's local hostname or address before
62
+ running the example.
63
+
64
+ ```python
65
+ import asyncio
66
+ import os
67
+
68
+ from aiowinet import PelletStove, StoveState
69
+
70
+
71
+ async def read_stove() -> StoveState:
72
+ async with PelletStove(os.environ["PELLET_STOVE_HOST"]) as stove:
73
+ return await stove.async_get_state()
74
+
75
+
76
+ state = asyncio.run(read_stove())
77
+ print(f"Room temperature: {state.air_temperature:.1f} °C")
78
+ print(f"Power state: {state.power_state.label}")
79
+ ```
80
+
81
+ ## API
82
+
83
+ | API | Purpose |
84
+ | --- | --- |
85
+ | `PelletStove(host, *, session=None, timeout=5.0, dialect=None, profile=None, power_guard=900.0)` | Create a client for a hostname or address with optional port. The answer format (dialect) and the register map (profile) are recognised on the first read; force them with `dialect="ram_eep"`, `profile="params_model1"` or your own `Profile`. `power_guard` is explained under `async_set_power`. |
86
+ | `module_model`, `module_name`, `module_signal` | Module model number, name and Wi-Fi level (0–4) sent along with the last register answer, or `None` when the module does not send them (the `params` dialect does). |
87
+ | `dialect`, `profile` | Name of the dialect the stove speaks (`"ram_eep"`, `"params"` or `"registers"`), and the `Profile` it is read with, or `None` before the first read. |
88
+ | `async_set_target_temperature(value)`, `async_set_power_level(level)` | Set the room set point (whole degrees in `ram_eep`, half degrees in `params`) or the power level, and return the readback. |
89
+ | `async_set_room_fan(percent)` | Set the room fan from 50 to 100 % in steps of 5 (`params_model1`). |
90
+ | `async_set_fan_level(level)` | Set the room fan level from 1 to 6 (`thermorossi`). |
91
+ | `async_get_state(include_diagnostics=True)` | Read common status and preferences into an immutable `StoveState`. Set `include_diagnostics=False` to skip alarm and usage counters; those fields will be `None`. |
92
+ | `async_read(register)`, `async_read_many(registers)` | Read and decode registers. Batch reads issue one request per register category. |
93
+ | `async_write(register, value)` | Validate and write a register, then return the decoded readback. |
94
+ | `async_set_power(on)` | Send the absolute on or off command of boards that have one (Thermorossi: refused only in alarms and unknown statuses; a new command replaces a pending one). Otherwise, toggle only when the reported state requires it and return a `PowerCommandOutcome` (`toggled`, `unchanged`, `blocked` or `pending`, plus the state read under the request lock). Unknown states and `TOGGLE_BLOCKED_STATES` (final cleaning, standby, alarms) block toggles. The stove typically reports the new power state a minute or more after a toggle and keeps the old state until then, and a second toggle would cancel the first: until a read confirms the command, `async_set_power` returns `pending` and sends nothing. Lighting or running confirms "on"; final cleaning or off confirms "off" (every shutdown ends with final cleaning); an alarm ends the attempt. The guard is dropped after `power_guard` seconds without confirmation. `PelletStovePowerOutcomeUnknownError` means the toggle was sent without a readable acknowledgement; the guard stays in place. |
95
+ | `async_clear_alarm()` | Clear an alarm as the stove's panel does, by turning it off: the alarm is cleared, the stove runs its final cleaning, then is off and can be lit again. Sends nothing outside alarm states (`blocked`); guarded like a shutdown (`pending` until final cleaning or off). `params_model1` and `thermorossi` profiles; how to clear an alarm in `ram_eep` is not established yet. |
96
+ | `pending_power`, `clear_pending_power()` | The requested state of an unconfirmed power command (`True`, `False` or `None`), and a way to forget it after checking the stove. |
97
+ | `async_toggle_power()` | Send the raw toggle command, bypassing every guard. Prefer `async_set_power` when you know the desired state. |
98
+ | `async_set_fan_regulation(channel, value)` | Set `fan2` or `fan3` to `off`, `1`–`5`, or `auto` while preserving the other channel. RAM/EEPROM dialect only. |
99
+ | `async_get_module_info()` | Read the Wi-Fi module's own status (`/ajax/get-status`) into a `ModuleInfo`: firmware version, whether a firmware update is available, Wi-Fi level (0–4) and RSSI. A separate request, never mixed with register reads. Network details of the answer (addresses, network name) are not kept. |
100
+ | `async_close()` | Close the client-owned session. The async context manager also closes it. |
101
+
102
+ Register definitions and encoding helpers live in
103
+ [`aiowinet.registers`](src/aiowinet/registers.py).
104
+ The caller remains responsible for an injected `aiohttp.ClientSession`.
105
+ Each client sends one request at a time, with an idle gap of at least 100 ms
106
+ after a read and 150 ms after a write or power toggle. Polling cannot interrupt
107
+ a command's sequence of requests. Use one client per stove to share the queue.
108
+
109
+ Each profile has its own status table (`StoveStatus`); every code maps to an
110
+ `Activity`, and `is_on`, `is_off` and `is_alarm` follow from it. Unknown codes
111
+ retain their integer value with a label of `unknown_<code>`, `is_known=False`
112
+ and the `unknown` activity. Active heating and ashpan cleaning are both `on`.
113
+ An alarm is neither on nor off: the stove stopped and waits for the user.
114
+ `StoveState` fields a profile does not provide are `None` (see
115
+ [Profiles](#profiles)). In the `ram_eep_micronova` profile, off and unknown
116
+ states zero stale power, flue temperature, and fan speed; a fan channel with an
117
+ unsupported code is `None`, and the client refuses a write that would
118
+ overwrite an unknown setting on the other channel.
119
+
120
+ ## Discovery
121
+
122
+ A WiNET module answers the UDP datagram `###discover` (port 1025) with its
123
+ address and a stable identifier, `WINET-` followed by 8 hexadecimal digits. The
124
+ identifier does not change with the IP address or the module name, so it can
125
+ identify a stove, and find it again after its address changed:
126
+
127
+ ```python
128
+ from aiowinet import async_discover, async_get_module_id
129
+
130
+ modules = await async_discover() # broadcast, listens 2 s
131
+ # [DiscoveredModule(host='192.168.1.40', module_id='WINET-0A1B2C3D')]
132
+ module_id = await async_get_module_id("192.168.1.40") # one module
133
+ ```
134
+
135
+ `async_get_module_id` sends the datagram again when no answer comes (UDP may
136
+ lose it), then raises `PelletStoveConnectionError`.
137
+
138
+ ## Profiles
139
+
140
+ A dialect is the shape of the module's answers; a **profile** says what the
141
+ registers mean for one kind of stove board: which register holds what, at
142
+ which scale, which status table and which alarms apply. Profiles are data
143
+ (`Profile`), listed by name in `PROFILES`. The client recognises the dialect
144
+ and chooses the profile on its first read; `stove.profile` tells which one.
145
+
146
+ ### Which profile for which stove
147
+
148
+ | Profile | Dialect | Stoves | Module firmware | Status |
149
+ | --- | --- | --- | --- | --- |
150
+ | `params_model1` | `params` | **Invicta** (Fontica 8, verified). Other projects report the same answers on Ravelli, Piazzetta and Stufe a Pellet Italia stoves, and on Thermorossi stoves with firmware 0.43 or 0.79 | 0.42 verified; 0.17, 0.43, 0.51, 0.79 reported (on 0.79 the module sends its own scales with the values: they are applied) | **verified** on an Invicta Fontica 8, firmware 0.42 |
151
+ | `thermorossi` | `registers` | **Thermorossi** (thermorossi-ha; the IDRA 21 hydro and Slimquadro 9 Evo share the main registers) | 0.73, 0.81 reported | **experimental**: map from other projects, not confirmed through this library yet |
152
+ | `ram_eep_micronova` | `ram_eep` | Micronova boards answering with RAM/EEPROM addresses (reported: Duepi EVO, Bestove) | not documented | the aiopelletstove 1.x map |
153
+
154
+ What each profile provides:
155
+
156
+ | | `params_model1` | `thermorossi` | `ram_eep_micronova` |
157
+ | --- | --- | --- | --- |
158
+ | Room temperature, set point, power level | ✓ (half degrees) | ✓ (quarter degrees; no room probe: `None`; power written 1–5, since 0 stops some boards) | ✓ |
159
+ | Status table | Micronova (`PowerState`) | Thermorossi (`ThermorossiStatus`) | Micronova (`PowerState`) |
160
+ | On and off | toggle, guarded | absolute write of register 1 | toggle, guarded |
161
+ | Alarms | 8 named alarms, in alarm states | 17 named alarms, in every status | last alarm code (diagnostics) |
162
+ | Clear an alarm (`async_clear_alarm`) | ✓ (the toggle) | ✓ (turning off) | not established |
163
+ | Other | room fan 50–100 %, stand-by, buzzer | fan level 1–6, flue temperature, low pellets | flue temperature, current power, fan speed, fans 2 and 3, counters |
164
+
165
+ A stove "reported" in the table was seen by another project with the same
166
+ answers; the library has not been tried on it. If the stove you use is
167
+ missing, or a value looks wrong, please open an issue with the answers of
168
+ your module (`key=020` for each category).
169
+
170
+ Each board numbers its statuses its own way: a profile's status table
171
+ (`StoveStatus`, `PowerState` for Micronova boards) gives each code a label and
172
+ an `Activity` (off, starting, on, shutting down, standby, alarm, unknown), and
173
+ the power commands reason on activities only. To try a stove the library does
174
+ not know yet, build a `Profile` (for instance with `dataclasses.replace` on a
175
+ close one) and pass it as `profile=`; once it works, please propose it
176
+ upstream.
177
+
178
+ ## Testing your code
179
+
180
+ `aiowinet.testing` serves fake modules over real HTTP on a local port,
181
+ so integration tests run the real client stack without a stove:
182
+
183
+ ```python
184
+ from aiowinet import PelletStove
185
+ from aiowinet.testing import FakeParamsStove
186
+
187
+
188
+ async def test_reads_the_stove() -> None:
189
+ async with FakeParamsStove() as fake, PelletStove(fake.host) as stove:
190
+ fake.power_state = 4
191
+ state = await stove.async_get_state()
192
+ assert state.power_state.is_on
193
+ ```
194
+
195
+ `FakeParamsStove`, `FakeRamEepStove` and `FakeRegistersStove` record the
196
+ requests they receive and
197
+ can reproduce quirks of real modules: stray data after the JSON body
198
+ (`trailing_data`), an answer for another category (`wrong_category`), stale
199
+ values (`freeze()`), slow answers (`delay`), HTTP errors (`status`) and
200
+ rejected commands (`toggle_body`).
201
+ The fakes also answer discovery on 127.0.0.1, port `fake.discovery_port`,
202
+ with `fake.module_id`; `discovery_answers = False` makes them silent.
203
+
204
+ ## Errors
205
+
206
+ | Error | Meaning |
207
+ | --- | --- |
208
+ | `PelletStoveError` | Base class for client and protocol errors |
209
+ | `PelletStoveConnectionError` | Transport failure or timeout: the stove could not be reached |
210
+ | `PelletStoveResponseError` | HTTP error status, or malformed, incomplete, or rejected response |
211
+ | `PelletStoveRejectedError` | Explicit rejection by the stove; a `PelletStoveResponseError` |
212
+ | `PelletStovePowerOutcomeUnknownError` | A power toggle was sent but its acknowledgement was lost or unreadable |
213
+ | `PelletStoveReadOnlyError` | Attempted write to a read-only register |
214
+ | `PelletStoveUnsupportedDialectError` | The stove answers in a format this version cannot read; a `PelletStoveResponseError` |
215
+ | `PelletStoveUnsupportedError` | The operation does not exist in the stove's dialect |
216
+ | `PelletStoveValueError` | Invalid host or unsupported or out-of-range input; also a `ValueError` |
217
+
218
+ ## Compatibility
219
+
220
+ Requires Python **3.11 or later** and `aiohttp>=3.9,<4`. CI tests Python 3.11,
221
+ 3.12, 3.13, and 3.14. The package includes type information.
222
+
223
+ The stove's Wi-Fi module and firmware must expose the local HTTP form API
224
+ and one of the register layouts defined in this package. The `params` map is
225
+ the one of module model 1, verified on an Invicta Fontica 8 with module
226
+ firmware 0.42; its status category is read last, because these modules seem
227
+ to refresh from the stove only the categories they are asked for often. Compatibility
228
+ depends on the register layout; the package does not verify models by name.
229
+ Requests use plain HTTP with no login handshake or internal retries. A
230
+ timeout applies to each request, so operations spanning several categories
231
+ can take longer than one timeout.
232
+
233
+ ## Contributing
234
+
235
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development and test instructions,
236
+ [CHANGELOG.md](CHANGELOG.md) for release notes, and [SECURITY.md](SECURITY.md)
237
+ for private vulnerability reporting.
238
+
239
+ ## License
240
+
241
+ [MIT](LICENSE).