easywave-home-control 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 (22) hide show
  1. easywave_home_control-0.1.0/LICENSE +173 -0
  2. easywave_home_control-0.1.0/MANIFEST.in +4 -0
  3. easywave_home_control-0.1.0/PKG-INFO +281 -0
  4. easywave_home_control-0.1.0/README.md +244 -0
  5. easywave_home_control-0.1.0/easywave_home_control/__init__.py +82 -0
  6. easywave_home_control-0.1.0/easywave_home_control/async_registry.py +176 -0
  7. easywave_home_control-0.1.0/easywave_home_control/protocols/__init__.py +22 -0
  8. easywave_home_control-0.1.0/easywave_home_control/protocols/base.py +96 -0
  9. easywave_home_control-0.1.0/easywave_home_control/protocols/rx09/__init__.py +23 -0
  10. easywave_home_control-0.1.0/easywave_home_control/protocols/rx09/devices.py +91 -0
  11. easywave_home_control-0.1.0/easywave_home_control/protocols/rx09/protocol.py +665 -0
  12. easywave_home_control-0.1.0/easywave_home_control/protocols/rx11_rx2x/__init__.py +21 -0
  13. easywave_home_control-0.1.0/easywave_home_control/protocols/rx11_rx2x/devices.py +149 -0
  14. easywave_home_control-0.1.0/easywave_home_control/protocols/rx11_rx2x/protocol.py +2160 -0
  15. easywave_home_control-0.1.0/easywave_home_control/registry.py +170 -0
  16. easywave_home_control-0.1.0/easywave_home_control.egg-info/PKG-INFO +281 -0
  17. easywave_home_control-0.1.0/easywave_home_control.egg-info/SOURCES.txt +20 -0
  18. easywave_home_control-0.1.0/easywave_home_control.egg-info/dependency_links.txt +1 -0
  19. easywave_home_control-0.1.0/easywave_home_control.egg-info/requires.txt +10 -0
  20. easywave_home_control-0.1.0/easywave_home_control.egg-info/top_level.txt +1 -0
  21. easywave_home_control-0.1.0/pyproject.toml +81 -0
  22. easywave_home_control-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,173 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined in Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
25
+ permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or Object
37
+ form, made available under the License, as indicated by a copyright
38
+ notice that is included in or attached to the work (an example is
39
+ provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original Work and any Derivative Works thereof, that is intentionally
51
+ submitted to, or incorporated into, by Licensor for inclusion in the Work.
52
+ For the purposes of this definition, "submitted" means any form of
53
+ electronic, verbal, or written communication sent to the Licensor or its
54
+ representatives, including but not limited to communication on electronic
55
+ mailing lists, source code control systems, and issue tracking systems
56
+ that are managed by, or on behalf of, the Licensor for the purpose of
57
+ discussing and improving the Work.
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution was submitted. If You
79
+ institute patent litigation against any entity (including a
80
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
81
+ or a Contribution incorporated within the Work constitutes direct
82
+ or contributory patent infringement, then any patent licenses
83
+ granted to You under this License for that Work shall terminate
84
+ as of the date such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or
92
+ Derivative Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file, then any
104
+ Derivative Works that You distribute must include a readable
105
+ copy of the attribution notices contained
106
+ within such NOTICE file, excluding those notices that do not
107
+ pertain to any part of the Derivative Works, in at least one
108
+ of the following places: within a NOTICE text file distributed
109
+ as part of the Derivative Works; within the Source form or
110
+ documentation, if provided along with the Derivative Works; or,
111
+ within a display generated by the Derivative Works, if and
112
+ wherever such third-party notices normally appear. The contents
113
+ of the NOTICE file are for informational purposes only and
114
+ do not modify the License. You may add Your own attribution
115
+ notices within Derivative Works that You distribute, alongside
116
+ or as an addendum to the NOTICE from the Work, provided that
117
+ such additional attribution notices cannot be construed
118
+ as modifying the License.
119
+
120
+ You may add Your own copyright statement to Your modifications and
121
+ may provide additional or different license terms and conditions
122
+ for use, reproduction, or distribution of Your modifications, or
123
+ for any such Derivative Works as a whole, provided Your use,
124
+ reproduction, and distribution of the Work otherwise complies with
125
+ the conditions of this License.
126
+
127
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
128
+ any Contribution intentionally submitted for inclusion in the Work
129
+ by You to Licensor shall be under the terms and conditions of
130
+ this License, without any additional terms or conditions.
131
+ Notwithstanding the above, nothing herein shall supersede or modify
132
+ the terms of any separate license agreement you may have executed
133
+ with Licensor regarding such Contribution.
134
+
135
+ 6. Trademarks. This License does not grant permission to use the trade
136
+ names, trademarks, service marks, or product names of the Licensor,
137
+ except as required for reasonable and customary use in describing the
138
+ origin of the Work and reproducing the content of the NOTICE file.
139
+
140
+ 7. Disclaimer of Warranty. Unless required by applicable law or
141
+ agreed to in writing, Licensor provides the Work (and each
142
+ Contributor provides its Contributions) on an "AS IS" BASIS,
143
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
144
+ or implied, including, without limitation, any warranties or
145
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
146
+ FOR A PARTICULAR PURPOSE. You are solely responsible for determining
147
+ the appropriateness of using or redistributing the Work and assume
148
+ any risks associated with Your exercise of permissions under this License.
149
+
150
+ 8. Limitation of Liability. In no event and under no legal theory,
151
+ whether in tort (including negligence), contract, or otherwise,
152
+ unless required by applicable law (such as deliberate and grossly
153
+ negligent acts) or agreed to in writing, shall any Contributor be
154
+ liable to You for damages, including any direct, indirect, special,
155
+ incidental, or consequential damages of any character arising as a
156
+ result of this License or out of the use or inability to use the
157
+ Work (including but not limited to damages for loss of goodwill,
158
+ work stoppage, computer failure or malfunction, or any and all
159
+ other commercial damages or losses), even if such Contributor
160
+ has been advised of the possibility of such damages.
161
+
162
+ 9. Accepting Warranty or Additional Liability. While redistributing
163
+ the Work or Derivative Works thereof, You may choose to offer,
164
+ and charge a fee for, acceptance of support, warranty, indemnity,
165
+ or other liability obligations and/or rights consistent with this
166
+ License. However, in accepting such obligations, You may act only
167
+ on Your own behalf and on Your sole responsibility, not on behalf
168
+ of any other Contributor, and only if You agree to indemnify,
169
+ defend, and hold each Contributor harmless for any liability
170
+ incurred by, or claims asserted against, such Contributor by reason
171
+ of your accepting any such warranty or additional liability.
172
+
173
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include easywave_home_control *.py
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: easywave-home-control
3
+ Version: 0.1.0
4
+ Summary: Pure Python async/await implementation for controlling EASYWAVE radio modules (RX11, RX21, RX22, RX25, RX09)
5
+ Author-email: ELDAT EaS GmbH <info@eldat.de>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/eldateas/PyPI-EasywaveHomeControl
8
+ Project-URL: Documentation, https://github.com/eldateas/PyPI-EasywaveHomeControl/blob/main/README.md
9
+ Project-URL: Issues, https://github.com/eldateas/PyPI-EasywaveHomeControl/issues
10
+ Keywords: easywave,rx11,rx09,transceiver,usb,serial
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Communications
23
+ Classifier: Topic :: Home Automation
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: pyserial>=3.5
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.0.275; extra == "dev"
32
+ Requires-Dist: mypy>=1.0; extra == "dev"
33
+ Requires-Dist: tox>=4.0; extra == "dev"
34
+ Requires-Dist: build>=0.10; extra == "dev"
35
+ Requires-Dist: twine>=4.0; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # EASYWAVE Home Control
39
+
40
+ Pure Python async/await implementation for controlling EASYWAVE radio modules (RX11, RX21, RX22, RX25, RX09).
41
+
42
+ Optimized for **Home Assistant integration** with 100% non-blocking async API.
43
+
44
+ ## Features
45
+
46
+ - **Pure Async/Await** - No blocking calls on event loop, optimized for Home Assistant
47
+ - **Multi-Family Support** - Binary protocol (RX11/21/22/25) + ASCII protocol (RX09)
48
+ - **High Performance** - 115200 baud communication, request pipelining
49
+ - **Robust** - Comprehensive error handling, health checks, timeout management
50
+ - **Clean API** - Unified `.create()` factory method for all devices
51
+ - **Type Hints** - Full Pylance strict-mode compliant type annotations
52
+ - **Well-Tested** - Comprehensive examples and integration patterns
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install easywave-home-control
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ### Creating Devices
63
+
64
+ All devices use the unified `.create()` factory method:
65
+
66
+ ```python
67
+ import asyncio
68
+ from easywave_home_control import RX11Device, RX09Device
69
+
70
+ async def main():
71
+ # Create and automatically connect to device
72
+ device = await RX11Device.create(
73
+ port="/dev/ttyUSB0",
74
+ timeout=5.0
75
+ )
76
+
77
+ try:
78
+ # Device is now connected and ready to use
79
+ info = await device.get_device_info()
80
+ print(f"Device: {info}")
81
+
82
+ # Check connectivity
83
+ connected = await device.ping_request(timeout=3.0)
84
+ print(f"Connected: {connected}")
85
+
86
+ # Use device-specific methods
87
+ result, hw_version = await device.query_hw_version()
88
+ if result == RX11Device.ErrorCode.SUCCESS:
89
+ print(f"Hardware Version: {hw_version}")
90
+ finally:
91
+ # Always disconnect when done
92
+ await device.disconnect()
93
+
94
+ asyncio.run(main())
95
+ ```
96
+
97
+ ## Device Support
98
+
99
+ ### RxModule Family (Binary Protocol, 115200 baud)
100
+
101
+ | Device | Type | Functions | Features | Baudrate |
102
+ |--------|------|-----------|----------|----------|
103
+ | **RX11** | USB Transceiver | 25 | EW, Bidi, Secwave | 115200 |
104
+ | **RX21** | Serial Module | 25 | EW, Bidi, Secwave | 115200 |
105
+ | **RX22** | Serial Module | 25 | EW, Bidi, Secwave | 115200 |
106
+ | **RX25** | Serial Module | 25 | EW, Bidi, Secwave | 115200 |
107
+
108
+ ### RX09 Family (ASCII Protocol, 57600 baud)
109
+
110
+ | Device | Type | Functions | Features | Baudrate |
111
+ |--------|------|-----------|----------|----------|
112
+ | **RX09** | Basic Receiver | 11 | EW Basic only | 57600 |
113
+
114
+ ## Async API Documentation
115
+
116
+ ### Device Classes
117
+
118
+ #### RxModule Devices (Binary Protocol, 115200 baud)
119
+
120
+ ```python
121
+ from easywave_home_control import RX11Device, RX21Device, RX22Device, RX25Device
122
+
123
+ # All RxModule devices use the same interface
124
+ device = await RX11Device.create(port="/dev/ttyUSB0")
125
+
126
+ # RxModule-specific methods
127
+ result, hw_version = await device.query_hw_version()
128
+ result, fw_version = await device.query_fw_version()
129
+
130
+ # Easywave Basic (EW) functions
131
+ result, info_type, transmitter, info_data = await device.ew_rcv_button_request(timeout=30.0)
132
+ await device.ew_send_cmd_request(gateway=gateway_serial, button=0)
133
+
134
+ # Easywave Bidi (EWB) functions
135
+ result, receiver = await device.ewb_join_device_request(transmitter_serial)
136
+
137
+ # Check error codes
138
+ if result == RX11Device.ErrorCode.SUCCESS:
139
+ print(f"Success: {info_type}")
140
+ else:
141
+ print(f"Error: {result}")
142
+ ```
143
+
144
+ #### RX09 Device (ASCII Protocol, 57600 baud)
145
+
146
+ ```python
147
+ from easywave_home_control import RX09Device
148
+
149
+ device = await RX09Device.create(port="/dev/ttyUSB0")
150
+
151
+ # RX09-specific methods
152
+ result, serial_number, button_code = await device.receive_telegramm(timeout=30.0)
153
+ result, position_count = await device.query_positions()
154
+ result = await device.send_telegramm(position=0, button_code="A")
155
+
156
+ # Check error codes
157
+ if result == RX09Device.ErrorCode.SUCCESS:
158
+ print("Success")
159
+ ```
160
+
161
+ #### Common Methods (All Devices)
162
+
163
+ ```python
164
+ # Connection management
165
+ # Note: .connect() is called automatically by .create() — only needed for direct instantiation
166
+ await device.connect() -> bool
167
+ await device.disconnect() -> None
168
+
169
+ # Device info
170
+ await device.get_device_info() -> dict[str, Any]
171
+ await device.ping_request(timeout=5.0) -> bool
172
+
173
+ # Properties (common)
174
+ device.is_connected -> bool
175
+ ```
176
+
177
+ #### RxModule-Only Properties (RX11 / RX21 / RX22 / RX25)
178
+
179
+ ```python
180
+ # Detailed status — one of: "connected", "disconnected", "reconnecting", "error", "hardware_error"
181
+ device.connection_status -> str
182
+ device.has_hardware_error -> bool # True after USB disconnect or I/O error
183
+ device.state_good -> bool # False if protocol errors have occurred
184
+ device.last_error -> str | None # Last error message, if any
185
+ ```
186
+
187
+ ### Error Codes
188
+
189
+ Each device family has device-specific error code enums:
190
+
191
+ ```python
192
+ # RxModule devices (RX11, RX21, RX22, RX25)
193
+ from easywave_home_control import RX11Device
194
+
195
+ if result == RX11Device.ErrorCode.SUCCESS:
196
+ print("Command successful")
197
+ elif result == RX11Device.ErrorCode.ERR_RF_TIMEOUT:
198
+ print("RF communication timeout")
199
+ elif result == RX11Device.ErrorCode.ERR_FAILSTATE:
200
+ print("Device in failure state")
201
+
202
+ # RX09 device
203
+ from easywave_home_control import RX09Device
204
+
205
+ if result == RX09Device.ErrorCode.SUCCESS:
206
+ print("Command successful")
207
+ ```
208
+
209
+ ### Callbacks
210
+
211
+ Register callbacks to respond to device events:
212
+
213
+ ```python
214
+ def on_disconnect():
215
+ print("Device disconnected or hardware error occurred")
216
+
217
+ device.set_disconnect_callback(on_disconnect)
218
+
219
+ # Register callback for spontaneous RCV messages (RX09 only)
220
+ def on_button_pressed(data: dict[str, Any]):
221
+ serial = data["serial_number"]
222
+ button = data["button_code"]
223
+ print(f"Button {button} pressed on {serial:06X}")
224
+
225
+ device.register_rcv_callback(on_button_pressed)
226
+ ```
227
+
228
+ ## Examples
229
+
230
+ See the [examples/](examples/) directory for complete working examples:
231
+
232
+ - **[ew_send_receive_example.py](examples/ew_send_receive_example.py)** - Discover gateways, send commands, receive button presses (RX11 & RX09)
233
+ - **[ewb_pairing_example.py](examples/ewb_pairing_example.py)** - Easywave Bidi device pairing workflow
234
+ - **[ha_integration_full_example.py](examples/ha_integration_full_example.py)** - Home Assistant integration pattern with background listening
235
+
236
+ ## Protocol Details
237
+
238
+ ### RxModule Protocol (RX11/21/22/25)
239
+
240
+ Binary request/response protocol at 115200 baud with:
241
+ - Packet structure: `[SOP(0x81)] [Function+Params] [EOP(0x82)]`
242
+ - Byte stuffing for bytes in range 0x80-0x82
243
+ - Request/response IRP/ICP pairs with handles
244
+ - Timeout support (default 5.0s, RCV functions support indefinite waiting)
245
+
246
+ ### RX09 Protocol (RX09)
247
+
248
+ ASCII text-based protocol at 57600 baud with:
249
+ - Comma-separated commands (e.g., `CMD,PARAM1,PARAM2`)
250
+ - CR (0x0D) line terminator
251
+ - Simple request/response matching
252
+ - Limited function set (Easywave Basic only)
253
+
254
+ ## Type Hints & Validation
255
+
256
+ The library is fully typed and passes Pylance strict-mode validation:
257
+ ```bash
258
+ pylance --mode=strict
259
+ ```
260
+
261
+ All generic types are explicitly specified (no `Unknown` types):
262
+ - `dict[str, Any]` instead of `dict`
263
+ - `list[bytes]` instead of `list`
264
+ - `asyncio.Task[None]` instead of `asyncio.Task`
265
+
266
+ ## Requirements
267
+
268
+ - Python 3.9+
269
+ - pyserial >= 3.5
270
+
271
+ ## License
272
+
273
+ Apache License 2.0 - See [LICENSE](LICENSE) for details.
274
+
275
+ ## Contributing
276
+
277
+ Contributions are welcome! Please submit issues and pull requests to the [Home Assistant repository](https://github.com/home-assistant/core).
278
+
279
+ ## Support
280
+
281
+ For support, please refer to the [Home Assistant Easywave Integration](https://www.home-assistant.io/integrations/easywave) documentation.
@@ -0,0 +1,244 @@
1
+ # EASYWAVE Home Control
2
+
3
+ Pure Python async/await implementation for controlling EASYWAVE radio modules (RX11, RX21, RX22, RX25, RX09).
4
+
5
+ Optimized for **Home Assistant integration** with 100% non-blocking async API.
6
+
7
+ ## Features
8
+
9
+ - **Pure Async/Await** - No blocking calls on event loop, optimized for Home Assistant
10
+ - **Multi-Family Support** - Binary protocol (RX11/21/22/25) + ASCII protocol (RX09)
11
+ - **High Performance** - 115200 baud communication, request pipelining
12
+ - **Robust** - Comprehensive error handling, health checks, timeout management
13
+ - **Clean API** - Unified `.create()` factory method for all devices
14
+ - **Type Hints** - Full Pylance strict-mode compliant type annotations
15
+ - **Well-Tested** - Comprehensive examples and integration patterns
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install easywave-home-control
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ### Creating Devices
26
+
27
+ All devices use the unified `.create()` factory method:
28
+
29
+ ```python
30
+ import asyncio
31
+ from easywave_home_control import RX11Device, RX09Device
32
+
33
+ async def main():
34
+ # Create and automatically connect to device
35
+ device = await RX11Device.create(
36
+ port="/dev/ttyUSB0",
37
+ timeout=5.0
38
+ )
39
+
40
+ try:
41
+ # Device is now connected and ready to use
42
+ info = await device.get_device_info()
43
+ print(f"Device: {info}")
44
+
45
+ # Check connectivity
46
+ connected = await device.ping_request(timeout=3.0)
47
+ print(f"Connected: {connected}")
48
+
49
+ # Use device-specific methods
50
+ result, hw_version = await device.query_hw_version()
51
+ if result == RX11Device.ErrorCode.SUCCESS:
52
+ print(f"Hardware Version: {hw_version}")
53
+ finally:
54
+ # Always disconnect when done
55
+ await device.disconnect()
56
+
57
+ asyncio.run(main())
58
+ ```
59
+
60
+ ## Device Support
61
+
62
+ ### RxModule Family (Binary Protocol, 115200 baud)
63
+
64
+ | Device | Type | Functions | Features | Baudrate |
65
+ |--------|------|-----------|----------|----------|
66
+ | **RX11** | USB Transceiver | 25 | EW, Bidi, Secwave | 115200 |
67
+ | **RX21** | Serial Module | 25 | EW, Bidi, Secwave | 115200 |
68
+ | **RX22** | Serial Module | 25 | EW, Bidi, Secwave | 115200 |
69
+ | **RX25** | Serial Module | 25 | EW, Bidi, Secwave | 115200 |
70
+
71
+ ### RX09 Family (ASCII Protocol, 57600 baud)
72
+
73
+ | Device | Type | Functions | Features | Baudrate |
74
+ |--------|------|-----------|----------|----------|
75
+ | **RX09** | Basic Receiver | 11 | EW Basic only | 57600 |
76
+
77
+ ## Async API Documentation
78
+
79
+ ### Device Classes
80
+
81
+ #### RxModule Devices (Binary Protocol, 115200 baud)
82
+
83
+ ```python
84
+ from easywave_home_control import RX11Device, RX21Device, RX22Device, RX25Device
85
+
86
+ # All RxModule devices use the same interface
87
+ device = await RX11Device.create(port="/dev/ttyUSB0")
88
+
89
+ # RxModule-specific methods
90
+ result, hw_version = await device.query_hw_version()
91
+ result, fw_version = await device.query_fw_version()
92
+
93
+ # Easywave Basic (EW) functions
94
+ result, info_type, transmitter, info_data = await device.ew_rcv_button_request(timeout=30.0)
95
+ await device.ew_send_cmd_request(gateway=gateway_serial, button=0)
96
+
97
+ # Easywave Bidi (EWB) functions
98
+ result, receiver = await device.ewb_join_device_request(transmitter_serial)
99
+
100
+ # Check error codes
101
+ if result == RX11Device.ErrorCode.SUCCESS:
102
+ print(f"Success: {info_type}")
103
+ else:
104
+ print(f"Error: {result}")
105
+ ```
106
+
107
+ #### RX09 Device (ASCII Protocol, 57600 baud)
108
+
109
+ ```python
110
+ from easywave_home_control import RX09Device
111
+
112
+ device = await RX09Device.create(port="/dev/ttyUSB0")
113
+
114
+ # RX09-specific methods
115
+ result, serial_number, button_code = await device.receive_telegramm(timeout=30.0)
116
+ result, position_count = await device.query_positions()
117
+ result = await device.send_telegramm(position=0, button_code="A")
118
+
119
+ # Check error codes
120
+ if result == RX09Device.ErrorCode.SUCCESS:
121
+ print("Success")
122
+ ```
123
+
124
+ #### Common Methods (All Devices)
125
+
126
+ ```python
127
+ # Connection management
128
+ # Note: .connect() is called automatically by .create() — only needed for direct instantiation
129
+ await device.connect() -> bool
130
+ await device.disconnect() -> None
131
+
132
+ # Device info
133
+ await device.get_device_info() -> dict[str, Any]
134
+ await device.ping_request(timeout=5.0) -> bool
135
+
136
+ # Properties (common)
137
+ device.is_connected -> bool
138
+ ```
139
+
140
+ #### RxModule-Only Properties (RX11 / RX21 / RX22 / RX25)
141
+
142
+ ```python
143
+ # Detailed status — one of: "connected", "disconnected", "reconnecting", "error", "hardware_error"
144
+ device.connection_status -> str
145
+ device.has_hardware_error -> bool # True after USB disconnect or I/O error
146
+ device.state_good -> bool # False if protocol errors have occurred
147
+ device.last_error -> str | None # Last error message, if any
148
+ ```
149
+
150
+ ### Error Codes
151
+
152
+ Each device family has device-specific error code enums:
153
+
154
+ ```python
155
+ # RxModule devices (RX11, RX21, RX22, RX25)
156
+ from easywave_home_control import RX11Device
157
+
158
+ if result == RX11Device.ErrorCode.SUCCESS:
159
+ print("Command successful")
160
+ elif result == RX11Device.ErrorCode.ERR_RF_TIMEOUT:
161
+ print("RF communication timeout")
162
+ elif result == RX11Device.ErrorCode.ERR_FAILSTATE:
163
+ print("Device in failure state")
164
+
165
+ # RX09 device
166
+ from easywave_home_control import RX09Device
167
+
168
+ if result == RX09Device.ErrorCode.SUCCESS:
169
+ print("Command successful")
170
+ ```
171
+
172
+ ### Callbacks
173
+
174
+ Register callbacks to respond to device events:
175
+
176
+ ```python
177
+ def on_disconnect():
178
+ print("Device disconnected or hardware error occurred")
179
+
180
+ device.set_disconnect_callback(on_disconnect)
181
+
182
+ # Register callback for spontaneous RCV messages (RX09 only)
183
+ def on_button_pressed(data: dict[str, Any]):
184
+ serial = data["serial_number"]
185
+ button = data["button_code"]
186
+ print(f"Button {button} pressed on {serial:06X}")
187
+
188
+ device.register_rcv_callback(on_button_pressed)
189
+ ```
190
+
191
+ ## Examples
192
+
193
+ See the [examples/](examples/) directory for complete working examples:
194
+
195
+ - **[ew_send_receive_example.py](examples/ew_send_receive_example.py)** - Discover gateways, send commands, receive button presses (RX11 & RX09)
196
+ - **[ewb_pairing_example.py](examples/ewb_pairing_example.py)** - Easywave Bidi device pairing workflow
197
+ - **[ha_integration_full_example.py](examples/ha_integration_full_example.py)** - Home Assistant integration pattern with background listening
198
+
199
+ ## Protocol Details
200
+
201
+ ### RxModule Protocol (RX11/21/22/25)
202
+
203
+ Binary request/response protocol at 115200 baud with:
204
+ - Packet structure: `[SOP(0x81)] [Function+Params] [EOP(0x82)]`
205
+ - Byte stuffing for bytes in range 0x80-0x82
206
+ - Request/response IRP/ICP pairs with handles
207
+ - Timeout support (default 5.0s, RCV functions support indefinite waiting)
208
+
209
+ ### RX09 Protocol (RX09)
210
+
211
+ ASCII text-based protocol at 57600 baud with:
212
+ - Comma-separated commands (e.g., `CMD,PARAM1,PARAM2`)
213
+ - CR (0x0D) line terminator
214
+ - Simple request/response matching
215
+ - Limited function set (Easywave Basic only)
216
+
217
+ ## Type Hints & Validation
218
+
219
+ The library is fully typed and passes Pylance strict-mode validation:
220
+ ```bash
221
+ pylance --mode=strict
222
+ ```
223
+
224
+ All generic types are explicitly specified (no `Unknown` types):
225
+ - `dict[str, Any]` instead of `dict`
226
+ - `list[bytes]` instead of `list`
227
+ - `asyncio.Task[None]` instead of `asyncio.Task`
228
+
229
+ ## Requirements
230
+
231
+ - Python 3.9+
232
+ - pyserial >= 3.5
233
+
234
+ ## License
235
+
236
+ Apache License 2.0 - See [LICENSE](LICENSE) for details.
237
+
238
+ ## Contributing
239
+
240
+ Contributions are welcome! Please submit issues and pull requests to the [Home Assistant repository](https://github.com/home-assistant/core).
241
+
242
+ ## Support
243
+
244
+ For support, please refer to the [Home Assistant Easywave Integration](https://www.home-assistant.io/integrations/easywave) documentation.