aiopapouch 0.0.1__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,30 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build-and-publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ permissions:
12
+ id-token: write
13
+ contents: read
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - name: Install build tool
24
+ run: python -m pip install --upgrade pip build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Publish package to PyPI
30
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Levad
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,108 @@
1
+ Metadata-Version: 2.5
2
+ Name: aiopapouch
3
+ Version: 0.0.1
4
+ Summary: API client and device models for Papouch's devices
5
+ Project-URL: Source, https://github.com/VladislavLevitskii/aiopapouch
6
+ Author-email: VladislavLevitskii <vladlevitskii@gmail.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.12
10
+ Requires-Dist: aiohttp>=3.0.0
11
+ Requires-Dist: defusedxml>=0.7.1
12
+ Description-Content-Type: text/markdown
13
+
14
+ # aiopapouch
15
+
16
+ This repository contains an asynchronous Python I/O library for Papouch s.r.o. devices.
17
+
18
+ The library provides two major components: **Devices** and **API Client** for communication with the hardware.
19
+
20
+ ## Requirements
21
+
22
+ * **Python 3.14+**: The library requires Python 3.14 or higher (PEP 758).
23
+ * **aiohttp**: Required for handling asynchronous HTTP communication with the devices.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install aiopapouch
29
+
30
+ ```
31
+
32
+ ## Supported Devices
33
+
34
+ Currently, the library supports the following Ethernet devices communicating via WEB mode:
35
+
36
+ * Quido ETH
37
+ * Papago
38
+ * Meteo
39
+ * 2TH
40
+ * 5HDI DO
41
+ * TH 2DI DO
42
+ * TH2E
43
+ * TME
44
+ * TME Multi / Radio
45
+
46
+ ## Devices
47
+
48
+ The library is designed using an object-oriented approach. Every device (or device family) is a subclass of `PapouchDevice`, which provides contract methods such as `parse_fresh_data`, `get_supported_sensors`, and properties like `name` and `location`. The `base.py` file also includes mixins (primarily for HTTP communication), as various network devices share the same functions. Creating an additional layer between `PapouchDevice` and the final subclasses is unnecessary since only a specific subset of functions needs to be included.
49
+
50
+ Due to polymorphism, the `create_device` function returns an abstract `PapouchDevice`. It works in tandem with the `is_device_supported` function, which validates whether the hardware is supported by this library.
51
+
52
+ > ***Note:*** The constructors are asynchronous (implementing the factory pattern). Creating any device instance utilizes the network to download the initial configuration.
53
+
54
+ > ***Note:*** The library was designed specifically for Home Assistant. Methods like `get_supported_sensors` return configurations required for entity creation in Home Assistant. This remains the primary purpose of the library.
55
+
56
+ > ***Note:*** Initial fresh fetch of data happens before the creation of the entities, making it a valid approach to generate configurations during the parsing of fresh data.
57
+
58
+ ## API Client
59
+
60
+ The API Client follows a similar architecture. There is an abstract base class `PapouchTransport` that defines the contract methods for subclasses, such as `fetch_info`, `read_command`, and `write_command`.
61
+
62
+ Currently, there is one subclass, `PapouchHTTPClient`, which fulfills this contract and handles network communication over HTTP.
63
+
64
+ ## Exceptions
65
+
66
+ The library defines custom exceptions raised during execution. These exceptions are designed to be caught and handled within the Home Assistant integration.
67
+
68
+ ## Usage
69
+
70
+ Although `aiopapouch` is primarily designed to serve as the underlying library for the official Home Assistant Papouch integration, it can also be used independently in standalone Python scripts.
71
+
72
+ The following example illustrates how to create a client, instantiate a device, fetch raw telemetry data, and pass it to `parse_fresh_data`:
73
+
74
+ ```python
75
+ import asyncio
76
+ import aiohttp
77
+ from aiopapouch import PapouchHTTPClient, create_device
78
+
79
+ async def main():
80
+ # Initialize the aiohttp client session
81
+ async with aiohttp.ClientSession() as session:
82
+ # Initialize the API transport client
83
+ client = PapouchHTTPClient("192.168.1.100", session)
84
+
85
+ # Create the device
86
+ device = await create_device(client)
87
+
88
+ if device is None:
89
+ print("Device not supported or connection failed.")
90
+ return
91
+
92
+ print(f"Connected to: {device.name} at {device.location}")
93
+
94
+ # Fetch raw fresh XML data from the device
95
+ raw_fresh_xml = await client.fetch_data()
96
+
97
+ # Parse fresh data to update device state and return processed readings
98
+ parsed_data = await device.parse_fresh_data(raw_fresh_xml)
99
+ print("Parsed telemetry data:", parsed_data)
100
+
101
+ if __name__ == "__main__":
102
+ asyncio.run(main())
103
+
104
+ ```
105
+
106
+ ## Future Extensions
107
+
108
+ Papouch manufactures not only network-based devices but also serial ones (e.g., using RS485). Future extensions will include a new serial transport subclass implementing `PapouchTransport`, alongside new `PapouchDevice` subclasses designed specifically for serial communication protocols.
@@ -0,0 +1,95 @@
1
+ # aiopapouch
2
+
3
+ This repository contains an asynchronous Python I/O library for Papouch s.r.o. devices.
4
+
5
+ The library provides two major components: **Devices** and **API Client** for communication with the hardware.
6
+
7
+ ## Requirements
8
+
9
+ * **Python 3.14+**: The library requires Python 3.14 or higher (PEP 758).
10
+ * **aiohttp**: Required for handling asynchronous HTTP communication with the devices.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install aiopapouch
16
+
17
+ ```
18
+
19
+ ## Supported Devices
20
+
21
+ Currently, the library supports the following Ethernet devices communicating via WEB mode:
22
+
23
+ * Quido ETH
24
+ * Papago
25
+ * Meteo
26
+ * 2TH
27
+ * 5HDI DO
28
+ * TH 2DI DO
29
+ * TH2E
30
+ * TME
31
+ * TME Multi / Radio
32
+
33
+ ## Devices
34
+
35
+ The library is designed using an object-oriented approach. Every device (or device family) is a subclass of `PapouchDevice`, which provides contract methods such as `parse_fresh_data`, `get_supported_sensors`, and properties like `name` and `location`. The `base.py` file also includes mixins (primarily for HTTP communication), as various network devices share the same functions. Creating an additional layer between `PapouchDevice` and the final subclasses is unnecessary since only a specific subset of functions needs to be included.
36
+
37
+ Due to polymorphism, the `create_device` function returns an abstract `PapouchDevice`. It works in tandem with the `is_device_supported` function, which validates whether the hardware is supported by this library.
38
+
39
+ > ***Note:*** The constructors are asynchronous (implementing the factory pattern). Creating any device instance utilizes the network to download the initial configuration.
40
+
41
+ > ***Note:*** The library was designed specifically for Home Assistant. Methods like `get_supported_sensors` return configurations required for entity creation in Home Assistant. This remains the primary purpose of the library.
42
+
43
+ > ***Note:*** Initial fresh fetch of data happens before the creation of the entities, making it a valid approach to generate configurations during the parsing of fresh data.
44
+
45
+ ## API Client
46
+
47
+ The API Client follows a similar architecture. There is an abstract base class `PapouchTransport` that defines the contract methods for subclasses, such as `fetch_info`, `read_command`, and `write_command`.
48
+
49
+ Currently, there is one subclass, `PapouchHTTPClient`, which fulfills this contract and handles network communication over HTTP.
50
+
51
+ ## Exceptions
52
+
53
+ The library defines custom exceptions raised during execution. These exceptions are designed to be caught and handled within the Home Assistant integration.
54
+
55
+ ## Usage
56
+
57
+ Although `aiopapouch` is primarily designed to serve as the underlying library for the official Home Assistant Papouch integration, it can also be used independently in standalone Python scripts.
58
+
59
+ The following example illustrates how to create a client, instantiate a device, fetch raw telemetry data, and pass it to `parse_fresh_data`:
60
+
61
+ ```python
62
+ import asyncio
63
+ import aiohttp
64
+ from aiopapouch import PapouchHTTPClient, create_device
65
+
66
+ async def main():
67
+ # Initialize the aiohttp client session
68
+ async with aiohttp.ClientSession() as session:
69
+ # Initialize the API transport client
70
+ client = PapouchHTTPClient("192.168.1.100", session)
71
+
72
+ # Create the device
73
+ device = await create_device(client)
74
+
75
+ if device is None:
76
+ print("Device not supported or connection failed.")
77
+ return
78
+
79
+ print(f"Connected to: {device.name} at {device.location}")
80
+
81
+ # Fetch raw fresh XML data from the device
82
+ raw_fresh_xml = await client.fetch_data()
83
+
84
+ # Parse fresh data to update device state and return processed readings
85
+ parsed_data = await device.parse_fresh_data(raw_fresh_xml)
86
+ print("Parsed telemetry data:", parsed_data)
87
+
88
+ if __name__ == "__main__":
89
+ asyncio.run(main())
90
+
91
+ ```
92
+
93
+ ## Future Extensions
94
+
95
+ Papouch manufactures not only network-based devices but also serial ones (e.g., using RS485). Future extensions will include a new serial transport subclass implementing `PapouchTransport`, alongside new `PapouchDevice` subclasses designed specifically for serial communication protocols.
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "aiopapouch"
7
+ version = "0.0.1"
8
+ description = "API client and device models for Papouch's devices"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "VladislavLevitskii", email = "vladlevitskii@gmail.com" }
14
+ ]
15
+ dependencies = [
16
+ "aiohttp>=3.0.0",
17
+ "defusedxml>=0.7.1"
18
+ ]
19
+
20
+ [project.urls]
21
+ Source = "https://github.com/VladislavLevitskii/aiopapouch"
22
+
23
+ [tool.hatch.build.targets.wheel]
24
+ packages = ["src/aiopapouch"]
@@ -0,0 +1,12 @@
1
+ """This file is used as a hub for imports."""
2
+
3
+ from .client import PapouchHTTPClient, PapouchTransport
4
+ from .devices import PapouchDevice, create_device, is_device_supported
5
+
6
+ __all__ = [
7
+ "PapouchDevice",
8
+ "PapouchHTTPClient",
9
+ "PapouchTransport",
10
+ "create_device",
11
+ "is_device_supported",
12
+ ]