pykoplenti 1.0.0__tar.gz → 1.2.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.

Potentially problematic release.


This version of pykoplenti might be problematic. Click here for more details.

@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.1
2
+ Name: pykoplenti
3
+ Version: 1.2.1
4
+ Summary: Python REST-Client for Kostal Plenticore Solar Inverters
5
+ Home-page: https://github.com/stegm/pyclient_koplenti
6
+ Author: @stegm
7
+ Project-URL: repository, https://github.com/stegm/pyclient_koplenti
8
+ Project-URL: changelog, https://github.com/stegm/pykoplenti/blob/master/CHANGELOG.md
9
+ Project-URL: issues, https://github.com/stegm/pykoplenti/issues
10
+ Keywords: rest kostal plenticore solar
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aiohttp~=3.8.5
22
+ Requires-Dist: pycryptodome~=3.19
23
+ Requires-Dist: pydantic~=1.10
24
+ Provides-Extra: cli
25
+ Requires-Dist: prompt_toolkit>=3.0; extra == "cli"
26
+ Requires-Dist: click>=7.1; extra == "cli"
27
+
28
+ # Python Library for Accessing Kostal Plenticore Inverters
29
+
30
+ This repository provides a python library and command line interface for the REST-API of Kostal Plenticore Solar Inverter.
31
+
32
+ This library is not affiliated with Kostal and is no offical product. It uses the interfaces of the inverter like other libs (eg. https://github.com/kilianknoll/kostal-RESTAPI) and uses information from their swagger documentation (ip-addr/api/v1/).
33
+
34
+ ![CI](https://github.com/stegm/pykoplenti/workflows/CI/badge.svg)
35
+
36
+ ## Features
37
+
38
+ - Authenticate
39
+ - Read/Write settings
40
+ - Read process data
41
+ - Read events
42
+ - Download of log data
43
+ - Full async-Support for reading and writing data
44
+ - [Commandline interface](doc/command_line.md) for shell access
45
+ - Dynamic data model - adapts automatically to new process data or settings
46
+ - [Virtual Process Data](doc/virtual_process_data.md) values
47
+
48
+ ## Getting Started
49
+
50
+ ### Prerequisites
51
+
52
+ You will need Python >=3.7.
53
+
54
+ ### Installing the library
55
+
56
+ Packages of this library are released on [PyPI](https://pypi.org/project/kostal-plenticore/) and can be
57
+ installed with `pip`. Alternatively the packages can also be downloaded from
58
+ [GitHub](https://github.com/stegm/pykoplenti/releases/).
59
+
60
+ I recommend to use a [virtual environment](https://docs.python.org/3/library/venv.html) for this,
61
+ because it installs the dependecies independently from the system. The installed CLI tools can then be called
62
+ without activating the virtual environment it.
63
+
64
+ ```shell
65
+ # Install with command line support
66
+ $ pip install pykoplenti[CLI]
67
+
68
+ # Install without command line support
69
+ $ pip install pykoplenti
70
+ ```
71
+
72
+ ### Using the command line interface
73
+
74
+ Installing the libray with `CLI` provides a new command.
75
+
76
+ ```shell
77
+ $ pykoplenti --help
78
+ Usage: pykoplenti [OPTIONS] COMMAND [ARGS]...
79
+
80
+ Handling of global arguments with click
81
+
82
+ Options:
83
+ --host TEXT hostname or ip of the inverter
84
+ --port INTEGER port of the inverter (default 80)
85
+ --password TEXT the password
86
+ --password-file TEXT password file (default "secrets" in the current
87
+ working directory)
88
+
89
+ --help Show this message and exit.
90
+
91
+ Commands:
92
+ all-processdata Returns a list of all available process data.
93
+ all-settings Returns the ids of all settings.
94
+ read-processdata Returns the values of the given process data.
95
+ read-settings Read the value of the given settings.
96
+ repl Provides a simple REPL for executing API requests to...
97
+ write-settings Write the values of the given settings.
98
+ ```
99
+
100
+ Visit [Command Line Help](doc/command_line.md) for example usage.
101
+
102
+ ### Using the library from python
103
+
104
+ The library is fully async, there for you need an async loop and an async `ClientSession`. Please refer to the
105
+ example directory for full code.
106
+
107
+ Import the client module:
108
+
109
+ ```python
110
+ from pykoplenti import ApiClient
111
+ ```
112
+
113
+ To communicate with the inverter you need to instantiate the client:
114
+
115
+ ```python
116
+ # session is a aiohttp ClientSession
117
+ client = ApiClient(session, '192.168.1.100')
118
+ ```
119
+
120
+ Login to gain full access to process data and settings:
121
+
122
+ ```python
123
+ await client.login(passwd)
124
+ ```
125
+
126
+ Now you can access the API. For example to read process data values:
127
+
128
+ ```python
129
+ data = await client.get_process_data_values('devices:local', ['Inverter:State', 'Home_P'])
130
+
131
+ device_local = data['devices:local']
132
+ inverter_state = device_local['Inverter:State']
133
+ home_p = device_local['Home_P']
134
+ ```
135
+
136
+ See the full example here: [read_process_data.py](examples/read_process_data.py).
137
+
138
+ If you should need installer access use the master key (printed on a label at the side of the inverter)
139
+ and additionally pass your service code:
140
+
141
+ ```python
142
+ await client.login(my_master_key, service_code=my_service_code)
143
+ ```
144
+
145
+ ## Documentation
146
+
147
+ - [Command Line Interface](doc/command_line.md)
148
+ - [Examples](examples/)
149
+ - [Virtual Process Data](doc/virtual_process_data.md)
150
+
151
+ ## Built With
152
+
153
+ - [AIOHTTPO](https://docs.aiohttp.org/en/stable/) - asyncio for HTTP
154
+ - [click](https://click.palletsprojects.com/) - command line interface framework
155
+ - [black](https://github.com/psf/black) - Python code formatter
156
+ - [ruff](https://github.com/astral-sh/ruff) - Python linter
157
+ - [pytest](https://docs.pytest.org/) - Python test framework
158
+ - [mypy](https://mypy-lang.org/) - Python type checker
159
+ - [setuptools](https://github.com/pypa/setuptools) - Python packager
160
+
161
+ ## License
162
+
163
+ apache-2.0
164
+
165
+ ## Acknowledgments
166
+
167
+ - [kilianknoll](https://github.com/kilianknoll) for the kostal-RESTAPI project
@@ -8,14 +8,15 @@ This library is not affiliated with Kostal and is no offical product. It uses th
8
8
 
9
9
  ## Features
10
10
 
11
- * Authenticate
12
- * Read/Write settings
13
- * Read process data
14
- * Read events
15
- * Download of log data
16
- * Full async-Support for reading and writing data
17
- * Commandline interface for shell access
18
- * Dynamic data model
11
+ - Authenticate
12
+ - Read/Write settings
13
+ - Read process data
14
+ - Read events
15
+ - Download of log data
16
+ - Full async-Support for reading and writing data
17
+ - [Commandline interface](doc/command_line.md) for shell access
18
+ - Dynamic data model - adapts automatically to new process data or settings
19
+ - [Virtual Process Data](doc/virtual_process_data.md) values
19
20
 
20
21
  ## Getting Started
21
22
 
@@ -25,12 +26,11 @@ You will need Python >=3.7.
25
26
 
26
27
  ### Installing the library
27
28
 
28
- Packages of this library are released on [PyPI](https://pypi.org/project/kostal-plenticore/) and can be
29
- installed with `pip`. Alternatively the packages can also be downloaded from
29
+ Packages of this library are released on [PyPI](https://pypi.org/project/kostal-plenticore/) and can be
30
+ installed with `pip`. Alternatively the packages can also be downloaded from
30
31
  [GitHub](https://github.com/stegm/pykoplenti/releases/).
31
32
 
32
-
33
- I recommend to use a [virtual environment](https://docs.python.org/3/library/venv.html) for this,
33
+ I recommend to use a [virtual environment](https://docs.python.org/3/library/venv.html) for this,
34
34
  because it installs the dependecies independently from the system. The installed CLI tools can then be called
35
35
  without activating the virtual environment it.
36
36
 
@@ -44,7 +44,6 @@ $ pip install pykoplenti
44
44
 
45
45
  ### Using the command line interface
46
46
 
47
-
48
47
  Installing the libray with `CLI` provides a new command.
49
48
 
50
49
  ```shell
@@ -72,7 +71,7 @@ Commands:
72
71
  ```
73
72
 
74
73
  Visit [Command Line Help](doc/command_line.md) for example usage.
75
-
74
+
76
75
  ### Using the library from python
77
76
 
78
77
  The library is fully async, there for you need an async loop and an async `ClientSession`. Please refer to the
@@ -85,7 +84,7 @@ from pykoplenti import ApiClient
85
84
  ```
86
85
 
87
86
  To communicate with the inverter you need to instantiate the client:
88
-
87
+
89
88
  ```python
90
89
  # session is a aiohttp ClientSession
91
90
  client = ApiClient(session, '192.168.1.100')
@@ -109,16 +108,28 @@ home_p = device_local['Home_P']
109
108
 
110
109
  See the full example here: [read_process_data.py](examples/read_process_data.py).
111
110
 
111
+ If you should need installer access use the master key (printed on a label at the side of the inverter)
112
+ and additionally pass your service code:
113
+
114
+ ```python
115
+ await client.login(my_master_key, service_code=my_service_code)
116
+ ```
112
117
 
113
118
  ## Documentation
114
119
 
115
- * [Command Line Interface](doc/command_line.md)
116
- * [Examples](examples/)
120
+ - [Command Line Interface](doc/command_line.md)
121
+ - [Examples](examples/)
122
+ - [Virtual Process Data](doc/virtual_process_data.md)
117
123
 
118
124
  ## Built With
119
125
 
120
- * [AIOHTTPO](https://docs.aiohttp.org/en/stable/) - asyncio for HTTP
121
- * [click](https://click.palletsprojects.com/) - command line interface framework
126
+ - [AIOHTTPO](https://docs.aiohttp.org/en/stable/) - asyncio for HTTP
127
+ - [click](https://click.palletsprojects.com/) - command line interface framework
128
+ - [black](https://github.com/psf/black) - Python code formatter
129
+ - [ruff](https://github.com/astral-sh/ruff) - Python linter
130
+ - [pytest](https://docs.pytest.org/) - Python test framework
131
+ - [mypy](https://mypy-lang.org/) - Python type checker
132
+ - [setuptools](https://github.com/pypa/setuptools) - Python packager
122
133
 
123
134
  ## License
124
135
 
@@ -126,6 +137,4 @@ apache-2.0
126
137
 
127
138
  ## Acknowledgments
128
139
 
129
-
130
-
131
- * [kilianknoll](https://github.com/kilianknoll) for the kostal-RESTAPI project
140
+ - [kilianknoll](https://github.com/kilianknoll) for the kostal-RESTAPI project
@@ -0,0 +1,37 @@
1
+ from .api import (
2
+ ApiClient,
3
+ ApiException,
4
+ AuthenticationException,
5
+ InternalCommunicationException,
6
+ ModuleNotFoundException,
7
+ NotAuthorizedException,
8
+ UserLockedException,
9
+ )
10
+ from .extended import ExtendedApiClient
11
+ from .model import (
12
+ EventData,
13
+ MeData,
14
+ ModuleData,
15
+ ProcessData,
16
+ ProcessDataCollection,
17
+ SettingsData,
18
+ VersionData,
19
+ )
20
+
21
+ __all__ = [
22
+ "MeData",
23
+ "VersionData",
24
+ "ModuleData",
25
+ "ProcessData",
26
+ "ProcessDataCollection",
27
+ "SettingsData",
28
+ "EventData",
29
+ "ApiException",
30
+ "InternalCommunicationException",
31
+ "AuthenticationException",
32
+ "NotAuthorizedException",
33
+ "UserLockedException",
34
+ "ModuleNotFoundException",
35
+ "ApiClient",
36
+ "ExtendedApiClient",
37
+ ]