aiovents 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 @@
1
+ * @helder-moreira
@@ -0,0 +1,34 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ workflow_call:
7
+ permissions: {}
8
+ concurrency:
9
+ group: ci-${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: true
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 10
15
+ permissions:
16
+ contents: read
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python: ["3.11", "3.12", "3.13"]
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+ - uses: actions/setup-python@v6
24
+ with:
25
+ python-version: ${{ matrix.python }}
26
+ cache: pip
27
+ cache-dependency-path: pyproject.toml
28
+ - run: python -m pip install -e '.[dev]'
29
+ - run: ruff check .
30
+ - run: ruff format --check .
31
+ - run: mypy --strict src
32
+ - run: pytest -q
33
+ - if: github.ref_type != 'tag'
34
+ run: python -m build
@@ -0,0 +1,47 @@
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
+ test:
11
+ permissions:
12
+ contents: read
13
+ uses: ./.github/workflows/ci.yml
14
+ build:
15
+ needs: test
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 10
18
+ permissions:
19
+ contents: read
20
+ steps:
21
+ - uses: actions/checkout@v7
22
+ - uses: actions/setup-python@v6
23
+ with:
24
+ python-version: "3.13"
25
+ cache: pip
26
+ cache-dependency-path: pyproject.toml
27
+ - run: python -m pip install build
28
+ - run: python -m build
29
+ - uses: actions/upload-artifact@v4
30
+ with:
31
+ name: distributions
32
+ path: dist/
33
+ publish:
34
+ needs: build
35
+ runs-on: ubuntu-latest
36
+ timeout-minutes: 10
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/aiovents
40
+ permissions:
41
+ id-token: write
42
+ steps:
43
+ - uses: actions/download-artifact@v4
44
+ with:
45
+ name: distributions
46
+ path: dist/
47
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
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/
11
+ uv.lock
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Add an asynchronous Vents AHU client with batched status and fan settings reads.
6
+ - Verify reply sender, device ID, checksum, and exact register set.
7
+ - Decode signed temperatures and filter countdowns and expose unsupported values as missing.
8
+ - Verify compact writes and read back on an unconfirmed echo or reply timeout. The reference
9
+ sync client does not read back on timeout.
10
+ - Support filter reset.
aiovents-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,88 @@
1
+ Metadata-Version: 2.5
2
+ Name: aiovents
3
+ Version: 0.1.0
4
+ Summary: Async UDP client for Vents air handling units
5
+ Project-URL: Homepage, https://github.com/voluzi/aiovents
6
+ Project-URL: Issues, https://github.com/voluzi/aiovents/issues
7
+ Project-URL: Changelog, https://github.com/voluzi/aiovents/blob/main/CHANGELOG.md
8
+ Author: Voluzi
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Classifier: Framework :: AsyncIO
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Home Automation
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.11
20
+ Provides-Extra: dev
21
+ Requires-Dist: build>=1.2; extra == 'dev'
22
+ Requires-Dist: mypy>=1.13; extra == 'dev'
23
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
24
+ Requires-Dist: pytest>=8; extra == 'dev'
25
+ Requires-Dist: ruff>=0.9; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # aiovents
29
+
30
+ An asyncio UDP client for Vents and Blauberg air handling units that use the Vents AHU protocol.
31
+ It requires Python 3.11 or newer and has no runtime dependencies.
32
+
33
+ ## Usage
34
+
35
+ ```python
36
+ import asyncio
37
+
38
+ from aiovents import AsyncVents, VentsStatus
39
+
40
+
41
+ async def read_status() -> VentsStatus:
42
+ async with AsyncVents(
43
+ "vents-ahu.example",
44
+ "0000000000000000",
45
+ password="example-password",
46
+ ) as client:
47
+ return await client.async_get_status()
48
+
49
+
50
+ status = asyncio.run(read_status())
51
+ ```
52
+
53
+ The default UDP port is 4000 and the reply timeout is 1.5 seconds. The device ID must
54
+ contain 1 to 16 ASCII characters; IDs shorter than 16 characters are padded on the right
55
+ with zeroes. Supply the unit's configured password; omitting it uses the protocol default.
56
+
57
+ `async_get_status()` and `async_get_settings()` each read one batch. Unsupported or unreadable
58
+ values are `None`. Temperatures are signed Celsius values, and the filter countdown is in days.
59
+ For individual registers, use `async_read_register()` or `async_read_registers()` with definitions
60
+ from `aiovents.registers`.
61
+
62
+ Writes are verified against the device echo or by reading back the register. If the write
63
+ reply times out, the async client still reads the register to check whether the device applied
64
+ the write. The reference sync client raises on that timeout without reading back. For example,
65
+ `await client.async_write_register(SPEED, FanSpeed.LOW)` requests low fan speed and returns
66
+ the confirmed value, which can differ from the request. `SPEED` is available from
67
+ `aiovents.registers`, and `FanSpeed` from `aiovents`.
68
+
69
+ `async_reset_filter()` sends two unacknowledged triggers; read the status to check whether
70
+ the countdown reset. The client serializes operations, accepts matching replies from the unit's
71
+ IP regardless of source port, and refreshes DNS after three consecutive request failures.
72
+ An unreachable device raises `VentsConnectionError`. The async context manager releases the
73
+ UDP socket.
74
+
75
+ ## Development
76
+
77
+ ```sh
78
+ python -m pip install -e '.[dev]'
79
+ ruff check .
80
+ ruff format --check .
81
+ mypy --strict src
82
+ pytest -q
83
+ python -m build
84
+ ```
85
+
86
+ The tests use synthetic frames and loopback UDP peers.
87
+
88
+ MIT license.
@@ -0,0 +1,61 @@
1
+ # aiovents
2
+
3
+ An asyncio UDP client for Vents and Blauberg air handling units that use the Vents AHU protocol.
4
+ It requires Python 3.11 or newer and has no runtime dependencies.
5
+
6
+ ## Usage
7
+
8
+ ```python
9
+ import asyncio
10
+
11
+ from aiovents import AsyncVents, VentsStatus
12
+
13
+
14
+ async def read_status() -> VentsStatus:
15
+ async with AsyncVents(
16
+ "vents-ahu.example",
17
+ "0000000000000000",
18
+ password="example-password",
19
+ ) as client:
20
+ return await client.async_get_status()
21
+
22
+
23
+ status = asyncio.run(read_status())
24
+ ```
25
+
26
+ The default UDP port is 4000 and the reply timeout is 1.5 seconds. The device ID must
27
+ contain 1 to 16 ASCII characters; IDs shorter than 16 characters are padded on the right
28
+ with zeroes. Supply the unit's configured password; omitting it uses the protocol default.
29
+
30
+ `async_get_status()` and `async_get_settings()` each read one batch. Unsupported or unreadable
31
+ values are `None`. Temperatures are signed Celsius values, and the filter countdown is in days.
32
+ For individual registers, use `async_read_register()` or `async_read_registers()` with definitions
33
+ from `aiovents.registers`.
34
+
35
+ Writes are verified against the device echo or by reading back the register. If the write
36
+ reply times out, the async client still reads the register to check whether the device applied
37
+ the write. The reference sync client raises on that timeout without reading back. For example,
38
+ `await client.async_write_register(SPEED, FanSpeed.LOW)` requests low fan speed and returns
39
+ the confirmed value, which can differ from the request. `SPEED` is available from
40
+ `aiovents.registers`, and `FanSpeed` from `aiovents`.
41
+
42
+ `async_reset_filter()` sends two unacknowledged triggers; read the status to check whether
43
+ the countdown reset. The client serializes operations, accepts matching replies from the unit's
44
+ IP regardless of source port, and refreshes DNS after three consecutive request failures.
45
+ An unreachable device raises `VentsConnectionError`. The async context manager releases the
46
+ UDP socket.
47
+
48
+ ## Development
49
+
50
+ ```sh
51
+ python -m pip install -e '.[dev]'
52
+ ruff check .
53
+ ruff format --check .
54
+ mypy --strict src
55
+ pytest -q
56
+ python -m build
57
+ ```
58
+
59
+ The tests use synthetic frames and loopback UDP peers.
60
+
61
+ MIT license.
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "aiovents"
7
+ version = "0.1.0"
8
+ description = "Async UDP client for Vents air handling units"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ authors = [{name = "Voluzi"}]
13
+ classifiers = [
14
+ "Framework :: AsyncIO",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Home Automation",
21
+ "Typing :: Typed",
22
+ ]
23
+ dependencies = []
24
+
25
+ [project.optional-dependencies]
26
+ dev = ["pytest>=8", "pytest-asyncio>=0.24", "mypy>=1.13", "ruff>=0.9", "build>=1.2"]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/voluzi/aiovents"
30
+ Issues = "https://github.com/voluzi/aiovents/issues"
31
+ Changelog = "https://github.com/voluzi/aiovents/blob/main/CHANGELOG.md"
32
+
33
+ [tool.pytest.ini_options]
34
+ asyncio_mode = "auto"
35
+ asyncio_default_fixture_loop_scope = "function"
36
+ testpaths = ["tests"]
37
+
38
+ [tool.mypy]
39
+ strict = true
40
+ files = ["src"]
41
+
42
+ [tool.ruff.lint]
43
+ select = ["E", "F", "I", "UP", "B", "ASYNC"]
@@ -0,0 +1,20 @@
1
+ """Async UDP client for Vents air handling units."""
2
+
3
+ from .aio import AsyncVents
4
+ from .codec import RegisterValue
5
+ from .exceptions import VentsConnectionError, VentsError, VentsValueError
6
+ from .models import FanSpeed, Mode, VentsSettings, VentsStatus
7
+ from .registers import Register
8
+
9
+ __all__ = [
10
+ "AsyncVents",
11
+ "FanSpeed",
12
+ "Mode",
13
+ "Register",
14
+ "RegisterValue",
15
+ "VentsConnectionError",
16
+ "VentsError",
17
+ "VentsSettings",
18
+ "VentsStatus",
19
+ "VentsValueError",
20
+ ]
@@ -0,0 +1,317 @@
1
+ """Async client for the Vents AHU UDP protocol."""
2
+
3
+ import asyncio
4
+ import logging
5
+ import socket
6
+ from collections import deque
7
+ from collections.abc import Sequence
8
+ from types import TracebackType
9
+ from typing import Self
10
+
11
+ from .codec import (
12
+ RegisterKey,
13
+ RegisterValue,
14
+ Reply,
15
+ build_body,
16
+ build_frame,
17
+ decode_reply,
18
+ encode_password,
19
+ encode_write,
20
+ extract_inner,
21
+ format_value,
22
+ normalize_device_id,
23
+ register_name,
24
+ trigger_body,
25
+ )
26
+ from .const import (
27
+ DEFAULT_PASSWORD,
28
+ DEFAULT_PORT,
29
+ DEFAULT_TIMEOUT,
30
+ PARAMETER_READ,
31
+ PARAMETER_WRITE,
32
+ PARAMETER_WRITE_WITH_RESPONSE,
33
+ )
34
+ from .exceptions import VentsConnectionError, VentsError, VentsValueError
35
+ from .models import SETTINGS_REGISTERS, STATUS_REGISTERS, VentsSettings, VentsStatus
36
+ from .registers import FILTER_TIMER_RESET, RESET_ALARMS, Register
37
+
38
+ _LOGGER = logging.getLogger(__name__)
39
+ _DNS_REFRESH_FAILURES = 3
40
+
41
+
42
+ class _ReplyTimeout(VentsConnectionError):
43
+ """No matching reply arrived before the deadline."""
44
+
45
+
46
+ class _VentsDatagramProtocol(asyncio.DatagramProtocol):
47
+ def __init__(self) -> None:
48
+ self.datagrams: deque[tuple[bytes, tuple[str, int]]] = deque(maxlen=64)
49
+ self.ready = asyncio.Event()
50
+ self.lost = False
51
+ self.errors = 0
52
+
53
+ def datagram_received(self, data: bytes, addr: tuple[str, int]) -> None:
54
+ self.datagrams.append((data, addr))
55
+ self.ready.set()
56
+
57
+ def error_received(self, exc: Exception) -> None:
58
+ self.errors += 1
59
+ _LOGGER.debug("UDP transport reported an error: %s", exc)
60
+
61
+ def connection_lost(self, exc: Exception | None) -> None:
62
+ self.lost = True
63
+ self.ready.set()
64
+
65
+ def drain(self) -> None:
66
+ self.datagrams.clear()
67
+ self.ready.clear()
68
+ self.errors = 0
69
+
70
+ async def receive(self) -> tuple[bytes, tuple[str, int]]:
71
+ while not self.datagrams:
72
+ if self.lost:
73
+ raise OSError("UDP transport closed")
74
+ self.ready.clear()
75
+ await self.ready.wait()
76
+ return self.datagrams.popleft()
77
+
78
+
79
+ class AsyncVents:
80
+ """Serialize batched reads, writes and triggers on a lazy UDP transport."""
81
+
82
+ def __init__(
83
+ self,
84
+ host: str,
85
+ device_id: str,
86
+ *,
87
+ port: int = DEFAULT_PORT,
88
+ password: str = DEFAULT_PASSWORD,
89
+ timeout: float = DEFAULT_TIMEOUT,
90
+ ) -> None:
91
+ self._host = host
92
+ self._port = port
93
+ self._timeout = timeout
94
+ self._device_id = normalize_device_id(device_id)
95
+ self._device_bytes = self._device_id.encode("ascii")
96
+ self._password = encode_password(password)
97
+ self._address: str | None = None
98
+ self._transport: asyncio.DatagramTransport | None = None
99
+ self._protocol: _VentsDatagramProtocol | None = None
100
+ self._lock = asyncio.Lock()
101
+ self._consecutive_failures = 0
102
+
103
+ @property
104
+ def device_id(self) -> str:
105
+ return self._device_id
106
+
107
+ async def _resolve_host(self) -> str:
108
+ try:
109
+ async with asyncio.timeout(self._timeout * 2):
110
+ addresses = await asyncio.get_running_loop().getaddrinfo(
111
+ self._host,
112
+ self._port,
113
+ family=socket.AF_INET,
114
+ type=socket.SOCK_DGRAM,
115
+ )
116
+ return str(addresses[0][4][0])
117
+ except TimeoutError as exc:
118
+ raise VentsConnectionError("Timed out resolving device address") from exc
119
+ except (OSError, IndexError) as exc:
120
+ raise VentsConnectionError(f"Cannot resolve device address: {exc}") from exc
121
+
122
+ async def _endpoint(
123
+ self,
124
+ ) -> tuple[asyncio.DatagramTransport, _VentsDatagramProtocol]:
125
+ if (
126
+ self._transport is None
127
+ or self._transport.is_closing()
128
+ or self._protocol is None
129
+ or self._protocol.lost
130
+ ):
131
+ self._close_endpoint()
132
+ (
133
+ self._transport,
134
+ self._protocol,
135
+ ) = await asyncio.get_running_loop().create_datagram_endpoint(
136
+ _VentsDatagramProtocol,
137
+ local_addr=("0.0.0.0", 0),
138
+ family=socket.AF_INET,
139
+ )
140
+ return self._transport, self._protocol
141
+
142
+ def _close_endpoint(self) -> None:
143
+ if self._transport is not None:
144
+ self._transport.close()
145
+ self._transport = None
146
+ self._protocol = None
147
+
148
+ async def _record_failure(self) -> None:
149
+ self._consecutive_failures += 1
150
+ if self._consecutive_failures >= _DNS_REFRESH_FAILURES:
151
+ self._consecutive_failures = 0
152
+ try:
153
+ self._address = await self._resolve_host()
154
+ except VentsConnectionError as exc:
155
+ _LOGGER.warning("Cannot refresh device address: %s", exc)
156
+
157
+ async def _send(self, function: bytes, body: bytes) -> _VentsDatagramProtocol:
158
+ if self._address is None:
159
+ self._address = await self._resolve_host()
160
+ transport, protocol = await self._endpoint()
161
+ protocol.drain()
162
+ frame = build_frame(self._device_bytes, self._password, function, body)
163
+ transport.sendto(frame, (self._address, self._port))
164
+ return protocol
165
+
166
+ async def _request(
167
+ self, function: bytes, body: bytes, expected: set[RegisterKey]
168
+ ) -> Reply:
169
+ discarded = 0
170
+ try:
171
+ protocol = await self._send(function, body)
172
+ loop = asyncio.get_running_loop()
173
+ deadline = loop.time() + self._timeout
174
+ try:
175
+ async with asyncio.timeout_at(deadline):
176
+ while loop.time() < deadline:
177
+ data, sender = await protocol.receive()
178
+ if sender[0] == self._address:
179
+ try:
180
+ values = decode_reply(
181
+ extract_inner(data), self._device_bytes
182
+ )
183
+ except VentsError as exc:
184
+ _LOGGER.debug("Discarding invalid response: %s", exc)
185
+ else:
186
+ if values.keys() == expected:
187
+ self._consecutive_failures = 0
188
+ return values
189
+ discarded += 1
190
+ except TimeoutError:
191
+ pass
192
+ except OSError as exc:
193
+ self._close_endpoint()
194
+ await self._record_failure()
195
+ raise VentsConnectionError(f"Device request failed: {exc}") from exc
196
+ except asyncio.CancelledError:
197
+ self._close_endpoint()
198
+ raise
199
+
200
+ # A late reply to the old socket has no request ID to distinguish it.
201
+ self._close_endpoint()
202
+ await self._record_failure()
203
+ _LOGGER.debug(
204
+ "Timed out waiting for a matching response; discarded %d datagrams"
205
+ " and received %d transport errors",
206
+ discarded,
207
+ protocol.errors,
208
+ )
209
+ raise _ReplyTimeout("Timed out waiting for a matching response")
210
+
211
+ async def _read_locked(
212
+ self, regs: Sequence[Register]
213
+ ) -> dict[str, RegisterValue | None]:
214
+ if not regs:
215
+ return {}
216
+ for reg in regs:
217
+ if reg.get("write_only"):
218
+ raise VentsValueError(f"Register '{register_name(reg)}' is write-only")
219
+
220
+ body, expected = build_body([reg["parameter"] for reg in regs])
221
+ values = await self._request(PARAMETER_READ, body, expected)
222
+ out: dict[str, RegisterValue | None] = {}
223
+ for reg in regs:
224
+ page, parameter = reg["parameter"]
225
+ raw = values[page, parameter]
226
+ name = register_name(reg)
227
+ out[name] = None
228
+ if raw is not None:
229
+ try:
230
+ out[name] = format_value(reg, raw)
231
+ except VentsError as exc:
232
+ _LOGGER.warning("Ignoring invalid register value: %s", exc)
233
+ return out
234
+
235
+ async def async_read_registers(
236
+ self, regs: Sequence[Register]
237
+ ) -> dict[str, RegisterValue | None]:
238
+ """Read a complete register batch; unsupported registers have value None."""
239
+ async with self._lock:
240
+ return await self._read_locked(regs)
241
+
242
+ async def async_read_register(self, reg: Register) -> RegisterValue | None:
243
+ return (await self.async_read_registers([reg]))[register_name(reg)]
244
+
245
+ async def async_write_register(
246
+ self, reg: Register, value: RegisterValue
247
+ ) -> RegisterValue:
248
+ """Write a compact value and return the device's confirmed value."""
249
+ encoded = encode_write(reg, value)
250
+ body, expected = build_body([reg["parameter"]], encoded)
251
+ async with self._lock:
252
+ try:
253
+ values = await self._request(
254
+ PARAMETER_WRITE_WITH_RESPONSE, body, expected
255
+ )
256
+ except _ReplyTimeout:
257
+ echo = None
258
+ else:
259
+ page, parameter = reg["parameter"]
260
+ echo = values[page, parameter]
261
+ if echo == bytes([encoded]):
262
+ return format_value(reg, echo)
263
+
264
+ name = register_name(reg)
265
+ _LOGGER.warning("Unconfirmed write echo for %s; reading back", name)
266
+ self._close_endpoint()
267
+ confirmed = (await self._read_locked([reg]))[name]
268
+ if confirmed is None:
269
+ raise VentsError(f"Cannot confirm write for register '{name}'")
270
+ return confirmed
271
+
272
+ async def _trigger_locked(self, reg: Register) -> None:
273
+ try:
274
+ await self._send(PARAMETER_WRITE, trigger_body(reg))
275
+ except OSError as exc:
276
+ self._close_endpoint()
277
+ await self._record_failure()
278
+ raise VentsConnectionError(f"Device trigger failed: {exc}") from exc
279
+
280
+ async def async_trigger(self, reg: Register) -> None:
281
+ """Send a write-only trigger without waiting for a reply."""
282
+ async with self._lock:
283
+ await self._trigger_locked(reg)
284
+
285
+ async def async_reset_filter(self) -> None:
286
+ """Restart the filter countdown and clear the associated alarm."""
287
+ async with self._lock:
288
+ await self._trigger_locked(FILTER_TIMER_RESET)
289
+ await self._trigger_locked(RESET_ALARMS)
290
+
291
+ async def async_get_status(self) -> VentsStatus:
292
+ return VentsStatus.from_values(
293
+ await self.async_read_registers(STATUS_REGISTERS)
294
+ )
295
+
296
+ async def async_get_settings(self) -> VentsSettings:
297
+ return VentsSettings.from_values(
298
+ await self.async_read_registers(SETTINGS_REGISTERS)
299
+ )
300
+
301
+ async def async_close(self) -> None:
302
+ """Release the socket and cached address."""
303
+ async with self._lock:
304
+ self._close_endpoint()
305
+ self._address = None
306
+ self._consecutive_failures = 0
307
+
308
+ async def __aenter__(self) -> Self:
309
+ return self
310
+
311
+ async def __aexit__(
312
+ self,
313
+ exc_type: type[BaseException] | None,
314
+ exc: BaseException | None,
315
+ traceback: TracebackType | None,
316
+ ) -> None:
317
+ await self.async_close()