py-solar-assistant 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.
- py_solar_assistant-0.1.0/LICENSE +173 -0
- py_solar_assistant-0.1.0/PKG-INFO +437 -0
- py_solar_assistant-0.1.0/README.md +238 -0
- py_solar_assistant-0.1.0/pyproject.toml +34 -0
- py_solar_assistant-0.1.0/setup.cfg +4 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant/__init__.py +54 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant/cloud.py +181 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant/device.py +267 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant/socket.py +434 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant.egg-info/PKG-INFO +437 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant.egg-info/SOURCES.txt +12 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant.egg-info/dependency_links.txt +1 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant.egg-info/requires.txt +1 -0
- py_solar_assistant-0.1.0/src/py_solar_assistant.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
This licence applies solely to the Python client library in this repository.
|
|
2
|
+
It does not cover the SolarAssistant platform, including the downloadable
|
|
3
|
+
device software and cloud infrastructure, which are proprietary and
|
|
4
|
+
distributed under separate terms.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Apache License
|
|
9
|
+
Version 2.0, January 2004
|
|
10
|
+
http://www.apache.org/licenses/
|
|
11
|
+
|
|
12
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
13
|
+
|
|
14
|
+
1. Definitions.
|
|
15
|
+
|
|
16
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
17
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
18
|
+
|
|
19
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
20
|
+
the copyright owner that is granting the License.
|
|
21
|
+
|
|
22
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
23
|
+
other entities that control, are controlled by, or are under common
|
|
24
|
+
control with that entity. For the purposes of this definition,
|
|
25
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
26
|
+
direction or management of such entity, whether by contract or
|
|
27
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
28
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
29
|
+
|
|
30
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
31
|
+
exercising permissions granted by this License.
|
|
32
|
+
|
|
33
|
+
"Source form" shall mean the preferred form for making modifications,
|
|
34
|
+
including but not limited to software source code, documentation
|
|
35
|
+
source, and configuration files.
|
|
36
|
+
|
|
37
|
+
"Object form" shall mean any form resulting from mechanical
|
|
38
|
+
transformation or translation of a Source form, including but
|
|
39
|
+
not limited to compiled object code, generated documentation,
|
|
40
|
+
and conversions to other media types.
|
|
41
|
+
|
|
42
|
+
"Work" shall mean the work of authorship made available under
|
|
43
|
+
the License, as indicated by a copyright notice that is included in
|
|
44
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
45
|
+
|
|
46
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
47
|
+
form, that is based on (or derived from) the Work and for which the
|
|
48
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
49
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
50
|
+
of this License, Derivative Works shall not include works that remain
|
|
51
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
52
|
+
the Work and derivative works thereof.
|
|
53
|
+
|
|
54
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
55
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
56
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
57
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
58
|
+
or written communication sent to the Licensor or its representatives,
|
|
59
|
+
including but not limited to communication on electronic mailing lists,
|
|
60
|
+
source code control systems, and issue tracking systems that are managed
|
|
61
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
62
|
+
improving the Work, but excluding communication that is conspicuously
|
|
63
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
64
|
+
Contribution."
|
|
65
|
+
|
|
66
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
67
|
+
whom a Contribution has been received by the Licensor and included
|
|
68
|
+
within the Work.
|
|
69
|
+
|
|
70
|
+
2. Grant of Copyright 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
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
75
|
+
Work and such Derivative Works in Source or Object form.
|
|
76
|
+
|
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
82
|
+
where such license applies only to those patent claims licensable
|
|
83
|
+
by such Contributor that are necessarily infringed by their
|
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
86
|
+
institute patent litigation against any entity (including a cross-claim
|
|
87
|
+
or counterclaim in a lawsuit) alleging that the Work or any Contribution
|
|
88
|
+
incorporated within the Work constitutes direct or contributory patent
|
|
89
|
+
infringement, then any patent licenses granted to You under this License
|
|
90
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or Derivative Works
|
|
98
|
+
a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, patent, trademark, and
|
|
105
|
+
attribution notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file, you must include a
|
|
110
|
+
readable copy of the attribution notices contained within such
|
|
111
|
+
NOTICE file, in at least one of the following places: within a
|
|
112
|
+
NOTICE text file distributed as part of the Derivative Works;
|
|
113
|
+
within the Source form or documentation, if provided along with
|
|
114
|
+
the Derivative Works; or, within a display generated by the
|
|
115
|
+
Derivative Works, if and wherever such third-party notices normally
|
|
116
|
+
appear. The contents of the NOTICE file are for informational
|
|
117
|
+
purposes only and do not modify the License. You may add Your own
|
|
118
|
+
attribution notices within Derivative Works that You distribute,
|
|
119
|
+
alongside or as an addendum to the NOTICE text from the Work,
|
|
120
|
+
provided that such additional attribution notices cannot be
|
|
121
|
+
construed as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own license statement for Your modifications and
|
|
124
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
125
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
126
|
+
Derivative Works, as separate terms and conditions for use,
|
|
127
|
+
reproduction, or distribution of Your modifications, or for such
|
|
128
|
+
Derivative Works as a whole.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
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 or
|
|
144
|
+
implied, including, without limitation, any warranties or conditions
|
|
145
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
146
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
147
|
+
appropriateness of using or reproducing the Work and assume any
|
|
148
|
+
risks associated with Your exercise of permissions under this License.
|
|
149
|
+
|
|
150
|
+
8. Limitation of Liability. In 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 exemplary 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 all other
|
|
159
|
+
commercial damages or losses), even if such Contributor has been
|
|
160
|
+
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
|
+
Copyright (c) SolarAssistant. All rights reserved.
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py_solar_assistant
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for SolarAssistant — cloud API and real-time WebSocket
|
|
5
|
+
Author: Solar-Assistant
|
|
6
|
+
License: This licence applies solely to the Python client library in this repository.
|
|
7
|
+
It does not cover the SolarAssistant platform, including the downloadable
|
|
8
|
+
device software and cloud infrastructure, which are proprietary and
|
|
9
|
+
distributed under separate terms.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Apache License
|
|
14
|
+
Version 2.0, January 2004
|
|
15
|
+
http://www.apache.org/licenses/
|
|
16
|
+
|
|
17
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
18
|
+
|
|
19
|
+
1. Definitions.
|
|
20
|
+
|
|
21
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
22
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
23
|
+
|
|
24
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
25
|
+
the copyright owner that is granting the License.
|
|
26
|
+
|
|
27
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
28
|
+
other entities that control, are controlled by, or are under common
|
|
29
|
+
control with that entity. For the purposes of this definition,
|
|
30
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
31
|
+
direction or management of such entity, whether by contract or
|
|
32
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
33
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
34
|
+
|
|
35
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
36
|
+
exercising permissions granted by this License.
|
|
37
|
+
|
|
38
|
+
"Source form" shall mean the preferred form for making modifications,
|
|
39
|
+
including but not limited to software source code, documentation
|
|
40
|
+
source, and configuration files.
|
|
41
|
+
|
|
42
|
+
"Object form" shall mean any form resulting from mechanical
|
|
43
|
+
transformation or translation of a Source form, including but
|
|
44
|
+
not limited to compiled object code, generated documentation,
|
|
45
|
+
and conversions to other media types.
|
|
46
|
+
|
|
47
|
+
"Work" shall mean the work of authorship made available under
|
|
48
|
+
the License, as indicated by a copyright notice that is included in
|
|
49
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
50
|
+
|
|
51
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
52
|
+
form, that is based on (or derived from) the Work and for which the
|
|
53
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
54
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
55
|
+
of this License, Derivative Works shall not include works that remain
|
|
56
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
57
|
+
the Work and derivative works thereof.
|
|
58
|
+
|
|
59
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
60
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
61
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
62
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
63
|
+
or written communication sent to the Licensor or its representatives,
|
|
64
|
+
including but not limited to communication on electronic mailing lists,
|
|
65
|
+
source code control systems, and issue tracking systems that are managed
|
|
66
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
67
|
+
improving the Work, but excluding communication that is conspicuously
|
|
68
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
69
|
+
Contribution."
|
|
70
|
+
|
|
71
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
72
|
+
whom a Contribution has been received by the Licensor and included
|
|
73
|
+
within the Work.
|
|
74
|
+
|
|
75
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
79
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
80
|
+
Work and such Derivative Works in Source or Object form.
|
|
81
|
+
|
|
82
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
83
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
84
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
85
|
+
(except as stated in this section) patent license to make, have made,
|
|
86
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
87
|
+
where such license applies only to those patent claims licensable
|
|
88
|
+
by such Contributor that are necessarily infringed by their
|
|
89
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
90
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
91
|
+
institute patent litigation against any entity (including a cross-claim
|
|
92
|
+
or counterclaim in a lawsuit) alleging that the Work or any Contribution
|
|
93
|
+
incorporated within the Work constitutes direct or contributory patent
|
|
94
|
+
infringement, then any patent licenses granted to You under this License
|
|
95
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
96
|
+
|
|
97
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
98
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
99
|
+
modifications, and in Source or Object form, provided that You
|
|
100
|
+
meet the following conditions:
|
|
101
|
+
|
|
102
|
+
(a) You must give any other recipients of the Work or Derivative Works
|
|
103
|
+
a copy of this License; and
|
|
104
|
+
|
|
105
|
+
(b) You must cause any modified files to carry prominent notices
|
|
106
|
+
stating that You changed the files; and
|
|
107
|
+
|
|
108
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
109
|
+
that You distribute, all copyright, patent, trademark, and
|
|
110
|
+
attribution notices from the Source form of the Work,
|
|
111
|
+
excluding those notices that do not pertain to any part of
|
|
112
|
+
the Derivative Works; and
|
|
113
|
+
|
|
114
|
+
(d) If the Work includes a "NOTICE" text file, you must include a
|
|
115
|
+
readable copy of the attribution notices contained within such
|
|
116
|
+
NOTICE file, in at least one of the following places: within a
|
|
117
|
+
NOTICE text file distributed as part of the Derivative Works;
|
|
118
|
+
within the Source form or documentation, if provided along with
|
|
119
|
+
the Derivative Works; or, within a display generated by the
|
|
120
|
+
Derivative Works, if and wherever such third-party notices normally
|
|
121
|
+
appear. The contents of the NOTICE file are for informational
|
|
122
|
+
purposes only and do not modify the License. You may add Your own
|
|
123
|
+
attribution notices within Derivative Works that You distribute,
|
|
124
|
+
alongside or as an addendum to the NOTICE text from the Work,
|
|
125
|
+
provided that such additional attribution notices cannot be
|
|
126
|
+
construed as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own license statement for Your modifications and
|
|
129
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
130
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
131
|
+
Derivative Works, as separate terms and conditions for use,
|
|
132
|
+
reproduction, or distribution of Your modifications, or for such
|
|
133
|
+
Derivative Works as a whole.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or reproducing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or exemplary damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or all other
|
|
164
|
+
commercial damages or losses), even if such Contributor has been
|
|
165
|
+
advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
Copyright (c) SolarAssistant. All rights reserved.
|
|
179
|
+
|
|
180
|
+
Project-URL: Homepage, https://github.com/Solar-Assistant/py_solar_assistant
|
|
181
|
+
Project-URL: Repository, https://github.com/Solar-Assistant/py_solar_assistant
|
|
182
|
+
Project-URL: Issues, https://github.com/Solar-Assistant/py_solar_assistant/issues
|
|
183
|
+
Keywords: solar-assistant,solar,inverter,battery,homeassistant
|
|
184
|
+
Classifier: Development Status :: 4 - Beta
|
|
185
|
+
Classifier: Framework :: AsyncIO
|
|
186
|
+
Classifier: Intended Audience :: Developers
|
|
187
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
188
|
+
Classifier: Operating System :: OS Independent
|
|
189
|
+
Classifier: Programming Language :: Python :: 3
|
|
190
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
191
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
192
|
+
Classifier: Topic :: Home Automation
|
|
193
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
194
|
+
Requires-Python: >=3.12
|
|
195
|
+
Description-Content-Type: text/markdown
|
|
196
|
+
License-File: LICENSE
|
|
197
|
+
Requires-Dist: aiohttp>=3.9
|
|
198
|
+
Dynamic: license-file
|
|
199
|
+
|
|
200
|
+
# py_solar_assistant
|
|
201
|
+
|
|
202
|
+
Python client for SolarAssistant.
|
|
203
|
+
|
|
204
|
+
## Installation
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
pip install py_solar_assistant
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Requires Python 3.12+.
|
|
211
|
+
|
|
212
|
+
## Cloud API
|
|
213
|
+
|
|
214
|
+
Interact with the SolarAssistant cloud API. All endpoints require an API key — generate one at [solar-assistant.io/user/edit#api](https://solar-assistant.io/user/edit#api).
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
from py_solar_assistant import SolarAssistantClient, list_sites, authorize_site
|
|
218
|
+
|
|
219
|
+
async with SolarAssistantClient("<api_key>") as client:
|
|
220
|
+
sites = await list_sites(client)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### List sites
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
sites = await list_sites(client)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Filter by inverter, battery, name, and more:
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
sites = await list_sites(client, inverter="srne", limit=50, offset=20)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Common filters:
|
|
236
|
+
|
|
237
|
+
| Key | Example |
|
|
238
|
+
|-----|---------|
|
|
239
|
+
| `name` | `name="my-site"` |
|
|
240
|
+
| `inverter` | `inverter="srne"` |
|
|
241
|
+
| `battery` | `battery="daly"` |
|
|
242
|
+
| `inverter_params_output_power` | `inverter_params_output_power="5000"` |
|
|
243
|
+
| `last_seen_after` | `last_seen_after="2026-01-01"` |
|
|
244
|
+
| `build_date_after` | `build_date_after="2026-02-26"` |
|
|
245
|
+
| `limit` | `limit=50` |
|
|
246
|
+
| `offset` | `offset=20` |
|
|
247
|
+
|
|
248
|
+
### Authorize a site
|
|
249
|
+
|
|
250
|
+
Returns a short-lived token and connection details for a site. The token works for both cloud and local connections.
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
auth = await authorize_site(client, site_id)
|
|
254
|
+
# auth.host, auth.site_id, auth.site_key, auth.token, auth.local_ip
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Device — REST
|
|
260
|
+
|
|
261
|
+
Read and write metrics directly on a SolarAssistant unit via REST.
|
|
262
|
+
|
|
263
|
+
### Local connection
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
from py_solar_assistant import DeviceClient
|
|
267
|
+
|
|
268
|
+
async with DeviceClient("192.168.1.100", password="<web-password>") as c:
|
|
269
|
+
...
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Cloud-proxied connection
|
|
273
|
+
|
|
274
|
+
First obtain connection details via [authorize_site](#authorize-a-site):
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
async with DeviceClient(
|
|
278
|
+
auth.host,
|
|
279
|
+
token=auth.token,
|
|
280
|
+
site_id=auth.site_id,
|
|
281
|
+
site_key=auth.site_key,
|
|
282
|
+
scheme="https",
|
|
283
|
+
) as c:
|
|
284
|
+
...
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Read metrics
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
# All metrics
|
|
291
|
+
metrics = await c.get_metrics()
|
|
292
|
+
|
|
293
|
+
# Filtered by topic glob — multiple topics are fetched and deduplicated
|
|
294
|
+
metrics = await c.get_metrics("battery_1/*", "total/pv_power")
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Write a metric
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
await c.set_metric("inverter_1/charge_current_limit", "20")
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Standalone functions
|
|
304
|
+
|
|
305
|
+
For one-off calls without connection reuse:
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
from py_solar_assistant import get_device_metrics, set_metric
|
|
309
|
+
|
|
310
|
+
metrics = await get_device_metrics("192.168.1.100", password="<web-password>")
|
|
311
|
+
await set_metric("192.168.1.100", "inverter_1/charge_current_limit", "20", password="<web-password>")
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Device — WebSocket
|
|
317
|
+
|
|
318
|
+
Stream live metrics via WebSocket.
|
|
319
|
+
|
|
320
|
+
### Cloud connection
|
|
321
|
+
|
|
322
|
+
First obtain connection details via [authorize_site](#authorize-a-site):
|
|
323
|
+
|
|
324
|
+
```python
|
|
325
|
+
import asyncio
|
|
326
|
+
from py_solar_assistant import SolarAssistantClient, authorize_site, connect, Options
|
|
327
|
+
|
|
328
|
+
async def main():
|
|
329
|
+
async with SolarAssistantClient("<api_key>") as client:
|
|
330
|
+
auth = await authorize_site(client, site_id)
|
|
331
|
+
|
|
332
|
+
sock = await connect(Options(
|
|
333
|
+
host=auth.host,
|
|
334
|
+
token=auth.token,
|
|
335
|
+
site_id=auth.site_id,
|
|
336
|
+
site_key=auth.site_key,
|
|
337
|
+
local_ip=auth.local_ip, # if set, tries local network first and falls back to cloud
|
|
338
|
+
))
|
|
339
|
+
|
|
340
|
+
await sock.subscribe_metrics(
|
|
341
|
+
lambda m: print(f"{m.device}/{m.name} = {m.value} {m.unit}")
|
|
342
|
+
)
|
|
343
|
+
try:
|
|
344
|
+
await sock.listen() # blocks until disconnected
|
|
345
|
+
finally:
|
|
346
|
+
await sock.close()
|
|
347
|
+
|
|
348
|
+
asyncio.run(main())
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Direct local connection (no cloud)
|
|
352
|
+
|
|
353
|
+
Connect using the unit's web password, no cloud account required:
|
|
354
|
+
|
|
355
|
+
```python
|
|
356
|
+
sock = await connect(Options(
|
|
357
|
+
local_ip="192.168.1.100",
|
|
358
|
+
password="<web-password>",
|
|
359
|
+
))
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Topic filters
|
|
363
|
+
|
|
364
|
+
Subscribe to specific topics with optional server-side throttling:
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
from py_solar_assistant import TopicFilter
|
|
368
|
+
|
|
369
|
+
await sock.subscribe_metrics(
|
|
370
|
+
handler,
|
|
371
|
+
TopicFilter(topic="total/*"),
|
|
372
|
+
TopicFilter(topic="inverter_*/load_power"),
|
|
373
|
+
TopicFilter(topic="battery_*/voltage", max_frequency_s=10),
|
|
374
|
+
)
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
If no filters are passed the server applies a default set of common metrics:
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
total/*
|
|
381
|
+
battery_*/voltage
|
|
382
|
+
battery_*/state_of_charge
|
|
383
|
+
battery_*/power
|
|
384
|
+
battery_*/temperature
|
|
385
|
+
inverter_*/pv_power
|
|
386
|
+
inverter_*/load_power
|
|
387
|
+
inverter_*/grid_power
|
|
388
|
+
inverter_*/device_mode
|
|
389
|
+
inverter_*/temperature
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Only metrics in groups `Info`, `Status`, and `Settings` are sent.
|
|
393
|
+
|
|
394
|
+
### Write a setting
|
|
395
|
+
|
|
396
|
+
Send a setting change over the WebSocket and wait for the result:
|
|
397
|
+
|
|
398
|
+
```python
|
|
399
|
+
await sock.set_setting("inverter_1/power_mode", "Off grid with relay")
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Raises `ValueError` if the device rejects the value.
|
|
403
|
+
|
|
404
|
+
### Options
|
|
405
|
+
|
|
406
|
+
| Field | Type | Description |
|
|
407
|
+
|-------|------|-------------|
|
|
408
|
+
| `host` | `str` | Hostname or `host:port` of the cloud proxy. |
|
|
409
|
+
| `token` | `str` | JWT from `authorize_site`. Required for cloud and local-fallback connections. |
|
|
410
|
+
| `password` | `str` | Web password for direct local connections. |
|
|
411
|
+
| `site_id` | `int` | Required for cloud connections. |
|
|
412
|
+
| `site_key` | `str` | Required for cloud connections. |
|
|
413
|
+
| `local_ip` | `str` | If set, tries local network first and falls back to `host`. |
|
|
414
|
+
| `verbose` | `bool` | Log all WebSocket frames to stderr. |
|
|
415
|
+
|
|
416
|
+
### Advanced: raw channel messages
|
|
417
|
+
|
|
418
|
+
```python
|
|
419
|
+
sock.subscribe("*", "*", lambda msg: print(msg.topic, msg.event, msg.payload))
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Examples
|
|
423
|
+
|
|
424
|
+
Runnable scripts are in the [`examples/`](examples/) folder:
|
|
425
|
+
|
|
426
|
+
| Script | Description |
|
|
427
|
+
|--------|-------------|
|
|
428
|
+
| [`rest_read.py`](examples/rest_read.py) | Fetch all metrics once via REST and print them grouped by device |
|
|
429
|
+
| [`rest_set.py`](examples/rest_set.py) | Write a metric value via REST |
|
|
430
|
+
| [`websocket_read.py`](examples/websocket_read.py) | Stream live metrics via WebSocket until Ctrl+C |
|
|
431
|
+
| [`websocket_set.py`](examples/websocket_set.py) | Write a setting via WebSocket |
|
|
432
|
+
|
|
433
|
+
## License
|
|
434
|
+
|
|
435
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
436
|
+
|
|
437
|
+
This licence covers the Python client library in this repository only. The SolarAssistant platform — including the downloadable device software and cloud infrastructure — is proprietary and distributed under separate terms.
|