aiosolarfocus 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 (61) hide show
  1. aiosolarfocus-0.1.0/.gitignore +13 -0
  2. aiosolarfocus-0.1.0/LICENSE +201 -0
  3. aiosolarfocus-0.1.0/NOTICE +13 -0
  4. aiosolarfocus-0.1.0/PKG-INFO +180 -0
  5. aiosolarfocus-0.1.0/README.md +157 -0
  6. aiosolarfocus-0.1.0/docs/porting-from-pysolarfocus.md +118 -0
  7. aiosolarfocus-0.1.0/docs/protocol.md +63 -0
  8. aiosolarfocus-0.1.0/docs/registers.md +163 -0
  9. aiosolarfocus-0.1.0/pyproject.toml +132 -0
  10. aiosolarfocus-0.1.0/src/aiosolarfocus/__init__.py +96 -0
  11. aiosolarfocus-0.1.0/src/aiosolarfocus/__main__.py +437 -0
  12. aiosolarfocus-0.1.0/src/aiosolarfocus/client.py +213 -0
  13. aiosolarfocus-0.1.0/src/aiosolarfocus/codec.py +125 -0
  14. aiosolarfocus-0.1.0/src/aiosolarfocus/components/__init__.py +234 -0
  15. aiosolarfocus-0.1.0/src/aiosolarfocus/components/base.py +299 -0
  16. aiosolarfocus-0.1.0/src/aiosolarfocus/components/biomass_boiler.py +84 -0
  17. aiosolarfocus-0.1.0/src/aiosolarfocus/components/boiler.py +37 -0
  18. aiosolarfocus-0.1.0/src/aiosolarfocus/components/buffer.py +74 -0
  19. aiosolarfocus-0.1.0/src/aiosolarfocus/components/circulation.py +13 -0
  20. aiosolarfocus-0.1.0/src/aiosolarfocus/components/differential_module.py +17 -0
  21. aiosolarfocus-0.1.0/src/aiosolarfocus/components/fresh_water_module.py +32 -0
  22. aiosolarfocus-0.1.0/src/aiosolarfocus/components/heat_pump.py +112 -0
  23. aiosolarfocus-0.1.0/src/aiosolarfocus/components/heating_circuit.py +108 -0
  24. aiosolarfocus-0.1.0/src/aiosolarfocus/components/photovoltaic.py +50 -0
  25. aiosolarfocus-0.1.0/src/aiosolarfocus/components/solar.py +34 -0
  26. aiosolarfocus-0.1.0/src/aiosolarfocus/config.py +118 -0
  27. aiosolarfocus-0.1.0/src/aiosolarfocus/const.py +126 -0
  28. aiosolarfocus-0.1.0/src/aiosolarfocus/data/registers.csv +353 -0
  29. aiosolarfocus-0.1.0/src/aiosolarfocus/detect.py +400 -0
  30. aiosolarfocus-0.1.0/src/aiosolarfocus/enums.py +180 -0
  31. aiosolarfocus-0.1.0/src/aiosolarfocus/exceptions.py +94 -0
  32. aiosolarfocus-0.1.0/src/aiosolarfocus/layout.py +162 -0
  33. aiosolarfocus-0.1.0/src/aiosolarfocus/planner.py +144 -0
  34. aiosolarfocus-0.1.0/src/aiosolarfocus/py.typed +0 -0
  35. aiosolarfocus-0.1.0/src/aiosolarfocus/registers.py +342 -0
  36. aiosolarfocus-0.1.0/src/aiosolarfocus/sync.py +128 -0
  37. aiosolarfocus-0.1.0/src/aiosolarfocus/testing/__init__.py +12 -0
  38. aiosolarfocus-0.1.0/src/aiosolarfocus/testing/fake.py +161 -0
  39. aiosolarfocus-0.1.0/src/aiosolarfocus/testing/server.py +58 -0
  40. aiosolarfocus-0.1.0/src/aiosolarfocus/testing/spec.py +93 -0
  41. aiosolarfocus-0.1.0/src/aiosolarfocus/transport.py +228 -0
  42. aiosolarfocus-0.1.0/tests/__init__.py +0 -0
  43. aiosolarfocus-0.1.0/tests/conftest.py +74 -0
  44. aiosolarfocus-0.1.0/tests/test_cli.py +87 -0
  45. aiosolarfocus-0.1.0/tests/test_client.py +202 -0
  46. aiosolarfocus-0.1.0/tests/test_codec.py +99 -0
  47. aiosolarfocus-0.1.0/tests/test_config.py +92 -0
  48. aiosolarfocus-0.1.0/tests/test_const.py +49 -0
  49. aiosolarfocus-0.1.0/tests/test_derived.py +129 -0
  50. aiosolarfocus-0.1.0/tests/test_detect.py +211 -0
  51. aiosolarfocus-0.1.0/tests/test_enums.py +24 -0
  52. aiosolarfocus-0.1.0/tests/test_fake_controller.py +74 -0
  53. aiosolarfocus-0.1.0/tests/test_layout.py +121 -0
  54. aiosolarfocus-0.1.0/tests/test_package.py +8 -0
  55. aiosolarfocus-0.1.0/tests/test_planner.py +179 -0
  56. aiosolarfocus-0.1.0/tests/test_register_table.py +164 -0
  57. aiosolarfocus-0.1.0/tests/test_registers.py +153 -0
  58. aiosolarfocus-0.1.0/tests/test_setters.py +131 -0
  59. aiosolarfocus-0.1.0/tests/test_sync.py +81 -0
  60. aiosolarfocus-0.1.0/tests/test_system_specific_registers.py +177 -0
  61. aiosolarfocus-0.1.0/tests/test_transport.py +214 -0
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ .coverage
11
+ htmlcov/
12
+ coverage.xml
13
+ .DS_Store
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
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
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,13 @@
1
+ aiosolarfocus
2
+ Copyright 2026 Jeroen Laverman
3
+
4
+ Portions of this work are derived from pysolarfocus
5
+ (https://github.com/lavermanjj/pysolarfocus), Copyright Jeroen Laverman,
6
+ licensed under the Apache License, Version 2.0. In particular the Modbus
7
+ register map, the component base addressing, and the recorded behaviour of the
8
+ Solarfocus eco manager-touch controller originate there.
9
+
10
+ This product is not affiliated with, endorsed by, or supported by
11
+ Solarfocus GmbH. "Solarfocus", "eco manager-touch", "vampair", "therminator",
12
+ "ecotop", "octoplus" and "Pellet Elegance" are trademarks of their respective
13
+ owners.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.5
2
+ Name: aiosolarfocus
3
+ Version: 0.1.0
4
+ Summary: Async Python client for Solarfocus eco manager-touch heating systems
5
+ Project-URL: Homepage, https://github.com/lavermanjj/aiosolarfocus
6
+ Project-URL: Repository, https://github.com/lavermanjj/aiosolarfocus
7
+ Project-URL: Issues, https://github.com/lavermanjj/aiosolarfocus/issues
8
+ Author-email: Jeroen Laverman <jjlaverman@web.de>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: asyncio,heat pump,heating,home assistant,modbus,solarfocus
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Home Automation
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.13
21
+ Requires-Dist: pymodbus<4,>=3.10
22
+ Description-Content-Type: text/markdown
23
+
24
+ # aiosolarfocus
25
+
26
+ Async Python client for [Solarfocus](https://www.solarfocus.com) **eco<sup>manager-touch</sup>**
27
+ heating systems, over Modbus TCP.
28
+
29
+ > [!WARNING]
30
+ > Unofficial, and developed without support from Solarfocus. Writing to a
31
+ > heating system can damage the system or the building. Check with Solarfocus or
32
+ > your installer before changing anything you do not understand.
33
+
34
+ ## Install
35
+
36
+ ```sh
37
+ pip install aiosolarfocus
38
+ ```
39
+
40
+ ## Read
41
+
42
+ ```python
43
+ import asyncio
44
+
45
+ from aiosolarfocus import ApiVersion, SolarfocusClient, SolarfocusConfig, Systems
46
+
47
+
48
+ async def main() -> None:
49
+ config = SolarfocusConfig(
50
+ host="10.0.0.5",
51
+ system=Systems.VAMPAIR,
52
+ api_version=ApiVersion.V_26_020,
53
+ heating_circuits=1,
54
+ buffers=1,
55
+ boilers=1,
56
+ )
57
+ async with SolarfocusClient(config) as client:
58
+ result = await client.update()
59
+
60
+ print(client.heat_pump.supply_temperature) # float | None
61
+ print(client.heating_circuits[0].mode) # HeatingCircuitMode | None
62
+ print(client.heat_pump.cop_heating) # float | None
63
+
64
+ if not result.ok:
65
+ print("not read:", *result.failed)
66
+
67
+
68
+ asyncio.run(main())
69
+ ```
70
+
71
+ Reading a value is not asynchronous — it is the last reading, already decoded.
72
+ Only the calls that talk to the controller are awaited.
73
+
74
+ `None` means one of three things, and callers almost always want the same
75
+ behaviour for all of them: this firmware or system does not have the register,
76
+ it has not been read yet or its last read failed, or the channel is reporting
77
+ one of the values an open sensor gives instead of a measurement.
78
+ `component.raw()` and `component.info()` tell them apart.
79
+
80
+ Values the library works out from registers — the heat pump's coefficients of
81
+ performance, its seasonal figures — are declared beside the registers they come
82
+ from, so `component.available_values()` offers them alongside everything else
83
+ and `component.info()` describes them. An idle heat pump reports `None` for a
84
+ coefficient of performance rather than zero.
85
+
86
+ ## Write
87
+
88
+ ```python
89
+ from aiosolarfocus import HeatingCircuitMode
90
+
91
+ await client.heating_circuits[0].set_mode(HeatingCircuitMode.AUTOMATIC)
92
+ await client.heating_circuits[0].set_target_supply_temperature(45.0)
93
+ await client.photovoltaic.set_smart_meter(-1500) # the library does the two's complement
94
+
95
+ # Registers the controller wants written together go out together.
96
+ await client.heating_circuits[0].set_operating_state(
97
+ mode=HeatingCircuitMode.AUTOMATIC,
98
+ target_supply_temperature=18.0,
99
+ )
100
+ ```
101
+
102
+ A successful write updates the component's own cache, so the new value is
103
+ readable straight away without re-reading anything.
104
+
105
+ ## Errors
106
+
107
+ `update()` raises only when the connection itself is the problem, because that
108
+ is the one failure that says nothing about any particular component. Everything
109
+ else — a range this firmware refuses, a controller answering an exception — is
110
+ attributed to the components whose registers were in that read:
111
+
112
+ ```python
113
+ try:
114
+ result = await client.update()
115
+ except SolarfocusConnectionError:
116
+ ... # the whole controller is unreachable
117
+ for key, error in result.failed.items():
118
+ ... # just these components went quiet
119
+ ```
120
+
121
+ ## Without asyncio
122
+
123
+ ```python
124
+ from aiosolarfocus import SolarfocusConfig, SolarfocusSync
125
+
126
+ with SolarfocusSync(SolarfocusConfig(host="10.0.0.5")) as sync:
127
+ sync.update()
128
+ print(sync.client.heat_pump.supply_temperature)
129
+ ```
130
+
131
+ ## Command line
132
+
133
+ ```sh
134
+ python -m aiosolarfocus detect --host 10.0.0.5 --evidence
135
+ python -m aiosolarfocus dump --host 10.0.0.5
136
+ python -m aiosolarfocus watch --host 10.0.0.5 --interval 10 # prints only what changed
137
+ python -m aiosolarfocus set --host 10.0.0.5 heating_circuits.1.mode automatic
138
+
139
+ python -m aiosolarfocus registers --system Vampair --api-version 26.020 # no controller needed
140
+ python -m aiosolarfocus plan --system Vampair --api-version 26.020 # no controller needed
141
+ ```
142
+
143
+ ## Supported
144
+
145
+ Systems: vampair, therminator, ecotop, Pellet Elegance, octoplus.
146
+ Firmware: 20.110 through 26.020. Give the version the controller prints on its
147
+ own screen; a newer one clamps to the newest this library knows.
148
+
149
+ Only the vampair has been tested against real hardware. The other four are
150
+ reasoned from the register specification — a
151
+ [register dump](CONTRIBUTING.md#producing-a-register-dump) from one of them is
152
+ the most useful thing you can contribute.
153
+
154
+ ## Documentation
155
+
156
+ - [`docs/registers.md`](docs/registers.md) — the register map, generated from the tables.
157
+ - [`docs/protocol.md`](docs/protocol.md) — how the controller actually behaves, including the ways it misbehaves.
158
+ - [`docs/porting-from-pysolarfocus.md`](docs/porting-from-pysolarfocus.md) — coming from the synchronous library.
159
+
160
+ ## Testing against it
161
+
162
+ `aiosolarfocus.testing` ships in the wheel, so a downstream test suite can drive
163
+ a real client against a fake controller that reproduces the real one's
164
+ behaviour — including refusing unmapped addresses and compacting reads that span
165
+ a gap.
166
+
167
+ ```python
168
+ from aiosolarfocus.testing import FakeController
169
+
170
+ config = SolarfocusConfig(host="test")
171
+ client = SolarfocusClient(config, transport=FakeController.for_config(config))
172
+ ```
173
+
174
+ ## About
175
+
176
+ Successor to [pysolarfocus](https://github.com/lavermanjj/pysolarfocus),
177
+ rewritten async-native with the register map as validated data. Portions of this
178
+ work derive from that project; see [`NOTICE`](NOTICE).
179
+
180
+ Not affiliated with, endorsed by, or supported by Solarfocus GmbH.
@@ -0,0 +1,157 @@
1
+ # aiosolarfocus
2
+
3
+ Async Python client for [Solarfocus](https://www.solarfocus.com) **eco<sup>manager-touch</sup>**
4
+ heating systems, over Modbus TCP.
5
+
6
+ > [!WARNING]
7
+ > Unofficial, and developed without support from Solarfocus. Writing to a
8
+ > heating system can damage the system or the building. Check with Solarfocus or
9
+ > your installer before changing anything you do not understand.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ pip install aiosolarfocus
15
+ ```
16
+
17
+ ## Read
18
+
19
+ ```python
20
+ import asyncio
21
+
22
+ from aiosolarfocus import ApiVersion, SolarfocusClient, SolarfocusConfig, Systems
23
+
24
+
25
+ async def main() -> None:
26
+ config = SolarfocusConfig(
27
+ host="10.0.0.5",
28
+ system=Systems.VAMPAIR,
29
+ api_version=ApiVersion.V_26_020,
30
+ heating_circuits=1,
31
+ buffers=1,
32
+ boilers=1,
33
+ )
34
+ async with SolarfocusClient(config) as client:
35
+ result = await client.update()
36
+
37
+ print(client.heat_pump.supply_temperature) # float | None
38
+ print(client.heating_circuits[0].mode) # HeatingCircuitMode | None
39
+ print(client.heat_pump.cop_heating) # float | None
40
+
41
+ if not result.ok:
42
+ print("not read:", *result.failed)
43
+
44
+
45
+ asyncio.run(main())
46
+ ```
47
+
48
+ Reading a value is not asynchronous — it is the last reading, already decoded.
49
+ Only the calls that talk to the controller are awaited.
50
+
51
+ `None` means one of three things, and callers almost always want the same
52
+ behaviour for all of them: this firmware or system does not have the register,
53
+ it has not been read yet or its last read failed, or the channel is reporting
54
+ one of the values an open sensor gives instead of a measurement.
55
+ `component.raw()` and `component.info()` tell them apart.
56
+
57
+ Values the library works out from registers — the heat pump's coefficients of
58
+ performance, its seasonal figures — are declared beside the registers they come
59
+ from, so `component.available_values()` offers them alongside everything else
60
+ and `component.info()` describes them. An idle heat pump reports `None` for a
61
+ coefficient of performance rather than zero.
62
+
63
+ ## Write
64
+
65
+ ```python
66
+ from aiosolarfocus import HeatingCircuitMode
67
+
68
+ await client.heating_circuits[0].set_mode(HeatingCircuitMode.AUTOMATIC)
69
+ await client.heating_circuits[0].set_target_supply_temperature(45.0)
70
+ await client.photovoltaic.set_smart_meter(-1500) # the library does the two's complement
71
+
72
+ # Registers the controller wants written together go out together.
73
+ await client.heating_circuits[0].set_operating_state(
74
+ mode=HeatingCircuitMode.AUTOMATIC,
75
+ target_supply_temperature=18.0,
76
+ )
77
+ ```
78
+
79
+ A successful write updates the component's own cache, so the new value is
80
+ readable straight away without re-reading anything.
81
+
82
+ ## Errors
83
+
84
+ `update()` raises only when the connection itself is the problem, because that
85
+ is the one failure that says nothing about any particular component. Everything
86
+ else — a range this firmware refuses, a controller answering an exception — is
87
+ attributed to the components whose registers were in that read:
88
+
89
+ ```python
90
+ try:
91
+ result = await client.update()
92
+ except SolarfocusConnectionError:
93
+ ... # the whole controller is unreachable
94
+ for key, error in result.failed.items():
95
+ ... # just these components went quiet
96
+ ```
97
+
98
+ ## Without asyncio
99
+
100
+ ```python
101
+ from aiosolarfocus import SolarfocusConfig, SolarfocusSync
102
+
103
+ with SolarfocusSync(SolarfocusConfig(host="10.0.0.5")) as sync:
104
+ sync.update()
105
+ print(sync.client.heat_pump.supply_temperature)
106
+ ```
107
+
108
+ ## Command line
109
+
110
+ ```sh
111
+ python -m aiosolarfocus detect --host 10.0.0.5 --evidence
112
+ python -m aiosolarfocus dump --host 10.0.0.5
113
+ python -m aiosolarfocus watch --host 10.0.0.5 --interval 10 # prints only what changed
114
+ python -m aiosolarfocus set --host 10.0.0.5 heating_circuits.1.mode automatic
115
+
116
+ python -m aiosolarfocus registers --system Vampair --api-version 26.020 # no controller needed
117
+ python -m aiosolarfocus plan --system Vampair --api-version 26.020 # no controller needed
118
+ ```
119
+
120
+ ## Supported
121
+
122
+ Systems: vampair, therminator, ecotop, Pellet Elegance, octoplus.
123
+ Firmware: 20.110 through 26.020. Give the version the controller prints on its
124
+ own screen; a newer one clamps to the newest this library knows.
125
+
126
+ Only the vampair has been tested against real hardware. The other four are
127
+ reasoned from the register specification — a
128
+ [register dump](CONTRIBUTING.md#producing-a-register-dump) from one of them is
129
+ the most useful thing you can contribute.
130
+
131
+ ## Documentation
132
+
133
+ - [`docs/registers.md`](docs/registers.md) — the register map, generated from the tables.
134
+ - [`docs/protocol.md`](docs/protocol.md) — how the controller actually behaves, including the ways it misbehaves.
135
+ - [`docs/porting-from-pysolarfocus.md`](docs/porting-from-pysolarfocus.md) — coming from the synchronous library.
136
+
137
+ ## Testing against it
138
+
139
+ `aiosolarfocus.testing` ships in the wheel, so a downstream test suite can drive
140
+ a real client against a fake controller that reproduces the real one's
141
+ behaviour — including refusing unmapped addresses and compacting reads that span
142
+ a gap.
143
+
144
+ ```python
145
+ from aiosolarfocus.testing import FakeController
146
+
147
+ config = SolarfocusConfig(host="test")
148
+ client = SolarfocusClient(config, transport=FakeController.for_config(config))
149
+ ```
150
+
151
+ ## About
152
+
153
+ Successor to [pysolarfocus](https://github.com/lavermanjj/pysolarfocus),
154
+ rewritten async-native with the register map as validated data. Portions of this
155
+ work derive from that project; see [`NOTICE`](NOTICE).
156
+
157
+ Not affiliated with, endorsed by, or supported by Solarfocus GmbH.
@@ -0,0 +1,118 @@
1
+ # Porting from pysolarfocus
2
+
3
+ `aiosolarfocus` is not a drop-in replacement. The value API is deliberately
4
+ different; this is what maps to what.
5
+
6
+ ## Reading
7
+
8
+ | pysolarfocus | aiosolarfocus |
9
+ |---|---|
10
+ | `api.heating_circuits[0].supply_temperature.scaled_value` | `client.heating_circuits[0].supply_temperature` |
11
+ | `api.heatpump` | `client.heat_pump` |
12
+ | `api.biomassboiler` | `client.biomass_boiler` |
13
+ | `getattr(component, key).scaled_value` | `component.value_of(Register)` or plain attribute access |
14
+ | `getattr(component, key).value` | `component.raw(Register)` |
15
+ | `{n: p.scaled_value for n, p in vars(component).items() if isinstance(p, Part)}` | `component.snapshot()` or `client.snapshot()` |
16
+ | `api.update()` → `bool` | `await client.update()` → `UpdateResult`, raising on connection failure |
17
+ | `api.update_heating()` | `await client.update(components=[ComponentId.HEATING_CIRCUITS])` |
18
+ | `api.is_connected` | `client.connected` |
19
+ | `api.api_version.greater_or_equal("22.090")` | `config.api_version >= ApiVersion.V_22_090` |
20
+ | `heatpump.performance_overall` | `heat_pump.seasonal_performance` |
21
+ | `heatpump.performance_overall_heating` | `heat_pump.seasonal_performance_heating` |
22
+ | `heatpump.performance_overall_drinking_water` | `heat_pump.seasonal_performance_drinking_water` |
23
+
24
+ The heat pump's derived figures kept their meaning and changed their names: a
25
+ "performance overall" that is a seasonal figure reads better as one. They are
26
+ rounded to two decimals — `pysolarfocus` reported `3.7369392844083906`.
27
+
28
+ They are still first-class. In `pysolarfocus` they were `PerformanceCalculator`
29
+ objects, indistinguishable from registers to anything reading the component;
30
+ here they are declared with `@derived` beside the registers they are worked out
31
+ from, and they appear in `component.available_values()`, `component.info()`,
32
+ `component.supports()`, `component.snapshot()` and the command line's
33
+ `registers` and `dump` output.
34
+
35
+ **Build entities from `available_values()`, not `available_registers()`.** The
36
+ latter is registers only, and would drop all five coefficients of performance —
37
+ which the Home Assistant integration has a sensor for apiece.
38
+
39
+ ## Writing
40
+
41
+ ```python
42
+ # pysolarfocus
43
+ value = api.heating_circuits[0].mode
44
+ value.set_unscaled_value(HeatingCircuitMode.AUTOMATIC)
45
+ value.commit()
46
+ component.update() # to see the change
47
+
48
+ # aiosolarfocus
49
+ await client.heating_circuits[0].set_mode(HeatingCircuitMode.AUTOMATIC)
50
+ ```
51
+
52
+ The re-read is gone: a successful write updates the component's own cache, so
53
+ the value is readable immediately.
54
+
55
+ `SolarfocusAPI.set_heating_circuit_mode(index, mode)` and its siblings have no
56
+ equivalent, because the integration that was meant to use them never called one.
57
+ The setters live on the component.
58
+
59
+ ## What the library now does that the caller used to
60
+
61
+ - **Two's complement.** `await pv.set_smart_meter(-1500)` puts `0xFA24` on the
62
+ wire. The caller no longer needs to know the register is signed.
63
+ - **Version and system gating.** `component.available_registers()` is exactly
64
+ what this controller has, so a consumer need not carry a
65
+ `min_required_version` and an `unsupported_systems` list per entity.
66
+ - **Bounds, step and unit.** `component.info(Register)` reports them, instead of
67
+ each consumer copying them out of the register document.
68
+ - **Sentinel readings.** An open sensor channel decodes to `None` rather than
69
+ 130.0 °C.
70
+ - **Rounding.** A reading is rounded to the precision its scale carries.
71
+ `304 * 0.1` is `30.400000000000002` in binary floating point, and the old
72
+ library passed that through for Home Assistant to record.
73
+
74
+ ## Semantic changes to watch for
75
+
76
+ - **Scaling runs one direction only**: engineering value = raw × scale.
77
+ `pysolarfocus` multiplied for input registers and divided for holding ones.
78
+ Values agree; the declaration does not.
79
+ - **`None` is a real answer.** It means the register is absent on this firmware
80
+ or system, has not been read, or is reporting an open channel. `raw()` and
81
+ `info()` tell those apart.
82
+ - **Errors raise.** `SolarfocusConnectionError` for the connection;
83
+ everything else lands in `UpdateResult.failed`, per component.
84
+ - **Enumerations decode to `IntEnum` members** for closed sets like `mode`, and
85
+ stay `int` for open ones like `state`, where firmware keeps adding codes.
86
+
87
+ ## Bugs fixed rather than carried over
88
+
89
+ - The fresh water module cascade and the circulation module were never built by
90
+ `ComponentManager`, so `update_fresh_water_module_cascade()` raised
91
+ `AttributeError` on every controller running 23.040 or newer.
92
+ - `TherminatorHeatingCircuit.__init__` dropped `api_version`, so those systems
93
+ resolved every register against a default version — which on 21.140 declared
94
+ `heating_mode` at 32608, a register that firmware does not have, and so
95
+ shifted the three registers before it (see `protocol.md`).
96
+ - `PerformanceCalculator` returned `0.0` when the denominator was zero, so an
97
+ idle heat pump reported a coefficient of performance of zero all night. Now
98
+ `None`.
99
+ - A single failing read failed a whole component; and a failing instance of a
100
+ multi-instance component hid the ones after it.
101
+ - Negative writes were the caller's problem.
102
+ - **Registers belonging to one system were read on all of them.** `2409`
103
+ (Kesselbetriebsart, therminator), `2411` (Speichertemperatur oben, octoplus),
104
+ `2412` (Stückholz, therminator) and buffer `1902` (X35, therminator) were read
105
+ on systems the document does not give them to. A Pellet Elegance maps neither
106
+ `2409` nor `2413`, so the boiler read spanned them and came back compacted:
107
+ the return flow temperature reported 270.0 °C where the sensor said 22.1 °C,
108
+ and the buffer's pump reported the status register. See
109
+ home-assistant-solarfocus issue #217. A test now holds every register against
110
+ the system the document names in its own description.
111
+
112
+ ## Deliberately *not* changed
113
+
114
+ `TherminatorBuffer` never read the external X44/X36/X35 holding registers. That
115
+ looked like the same class of bug, but the Home Assistant integration
116
+ independently marks those three entities `unsupported_systems=[THERMINATOR,
117
+ ECOTOP]`. Two sources agreeing was enough to carry the behaviour over rather
118
+ than "fix" it against hardware nobody could test. See `Buffer._external`.