pyzonneplan 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.
- pyzonneplan-0.1.0/.gitignore +222 -0
- pyzonneplan-0.1.0/LICENSE +21 -0
- pyzonneplan-0.1.0/PKG-INFO +152 -0
- pyzonneplan-0.1.0/README.md +121 -0
- pyzonneplan-0.1.0/pyproject.toml +190 -0
- pyzonneplan-0.1.0/src/pyzonneplan/__init__.py +79 -0
- pyzonneplan-0.1.0/src/pyzonneplan/auth.py +85 -0
- pyzonneplan-0.1.0/src/pyzonneplan/const.py +46 -0
- pyzonneplan-0.1.0/src/pyzonneplan/exceptions.py +21 -0
- pyzonneplan-0.1.0/src/pyzonneplan/models/__init__.py +47 -0
- pyzonneplan-0.1.0/src/pyzonneplan/models/account.py +130 -0
- pyzonneplan-0.1.0/src/pyzonneplan/models/consumption.py +64 -0
- pyzonneplan-0.1.0/src/pyzonneplan/models/devices.py +224 -0
- pyzonneplan-0.1.0/src/pyzonneplan/models/prices.py +84 -0
- pyzonneplan-0.1.0/src/pyzonneplan/py.typed +0 -0
- pyzonneplan-0.1.0/src/pyzonneplan/pyzonneplan.py +312 -0
|
@@ -0,0 +1,222 @@
|
|
|
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
|
|
219
|
+
|
|
220
|
+
# Local dev copy of example.py containing real credentials, and its raw API dumps
|
|
221
|
+
example_dev.py
|
|
222
|
+
examples/.dumps/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Erwin Douna
|
|
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,152 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pyzonneplan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Asynchronous Python client for the Zonneplan API
|
|
5
|
+
Project-URL: Homepage, https://github.com/erwindouna/pyzonneplan
|
|
6
|
+
Project-URL: Repository, https://github.com/erwindouna/pyzonneplan
|
|
7
|
+
Project-URL: Documentation, https://erwindouna.github.io/pyzonneplan/
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/erwindouna/pyzonneplan/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/erwindouna/pyzonneplan/releases
|
|
10
|
+
Author-email: Erwin Douna <e.douna@gmail.com>
|
|
11
|
+
Maintainer-email: Erwin Douna <e.douna@gmail.com>
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: api,async,battery,charge-point,client,pv,solar,zonneplan
|
|
15
|
+
Classifier: Framework :: AsyncIO
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Natural Language :: English
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: <4,>=3.12
|
|
25
|
+
Requires-Dist: aiohttp>=3.0.0
|
|
26
|
+
Requires-Dist: mashumaro<4,>=3.17
|
|
27
|
+
Requires-Dist: orjson<4,>=3.10.16
|
|
28
|
+
Requires-Dist: tenacity>=9.0.0
|
|
29
|
+
Requires-Dist: yarl>=1.6.0
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# pyzonneplan
|
|
33
|
+
|
|
34
|
+
[![GitHub Release][releases-shield]][releases]
|
|
35
|
+
[![Python Versions][python-versions-shield]][pypi]
|
|
36
|
+
![Project Stage][project-stage-shield]
|
|
37
|
+
![Project Maintenance][maintenance-shield]
|
|
38
|
+
[![License][license-shield]](LICENSE)
|
|
39
|
+
|
|
40
|
+
[![GitHub Activity][commits-shield]][commits-url]
|
|
41
|
+
[![PyPI Downloads][downloads-shield]][downloads-url]
|
|
42
|
+
[![GitHub Last Commit][last-commit-shield]][commits-url]
|
|
43
|
+
[![Open in Dev Containers][devcontainer-shield]][devcontainer]
|
|
44
|
+
|
|
45
|
+
[![Build Status][build-shield]][build-url]
|
|
46
|
+
[![Typing Status][typing-shield]][typing-url]
|
|
47
|
+
[![Code Coverage][codecov-shield]][codecov-url]
|
|
48
|
+
|
|
49
|
+
Asynchronous Python client for the Zonneplan API.
|
|
50
|
+
|
|
51
|
+
## About
|
|
52
|
+
|
|
53
|
+
pyzonneplan is an async client for the [Zonneplan](https://www.zonneplan.nl/) API, focused on:
|
|
54
|
+
|
|
55
|
+
- Solar (PV) installation data
|
|
56
|
+
- Dynamic pricing and energy consumption data
|
|
57
|
+
- Home battery monitoring and control modes
|
|
58
|
+
- EV charge point sessions and schedules
|
|
59
|
+
|
|
60
|
+
The library is under active development and endpoint coverage will keep expanding.
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install pyzonneplan
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
Zonneplan authenticates with a one-time password mailed to the account address, rather than a plain username/password login:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import asyncio
|
|
74
|
+
|
|
75
|
+
from aiohttp import ClientSession
|
|
76
|
+
from pyzonneplan import ZonneplanAuth
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
async def main() -> None:
|
|
80
|
+
async with ClientSession() as session:
|
|
81
|
+
auth = ZonneplanAuth(session=session)
|
|
82
|
+
challenge = await auth.async_request_otp("you@example.com", source_name="pyzonneplan")
|
|
83
|
+
|
|
84
|
+
otp = input("Enter the one-time password mailed to you: ")
|
|
85
|
+
token = await auth.async_submit_otp(challenge, otp)
|
|
86
|
+
|
|
87
|
+
print("Access token:", token.access_token)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
asyncio.run(main())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Store `token.as_dict()` and restore it later with `Token.from_dict(...)`; refresh it
|
|
95
|
+
with `auth.async_refresh_token(token)` once it is close to `token.expires_at`.
|
|
96
|
+
|
|
97
|
+
More examples can be found in the examples directory.
|
|
98
|
+
|
|
99
|
+
## Documentation
|
|
100
|
+
|
|
101
|
+
Project documentation and API reference: https://erwindouna.github.io/pyzonneplan/
|
|
102
|
+
|
|
103
|
+
## Contributing
|
|
104
|
+
|
|
105
|
+
Contributions are welcome. Please open an issue or pull request.
|
|
106
|
+
|
|
107
|
+
For local development:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
uv sync --all-groups && uv run pre-commit install
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Run checks:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
uv run pre-commit run --all-files
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Run tests:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
uv run pytest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT License
|
|
128
|
+
|
|
129
|
+
Copyright (c) 2026 Erwin Douna
|
|
130
|
+
|
|
131
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
132
|
+
|
|
133
|
+
[build-shield]: https://github.com/erwindouna/pyzonneplan/actions/workflows/tests.yaml/badge.svg
|
|
134
|
+
[build-url]: https://github.com/erwindouna/pyzonneplan/actions/workflows/tests.yaml
|
|
135
|
+
[codecov-shield]: https://codecov.io/gh/erwindouna/pyzonneplan/branch/main/graph/badge.svg
|
|
136
|
+
[codecov-url]: https://codecov.io/gh/erwindouna/pyzonneplan
|
|
137
|
+
[commits-shield]: https://img.shields.io/github/commit-activity/y/erwindouna/pyzonneplan.svg
|
|
138
|
+
[commits-url]: https://github.com/erwindouna/pyzonneplan/commits/main
|
|
139
|
+
[devcontainer-shield]: https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode
|
|
140
|
+
[devcontainer]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/erwindouna/pyzonneplan
|
|
141
|
+
[downloads-shield]: https://img.shields.io/pypi/dm/pyzonneplan
|
|
142
|
+
[downloads-url]: https://pypistats.org/packages/pyzonneplan
|
|
143
|
+
[last-commit-shield]: https://img.shields.io/github/last-commit/erwindouna/pyzonneplan.svg
|
|
144
|
+
[license-shield]: https://img.shields.io/github/license/erwindouna/pyzonneplan.svg
|
|
145
|
+
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
|
146
|
+
[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg
|
|
147
|
+
[pypi]: https://pypi.org/project/pyzonneplan/
|
|
148
|
+
[python-versions-shield]: https://img.shields.io/pypi/pyversions/pyzonneplan
|
|
149
|
+
[releases-shield]: https://img.shields.io/github/release/erwindouna/pyzonneplan.svg
|
|
150
|
+
[releases]: https://github.com/erwindouna/pyzonneplan/releases
|
|
151
|
+
[typing-shield]: https://github.com/erwindouna/pyzonneplan/actions/workflows/typing.yaml/badge.svg
|
|
152
|
+
[typing-url]: https://github.com/erwindouna/pyzonneplan/actions/workflows/typing.yaml
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# pyzonneplan
|
|
2
|
+
|
|
3
|
+
[![GitHub Release][releases-shield]][releases]
|
|
4
|
+
[![Python Versions][python-versions-shield]][pypi]
|
|
5
|
+
![Project Stage][project-stage-shield]
|
|
6
|
+
![Project Maintenance][maintenance-shield]
|
|
7
|
+
[![License][license-shield]](LICENSE)
|
|
8
|
+
|
|
9
|
+
[![GitHub Activity][commits-shield]][commits-url]
|
|
10
|
+
[![PyPI Downloads][downloads-shield]][downloads-url]
|
|
11
|
+
[![GitHub Last Commit][last-commit-shield]][commits-url]
|
|
12
|
+
[![Open in Dev Containers][devcontainer-shield]][devcontainer]
|
|
13
|
+
|
|
14
|
+
[![Build Status][build-shield]][build-url]
|
|
15
|
+
[![Typing Status][typing-shield]][typing-url]
|
|
16
|
+
[![Code Coverage][codecov-shield]][codecov-url]
|
|
17
|
+
|
|
18
|
+
Asynchronous Python client for the Zonneplan API.
|
|
19
|
+
|
|
20
|
+
## About
|
|
21
|
+
|
|
22
|
+
pyzonneplan is an async client for the [Zonneplan](https://www.zonneplan.nl/) API, focused on:
|
|
23
|
+
|
|
24
|
+
- Solar (PV) installation data
|
|
25
|
+
- Dynamic pricing and energy consumption data
|
|
26
|
+
- Home battery monitoring and control modes
|
|
27
|
+
- EV charge point sessions and schedules
|
|
28
|
+
|
|
29
|
+
The library is under active development and endpoint coverage will keep expanding.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install pyzonneplan
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Zonneplan authenticates with a one-time password mailed to the account address, rather than a plain username/password login:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import asyncio
|
|
43
|
+
|
|
44
|
+
from aiohttp import ClientSession
|
|
45
|
+
from pyzonneplan import ZonneplanAuth
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def main() -> None:
|
|
49
|
+
async with ClientSession() as session:
|
|
50
|
+
auth = ZonneplanAuth(session=session)
|
|
51
|
+
challenge = await auth.async_request_otp("you@example.com", source_name="pyzonneplan")
|
|
52
|
+
|
|
53
|
+
otp = input("Enter the one-time password mailed to you: ")
|
|
54
|
+
token = await auth.async_submit_otp(challenge, otp)
|
|
55
|
+
|
|
56
|
+
print("Access token:", token.access_token)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if __name__ == "__main__":
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Store `token.as_dict()` and restore it later with `Token.from_dict(...)`; refresh it
|
|
64
|
+
with `auth.async_refresh_token(token)` once it is close to `token.expires_at`.
|
|
65
|
+
|
|
66
|
+
More examples can be found in the examples directory.
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
Project documentation and API reference: https://erwindouna.github.io/pyzonneplan/
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
|
|
74
|
+
Contributions are welcome. Please open an issue or pull request.
|
|
75
|
+
|
|
76
|
+
For local development:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv sync --all-groups && uv run pre-commit install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Run checks:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
uv run pre-commit run --all-files
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Run tests:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv run pytest
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT License
|
|
97
|
+
|
|
98
|
+
Copyright (c) 2026 Erwin Douna
|
|
99
|
+
|
|
100
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
101
|
+
|
|
102
|
+
[build-shield]: https://github.com/erwindouna/pyzonneplan/actions/workflows/tests.yaml/badge.svg
|
|
103
|
+
[build-url]: https://github.com/erwindouna/pyzonneplan/actions/workflows/tests.yaml
|
|
104
|
+
[codecov-shield]: https://codecov.io/gh/erwindouna/pyzonneplan/branch/main/graph/badge.svg
|
|
105
|
+
[codecov-url]: https://codecov.io/gh/erwindouna/pyzonneplan
|
|
106
|
+
[commits-shield]: https://img.shields.io/github/commit-activity/y/erwindouna/pyzonneplan.svg
|
|
107
|
+
[commits-url]: https://github.com/erwindouna/pyzonneplan/commits/main
|
|
108
|
+
[devcontainer-shield]: https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode
|
|
109
|
+
[devcontainer]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/erwindouna/pyzonneplan
|
|
110
|
+
[downloads-shield]: https://img.shields.io/pypi/dm/pyzonneplan
|
|
111
|
+
[downloads-url]: https://pypistats.org/packages/pyzonneplan
|
|
112
|
+
[last-commit-shield]: https://img.shields.io/github/last-commit/erwindouna/pyzonneplan.svg
|
|
113
|
+
[license-shield]: https://img.shields.io/github/license/erwindouna/pyzonneplan.svg
|
|
114
|
+
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
|
115
|
+
[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg
|
|
116
|
+
[pypi]: https://pypi.org/project/pyzonneplan/
|
|
117
|
+
[python-versions-shield]: https://img.shields.io/pypi/pyversions/pyzonneplan
|
|
118
|
+
[releases-shield]: https://img.shields.io/github/release/erwindouna/pyzonneplan.svg
|
|
119
|
+
[releases]: https://github.com/erwindouna/pyzonneplan/releases
|
|
120
|
+
[typing-shield]: https://github.com/erwindouna/pyzonneplan/actions/workflows/typing.yaml/badge.svg
|
|
121
|
+
[typing-url]: https://github.com/erwindouna/pyzonneplan/actions/workflows/typing.yaml
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pyzonneplan"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Asynchronous Python client for the Zonneplan API"
|
|
5
|
+
authors = [{ name = "Erwin Douna", email = "e.douna@gmail.com" }]
|
|
6
|
+
requires-python = ">=3.12,<4"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
license = "MIT"
|
|
9
|
+
maintainers = [{ name = "Erwin Douna", email = "e.douna@gmail.com" }]
|
|
10
|
+
keywords = [
|
|
11
|
+
"zonneplan",
|
|
12
|
+
"solar",
|
|
13
|
+
"pv",
|
|
14
|
+
"battery",
|
|
15
|
+
"charge-point",
|
|
16
|
+
"async",
|
|
17
|
+
"api",
|
|
18
|
+
"client",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Framework :: AsyncIO",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Natural Language :: English",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"aiohttp>=3.0.0",
|
|
33
|
+
"yarl>=1.6.0",
|
|
34
|
+
"mashumaro>=3.17,<4",
|
|
35
|
+
"orjson>=3.10.16,<4",
|
|
36
|
+
"tenacity>=9.0.0",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/erwindouna/pyzonneplan"
|
|
41
|
+
Repository = "https://github.com/erwindouna/pyzonneplan"
|
|
42
|
+
Documentation = "https://erwindouna.github.io/pyzonneplan/"
|
|
43
|
+
"Bug Tracker" = "https://github.com/erwindouna/pyzonneplan/issues"
|
|
44
|
+
Changelog = "https://github.com/erwindouna/pyzonneplan/releases"
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"aresponses==3.0.0",
|
|
49
|
+
"freezegun==1.5.5",
|
|
50
|
+
"codespell==2.4.3",
|
|
51
|
+
"covdefaults==2.3.0",
|
|
52
|
+
"coverage[toml]==7.15.4",
|
|
53
|
+
"mypy==2.3.1",
|
|
54
|
+
"pre-commit==4.6.2",
|
|
55
|
+
"pre-commit-hooks==6.0.0",
|
|
56
|
+
"pylint==4.0.7",
|
|
57
|
+
"pytest==9.1.1",
|
|
58
|
+
"pytest-asyncio==1.4.0",
|
|
59
|
+
"pytest-cov==7.1.0",
|
|
60
|
+
"ruff==0.16.4",
|
|
61
|
+
"syrupy==6.0.0",
|
|
62
|
+
"yamllint==1.38.0",
|
|
63
|
+
]
|
|
64
|
+
docs = [
|
|
65
|
+
"mkdocs>=1.6.1,<2",
|
|
66
|
+
"mkdocstrings[python]>=0.30.1,<1.1.0",
|
|
67
|
+
"mkdocs-material>=9.6.22,<10",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[tool.uv]
|
|
71
|
+
default-groups = [
|
|
72
|
+
"dev",
|
|
73
|
+
"docs",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
[tool.hatch.build.targets.sdist]
|
|
77
|
+
include = ["src/pyzonneplan"]
|
|
78
|
+
|
|
79
|
+
[tool.hatch.build.targets.wheel]
|
|
80
|
+
include = ["src/pyzonneplan"]
|
|
81
|
+
|
|
82
|
+
[tool.hatch.build.targets.wheel.sources]
|
|
83
|
+
"src/pyzonneplan" = "pyzonneplan"
|
|
84
|
+
|
|
85
|
+
[build-system]
|
|
86
|
+
requires = ["hatchling"]
|
|
87
|
+
build-backend = "hatchling.build"
|
|
88
|
+
|
|
89
|
+
[tool.coverage.run]
|
|
90
|
+
plugins = ["covdefaults"]
|
|
91
|
+
source = ["pyzonneplan"]
|
|
92
|
+
|
|
93
|
+
[tool.coverage.report]
|
|
94
|
+
fail_under = 90
|
|
95
|
+
show_missing = true
|
|
96
|
+
|
|
97
|
+
[tool.mypy]
|
|
98
|
+
platform = "linux"
|
|
99
|
+
python_version = "3.12"
|
|
100
|
+
show_column_numbers = true
|
|
101
|
+
follow_imports = "normal"
|
|
102
|
+
ignore_missing_imports = true
|
|
103
|
+
check_untyped_defs = true
|
|
104
|
+
disallow_any_generics = true
|
|
105
|
+
disallow_incomplete_defs = true
|
|
106
|
+
disallow_subclassing_any = true
|
|
107
|
+
disallow_untyped_calls = true
|
|
108
|
+
disallow_untyped_decorators = true
|
|
109
|
+
disallow_untyped_defs = true
|
|
110
|
+
no_implicit_optional = true
|
|
111
|
+
no_implicit_reexport = true
|
|
112
|
+
strict_optional = true
|
|
113
|
+
warn_incomplete_stub = true
|
|
114
|
+
warn_no_return = true
|
|
115
|
+
warn_redundant_casts = true
|
|
116
|
+
warn_return_any = true
|
|
117
|
+
warn_unused_configs = true
|
|
118
|
+
warn_unused_ignores = true
|
|
119
|
+
|
|
120
|
+
[tool.pylint.MASTER]
|
|
121
|
+
ignore-paths = ["^tests/.*$"]
|
|
122
|
+
extension-pkg-allow-list = ["orjson"]
|
|
123
|
+
|
|
124
|
+
[tool.pylint.BASIC]
|
|
125
|
+
good-names = ["_", "ex", "fp", "i", "id", "j", "k", "on", "Run", "T"]
|
|
126
|
+
|
|
127
|
+
[tool.pylint."MESSAGES CONTROL"]
|
|
128
|
+
disable = [
|
|
129
|
+
"duplicate-code",
|
|
130
|
+
"format",
|
|
131
|
+
"unsubscriptable-object",
|
|
132
|
+
"too-many-public-methods",
|
|
133
|
+
"too-few-public-methods",
|
|
134
|
+
"too-many-instance-attributes",
|
|
135
|
+
"too-many-arguments",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[tool.pylint.SIMILARITIES]
|
|
139
|
+
ignore-imports = true
|
|
140
|
+
|
|
141
|
+
[tool.pylint.FORMAT]
|
|
142
|
+
max-line-length = 88
|
|
143
|
+
|
|
144
|
+
[tool.pylint.DESIGN]
|
|
145
|
+
max-attributes = 20
|
|
146
|
+
|
|
147
|
+
[tool.pytest.ini_options]
|
|
148
|
+
addopts = "--cov"
|
|
149
|
+
asyncio_mode = "auto"
|
|
150
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
151
|
+
|
|
152
|
+
[tool.ruff]
|
|
153
|
+
lint.select = ["ALL"]
|
|
154
|
+
lint.ignore = [
|
|
155
|
+
"ANN401",
|
|
156
|
+
"CPY001", # No copyright header convention in this project
|
|
157
|
+
"D203",
|
|
158
|
+
"D213",
|
|
159
|
+
"D417",
|
|
160
|
+
"PLR2004",
|
|
161
|
+
"SLOT000",
|
|
162
|
+
"PLR0913",
|
|
163
|
+
"PLR0912",
|
|
164
|
+
"COM812",
|
|
165
|
+
"ISC001",
|
|
166
|
+
"TRY003",
|
|
167
|
+
"TRY301",
|
|
168
|
+
"EM101",
|
|
169
|
+
"EM102",
|
|
170
|
+
]
|
|
171
|
+
line-length = 150
|
|
172
|
+
|
|
173
|
+
[tool.ruff.lint.flake8-pytest-style]
|
|
174
|
+
mark-parentheses = false
|
|
175
|
+
fixture-parentheses = false
|
|
176
|
+
|
|
177
|
+
[tool.ruff.lint.isort]
|
|
178
|
+
known-first-party = ["pyzonneplan"]
|
|
179
|
+
|
|
180
|
+
[tool.ruff.lint.mccabe]
|
|
181
|
+
max-complexity = 25
|
|
182
|
+
|
|
183
|
+
[tool.ruff.lint.per-file-ignores]
|
|
184
|
+
"tests/**/*.py" = ["S101", "S105", "S106", "S107", "S108", "DTZ001", "DTZ006", "PLC0415", "ARG001", "ARG002", "TC001", "TC002", "TC003", "SIM117", "SLF001"]
|
|
185
|
+
"examples/**/*.py" = ["T201", "S106", "INP001", "ASYNC250"]
|
|
186
|
+
# mashumaro's DataClassORJSONMixin resolves field annotations at runtime via
|
|
187
|
+
# typing.get_type_hints(); moving these imports into `if TYPE_CHECKING:` blocks
|
|
188
|
+
# (as TC001-TC003 suggest) raises mashumaro.exceptions.UnresolvedTypeReferenceError.
|
|
189
|
+
"src/pyzonneplan/models/*.py" = ["TC001", "TC002", "TC003"]
|
|
190
|
+
"src/pyzonneplan/pyzonneplan.py" = ["ASYNC109"]
|