connbox 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.
connbox-0.1.0/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
connbox-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.3
2
+ Name: connbox
3
+ Version: 0.1.0
4
+ Summary: This is a service to connect and interact with a connbox for Pellet stoves (Palazzetti, Jotul)
5
+ Keywords: pellet,stove,connbox,palazzetti,jotul,fumis,iot
6
+ Author: Sylvain Daclin
7
+ License: GNU LESSER GENERAL PUBLIC LICENSE
8
+ Version 3, 29 June 2007
9
+
10
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
11
+ Everyone is permitted to copy and distribute verbatim copies
12
+ of this license document, but changing it is not allowed.
13
+
14
+
15
+ This version of the GNU Lesser General Public License incorporates
16
+ the terms and conditions of version 3 of the GNU General Public
17
+ License, supplemented by the additional permissions listed below.
18
+
19
+ 0. Additional Definitions.
20
+
21
+ As used herein, "this License" refers to version 3 of the GNU Lesser
22
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
23
+ General Public License.
24
+
25
+ "The Library" refers to a covered work governed by this License,
26
+ other than an Application or a Combined Work as defined below.
27
+
28
+ An "Application" is any work that makes use of an interface provided
29
+ by the Library, but which is not otherwise based on the Library.
30
+ Defining a subclass of a class defined by the Library is deemed a mode
31
+ of using an interface provided by the Library.
32
+
33
+ A "Combined Work" is a work produced by combining or linking an
34
+ Application with the Library. The particular version of the Library
35
+ with which the Combined Work was made is also called the "Linked
36
+ Version".
37
+
38
+ The "Minimal Corresponding Source" for a Combined Work means the
39
+ Corresponding Source for the Combined Work, excluding any source code
40
+ for portions of the Combined Work that, considered in isolation, are
41
+ based on the Application, and not on the Linked Version.
42
+
43
+ The "Corresponding Application Code" for a Combined Work means the
44
+ object code and/or source code for the Application, including any data
45
+ and utility programs needed for reproducing the Combined Work from the
46
+ Application, but excluding the System Libraries of the Combined Work.
47
+
48
+ 1. Exception to Section 3 of the GNU GPL.
49
+
50
+ You may convey a covered work under sections 3 and 4 of this License
51
+ without being bound by section 3 of the GNU GPL.
52
+
53
+ 2. Conveying Modified Versions.
54
+
55
+ If you modify a copy of the Library, and, in your modifications, a
56
+ facility refers to a function or data to be supplied by an Application
57
+ that uses the facility (other than as an argument passed when the
58
+ facility is invoked), then you may convey a copy of the modified
59
+ version:
60
+
61
+ a) under this License, provided that you make a good faith effort to
62
+ ensure that, in the event an Application does not supply the
63
+ function or data, the facility still operates, and performs
64
+ whatever part of its purpose remains meaningful, or
65
+
66
+ b) under the GNU GPL, with none of the additional permissions of
67
+ this License applicable to that copy.
68
+
69
+ 3. Object Code Incorporating Material from Library Header Files.
70
+
71
+ The object code form of an Application may incorporate material from
72
+ a header file that is part of the Library. You may convey such object
73
+ code under terms of your choice, provided that, if the incorporated
74
+ material is not limited to numerical parameters, data structure
75
+ layouts and accessors, or small macros, inline functions and templates
76
+ (ten or fewer lines in length), you do both of the following:
77
+
78
+ a) Give prominent notice with each copy of the object code that the
79
+ Library is used in it and that the Library and its use are
80
+ covered by this License.
81
+
82
+ b) Accompany the object code with a copy of the GNU GPL and this license
83
+ document.
84
+
85
+ 4. Combined Works.
86
+
87
+ You may convey a Combined Work under terms of your choice that,
88
+ taken together, effectively do not restrict modification of the
89
+ portions of the Library contained in the Combined Work and reverse
90
+ engineering for debugging such modifications, if you also do each of
91
+ the following:
92
+
93
+ a) Give prominent notice with each copy of the Combined Work that
94
+ the Library is used in it and that the Library and its use are
95
+ covered by this License.
96
+
97
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
98
+ document.
99
+
100
+ c) For a Combined Work that displays copyright notices during
101
+ execution, include the copyright notice for the Library among
102
+ these notices, as well as a reference directing the user to the
103
+ copies of the GNU GPL and this license document.
104
+
105
+ d) Do one of the following:
106
+
107
+ 0) Convey the Minimal Corresponding Source under the terms of this
108
+ License, and the Corresponding Application Code in a form
109
+ suitable for, and under terms that permit, the user to
110
+ recombine or relink the Application with a modified version of
111
+ the Linked Version to produce a modified Combined Work, in the
112
+ manner specified by section 6 of the GNU GPL for conveying
113
+ Corresponding Source.
114
+
115
+ 1) Use a suitable shared library mechanism for linking with the
116
+ Library. A suitable mechanism is one that (a) uses at run time
117
+ a copy of the Library already present on the user's computer
118
+ system, and (b) will operate properly with a modified version
119
+ of the Library that is interface-compatible with the Linked
120
+ Version.
121
+
122
+ e) Provide Installation Information, but only if you would otherwise
123
+ be required to provide such information under section 6 of the
124
+ GNU GPL, and only to the extent that such information is
125
+ necessary to install and execute a modified version of the
126
+ Combined Work produced by recombining or relinking the
127
+ Application with a modified version of the Linked Version. (If
128
+ you use option 4d0, the Installation Information must accompany
129
+ the Minimal Corresponding Source and Corresponding Application
130
+ Code. If you use option 4d1, you must provide the Installation
131
+ Information in the manner specified by section 6 of the GNU GPL
132
+ for conveying Corresponding Source.)
133
+
134
+ 5. Combined Libraries.
135
+
136
+ You may place library facilities that are a work based on the
137
+ Library side by side in a single library together with other library
138
+ facilities that are not Applications and are not covered by this
139
+ License, and convey such a combined library under terms of your
140
+ choice, if you do both of the following:
141
+
142
+ a) Accompany the combined library with a copy of the same work based
143
+ on the Library, uncombined with any other library facilities,
144
+ conveyed under the terms of this License.
145
+
146
+ b) Give prominent notice with the combined library that part of it
147
+ is a work based on the Library, and explaining where to find the
148
+ accompanying uncombined form of the same work.
149
+
150
+ 6. Revised Versions of the GNU Lesser General Public License.
151
+
152
+ The Free Software Foundation may publish revised and/or new versions
153
+ of the GNU Lesser General Public License from time to time. Such new
154
+ versions will be similar in spirit to the present version, but may
155
+ differ in detail to address new problems or concerns.
156
+
157
+ Each version is given a distinguishing version number. If the
158
+ Library as you received it specifies that a certain numbered version
159
+ of the GNU Lesser General Public License "or any later version"
160
+ applies to it, you have the option of following the terms and
161
+ conditions either of that published version or of any later version
162
+ published by the Free Software Foundation. If the Library as you
163
+ received it does not specify a version number of the GNU Lesser
164
+ General Public License, you may choose any version of the GNU Lesser
165
+ General Public License ever published by the Free Software Foundation.
166
+
167
+ If the Library as you received it specifies that a proxy can decide
168
+ whether future versions of the GNU Lesser General Public License shall
169
+ apply, that proxy's public statement of acceptance of any version is
170
+ permanent authorization for you to choose that version for the
171
+ Library.
172
+ Classifier: Intended Audience :: Developers
173
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
174
+ Classifier: Programming Language :: Python :: 3
175
+ Classifier: Programming Language :: Python :: 3.13
176
+ Classifier: Topic :: Home Automation
177
+ Requires-Python: >=3.13
178
+ Description-Content-Type: text/markdown
179
+
180
+ ![CI](https://github.com/sdaclin/cbox/actions/workflows/ci.yml/badge.svg?event=push)
181
+
182
+ # Cbox
183
+
184
+ This project provides an API to interact through http with a `Connection Box` (a.k.a `connBox` or `cBox`) available in your LAN
185
+
186
+ :bulb: I can't manage to find direct documentation from the connbox manufacturer but basically if you have a stove with a [Fumis Controller](https://fumis.si/en/about-fumis/fumis-combustion-controllers/fumis-alpha) then you can install a `cBox` on it and this project is for you.
187
+
188
+ <p align="center">
189
+ <img src="doc/image/cbox.jpg" alt="cBox"/>
190
+ </p>
191
+ <p align="center">
192
+ <img src="doc/image/fumis-alpha.png" alt="fumis-alpha control panel" width=400px/>
193
+ </p>
194
+
195
+ ## How to
196
+
197
+ Check your python installation, `python 3.13.+` is required
198
+
199
+ ```sh
200
+ python --version
201
+ ```
202
+
203
+ Start playing around => check [workbench for local dev](workbench_for_local_dev.py)
204
+
205
+ ```python
206
+ async with Cbox.connected_to(host) as cbox:
207
+ # Fetch current cbox info
208
+ print(await cbox.fetch_info())
209
+
210
+ # Change cbox settings
211
+ await cbox.change_status(Cbox.Status.OFF)
212
+ await cbox.change_fan_setpoint(FanStatus.AUTO)
213
+ await cbox.change_temperature_setpoint(19)
214
+ await cbox.change_power_setpoint(4)
215
+
216
+ # Fetch changed cbox info
217
+ print(await cbox.fetch_info())
218
+ ```
219
+
220
+ Here is the output
221
+
222
+ ```json
223
+ DEBUG:cbox.connbox:Fetch infos
224
+ {"timestamp": "2024-10-20 09:41:59", "globalStatus": "CHIMNEY_ALARM", "fanSetpoint": "SPEED_1", "powerSetpoint": 1, "temperatureSetpoint": 23, "temperature1": 18.2, "temperature2": 0, "temperature3": 27, "temperature4": 0, "temperature5": 19, "firmwareDate": "2023-07-26", "firmwareVersion": 48}
225
+ DEBUG:cbox.connbox:Change status => off
226
+ DEBUG:cbox.connbox:Change fan setpoint AUTO
227
+ DEBUG:cbox.connbox:Change temperature setpoint => 19
228
+ DEBUG:cbox.connbox:Change power setpoing => 4
229
+ DEBUG:cbox.connbox:Fetch infos
230
+ {"timestamp": "2024-10-20 09:42:03", "globalStatus": "OFF", "fanSetpoint": "AUTO", "powerSetpoint": 4, "temperatureSetpoint": 19, "temperature1": 18.2, "temperature2": 0, "temperature3": 27, "temperature4": 0, "temperature5": 19, "firmwareDate": "2023-07-26", "firmwareVersion": 48}
231
+ ```
232
+
233
+ ## Resources
234
+
235
+ ### Connbox related
236
+
237
+ [Connbox Jotul PDF](https://www.jotul.fr/sites/french/files/products/MANUAL_PELLET_CONNEXION_BOX_FR_DE_NL_ES_EN_IT_PL_P02.pdf)
238
+
239
+ [Connbox Palazzetti](https://www.palazzetti-boutique-lyon.fr/nouveautes/la-nouvelle-connection-box-palazzetti/)
240
+
241
+ [Application Jotul android Pellet control](https://www.jotul.fr/sites/french/files/products/MANUAL_PELLET_CONNEXION_BOX_FR_DE_NL_ES_EN_IT_PL_P02.pdf)
242
+
243
+ ### Fumis related
244
+
245
+ [Fumis Controller](https://fumis.si/en/about-fumis/fumis-combustion-controllers/fumis-alpha)
246
+
247
+ This controller is integrated by this non exhaustive list of brands :
248
+
249
+ * Palazzetti / Jotul / TurboFonte / Godin / Fonte Flamme / Invicta / Casatelli / Alpis / Faizen / HETA / ...
250
+
251
+ If you have this can of controller then you can install a connbox and use this project.
252
+
253
+ ## Alternatives
254
+
255
+ [WirelessPalaControl](https://github.com/Domochip/WirelessPalaControl)
256
+
257
+ * Based on a custom connection hardware (no connbox here)
258
+ * Written in C++
259
+ * Grade A integration with HomeAssistant
260
+ * MQTT support
261
+
262
+ [hass-Palazzetti](https://github.com/Vost3/hass-palazzetti)
263
+
264
+ * All in one HomeAssistant integration
265
+ * Written in Python
266
+ * Grade B integration with HomeAssistant
267
+ * It exposes a custom service and is not fully integratd as a Climate Entity
268
+
269
+ ## Developer's corner
270
+
271
+ * [How to contribute](DEVELOPMENT.md)
272
+ * [About Connbox protocol](doc/cboxProtcol.md)
@@ -0,0 +1,93 @@
1
+ ![CI](https://github.com/sdaclin/cbox/actions/workflows/ci.yml/badge.svg?event=push)
2
+
3
+ # Cbox
4
+
5
+ This project provides an API to interact through http with a `Connection Box` (a.k.a `connBox` or `cBox`) available in your LAN
6
+
7
+ :bulb: I can't manage to find direct documentation from the connbox manufacturer but basically if you have a stove with a [Fumis Controller](https://fumis.si/en/about-fumis/fumis-combustion-controllers/fumis-alpha) then you can install a `cBox` on it and this project is for you.
8
+
9
+ <p align="center">
10
+ <img src="doc/image/cbox.jpg" alt="cBox"/>
11
+ </p>
12
+ <p align="center">
13
+ <img src="doc/image/fumis-alpha.png" alt="fumis-alpha control panel" width=400px/>
14
+ </p>
15
+
16
+ ## How to
17
+
18
+ Check your python installation, `python 3.13.+` is required
19
+
20
+ ```sh
21
+ python --version
22
+ ```
23
+
24
+ Start playing around => check [workbench for local dev](workbench_for_local_dev.py)
25
+
26
+ ```python
27
+ async with Cbox.connected_to(host) as cbox:
28
+ # Fetch current cbox info
29
+ print(await cbox.fetch_info())
30
+
31
+ # Change cbox settings
32
+ await cbox.change_status(Cbox.Status.OFF)
33
+ await cbox.change_fan_setpoint(FanStatus.AUTO)
34
+ await cbox.change_temperature_setpoint(19)
35
+ await cbox.change_power_setpoint(4)
36
+
37
+ # Fetch changed cbox info
38
+ print(await cbox.fetch_info())
39
+ ```
40
+
41
+ Here is the output
42
+
43
+ ```json
44
+ DEBUG:cbox.connbox:Fetch infos
45
+ {"timestamp": "2024-10-20 09:41:59", "globalStatus": "CHIMNEY_ALARM", "fanSetpoint": "SPEED_1", "powerSetpoint": 1, "temperatureSetpoint": 23, "temperature1": 18.2, "temperature2": 0, "temperature3": 27, "temperature4": 0, "temperature5": 19, "firmwareDate": "2023-07-26", "firmwareVersion": 48}
46
+ DEBUG:cbox.connbox:Change status => off
47
+ DEBUG:cbox.connbox:Change fan setpoint AUTO
48
+ DEBUG:cbox.connbox:Change temperature setpoint => 19
49
+ DEBUG:cbox.connbox:Change power setpoing => 4
50
+ DEBUG:cbox.connbox:Fetch infos
51
+ {"timestamp": "2024-10-20 09:42:03", "globalStatus": "OFF", "fanSetpoint": "AUTO", "powerSetpoint": 4, "temperatureSetpoint": 19, "temperature1": 18.2, "temperature2": 0, "temperature3": 27, "temperature4": 0, "temperature5": 19, "firmwareDate": "2023-07-26", "firmwareVersion": 48}
52
+ ```
53
+
54
+ ## Resources
55
+
56
+ ### Connbox related
57
+
58
+ [Connbox Jotul PDF](https://www.jotul.fr/sites/french/files/products/MANUAL_PELLET_CONNEXION_BOX_FR_DE_NL_ES_EN_IT_PL_P02.pdf)
59
+
60
+ [Connbox Palazzetti](https://www.palazzetti-boutique-lyon.fr/nouveautes/la-nouvelle-connection-box-palazzetti/)
61
+
62
+ [Application Jotul android Pellet control](https://www.jotul.fr/sites/french/files/products/MANUAL_PELLET_CONNEXION_BOX_FR_DE_NL_ES_EN_IT_PL_P02.pdf)
63
+
64
+ ### Fumis related
65
+
66
+ [Fumis Controller](https://fumis.si/en/about-fumis/fumis-combustion-controllers/fumis-alpha)
67
+
68
+ This controller is integrated by this non exhaustive list of brands :
69
+
70
+ * Palazzetti / Jotul / TurboFonte / Godin / Fonte Flamme / Invicta / Casatelli / Alpis / Faizen / HETA / ...
71
+
72
+ If you have this can of controller then you can install a connbox and use this project.
73
+
74
+ ## Alternatives
75
+
76
+ [WirelessPalaControl](https://github.com/Domochip/WirelessPalaControl)
77
+
78
+ * Based on a custom connection hardware (no connbox here)
79
+ * Written in C++
80
+ * Grade A integration with HomeAssistant
81
+ * MQTT support
82
+
83
+ [hass-Palazzetti](https://github.com/Vost3/hass-palazzetti)
84
+
85
+ * All in one HomeAssistant integration
86
+ * Written in Python
87
+ * Grade B integration with HomeAssistant
88
+ * It exposes a custom service and is not fully integratd as a Climate Entity
89
+
90
+ ## Developer's corner
91
+
92
+ * [How to contribute](DEVELOPMENT.md)
93
+ * [About Connbox protocol](doc/cboxProtcol.md)
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.9.4,<0.10.0"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "connbox"
7
+ version = "0.1.0"
8
+ requires-python = ">=3.13"
9
+ description = "This is a service to connect and interact with a connbox for Pellet stoves (Palazzetti, Jotul)"
10
+ readme = "README.md"
11
+ license = { file = "LICENSE" }
12
+ authors = [
13
+ { name = "Sylvain Daclin" }
14
+ ]
15
+ keywords = ["pellet", "stove", "connbox", "palazzetti", "jotul", "fumis", "iot"]
16
+ homepage = "https://github.com/sdaclin/cbox"
17
+ repository = "https://github.com/sdaclin/cbox"
18
+ classifiers = [
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Home Automation",
24
+ ]
25
+
26
+ [project.packages]
27
+ find = { where = ["src"] }
28
+
29
+ dependencies = [
30
+ "aiohttp>=3.10.8",
31
+ ]
32
+
33
+ [dependency-groups]
34
+ dev = [
35
+ "coverage>=7.6.4",
36
+ "pytest>=8.4.2",
37
+ "pytest-aiohttp>=1.0.5",
38
+ "pytest-asyncio>=0.24",
39
+ ]
40
+ lint = [
41
+ "ruff>=0.14.0",
42
+ ]
43
+
44
+ [tool.ruff]
45
+ line-length = 120
46
+
47
+ [tool.pytest.ini_options]
48
+ asyncio_mode = "auto"
49
+ asyncio_default_fixture_loop_scope = "function"
50
+ testpaths = [
51
+ "tests",
52
+ ]
53
+ pythonpath = [
54
+ "src",
55
+ ]
56
+
57
+ [tool.coverage.run]
58
+ source = ["src"]
59
+ omit = ["*/tests/*", "*/test_*.py"]
60
+
61
+ [tool.coverage.report]
62
+ precision = 2
63
+ show_missing = true
64
+ skip_covered = false
65
+ fail_under = 80.0
66
+ exclude_lines = [
67
+ "pragma: no cover",
68
+ "def __repr__",
69
+ "raise AssertionError",
70
+ "raise NotImplementedError",
71
+ "if __name__ == .__main__.:",
72
+ "if TYPE_CHECKING:",
73
+ ]
@@ -0,0 +1,5 @@
1
+ """All you need to manage a connbox."""
2
+
3
+ from connbox.connbox import Cbox, CboxInfo, FanStatus, StoveStatus
4
+
5
+ __all__ = ["Cbox", "CboxInfo", "StoveStatus", "FanStatus"]
@@ -0,0 +1,206 @@
1
+ import json
2
+ import logging
3
+ from dataclasses import dataclass
4
+ from datetime import date, datetime
5
+ from enum import Enum
6
+ from typing import Self
7
+
8
+ from aiohttp import ClientResponse, ClientSession
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+
13
+ class StoveStatus(Enum):
14
+ OFF = 0
15
+ OFF_TIMER = 1
16
+ TESTFIRE = 2
17
+ HEATUP = 3
18
+ FUELIGN = 4
19
+ IGNTEST = 5
20
+ BURNING = 6
21
+ COOLFLUID = 9
22
+ FIRESTOP = 10
23
+ CLEANFIRE = 11
24
+ COOL = 12
25
+ CHIMNEY_ALARM = 241
26
+ GRATE_ERROR = 243
27
+ NTC2_ALARM = 244
28
+ NTC3_ALARM = 245
29
+ DOOR_ALARM = 247
30
+ PRESS_ALARM = 248
31
+ NTC1_ALARM = 249
32
+ TC1_ALARM = 250
33
+ GAS_ALARM = 252
34
+ NOPELLET_ALAR = 253
35
+
36
+
37
+ class FanStatus(Enum):
38
+ OFF = 0
39
+ SPEED_1 = 1
40
+ SPEED_2 = 2
41
+ SPEED_3 = 3
42
+ SPEED_4 = 4
43
+ SPEED_5 = 5
44
+ HIGH = 6
45
+ AUTO = 7
46
+
47
+
48
+ @dataclass
49
+ class CboxInfo:
50
+ """Class for keeping track of Cbox info as returned by the cBox API"""
51
+
52
+ timestamp: datetime = datetime.now()
53
+
54
+ mac: str = "00:00:00:00:00:00"
55
+
56
+ status: StoveStatus = StoveStatus.OFF
57
+
58
+ fanSetpoint: FanStatus = FanStatus.OFF
59
+ powerSetpoint: int = 1
60
+ temperatureSetpoint: int = 19
61
+
62
+ t1: int = 0
63
+ t2: int = 0
64
+ t3: int = 0
65
+ t4: int = 0
66
+ t5: int = 0
67
+
68
+ pelletQttyTotalKg: int = 0
69
+
70
+ firmwareVersion: int = 0
71
+ firmwareDate: date = date.today()
72
+
73
+ def __repr__(self) -> str:
74
+ return json.dumps(
75
+ {
76
+ "timestamp": str(self.timestamp),
77
+ "mac": self.mac,
78
+ "globalStatus": self.status.name,
79
+ "fanSetpoint": self.fanSetpoint.name,
80
+ "powerSetpoint": self.powerSetpoint,
81
+ "temperatureSetpoint": self.temperatureSetpoint,
82
+ "temperature1": self.t1,
83
+ "temperature2": self.t2,
84
+ "temperature3": self.t3,
85
+ "temperature4": self.t4,
86
+ "temperature5": self.t5,
87
+ "pelletQttyTotalKg": self.pelletQttyTotalKg,
88
+ "firmwareDate": str(self.firmwareDate),
89
+ "firmwareVersion": self.firmwareVersion,
90
+ }
91
+ )
92
+
93
+ def from_dict(dict: dict) -> Self:
94
+ return CboxInfo(
95
+ timestamp=datetime.fromtimestamp(dict["INFO"]["TS"]),
96
+ mac=dict["DATA"]["MAC"],
97
+ status=StoveStatus(dict["DATA"]["STATUS"]),
98
+ fanSetpoint=FanStatus(dict["DATA"]["F2L"]),
99
+ powerSetpoint=dict["DATA"]["PWR"],
100
+ temperatureSetpoint=dict["DATA"]["SETP"],
101
+ t1=dict["DATA"]["T1"],
102
+ t2=dict["DATA"]["T2"],
103
+ t3=dict["DATA"]["T3"],
104
+ t4=dict["DATA"]["T4"],
105
+ t5=dict["DATA"]["T5"],
106
+ pelletQttyTotalKg=dict["DATA"]["PQT"],
107
+ firmwareVersion=int(dict["DATA"]["VER"]),
108
+ firmwareDate=date.fromisoformat(dict["DATA"]["FWDATE"]),
109
+ )
110
+
111
+
112
+ class Cbox:
113
+ class Status(Enum):
114
+ ON = "on"
115
+ OFF = "off"
116
+
117
+ def __init__(self, client: ClientSession) -> None:
118
+ self.path: str = "/cgi-bin/sendmsg.lua"
119
+ self.client_session = client
120
+
121
+ async def __aenter__(self) -> Self:
122
+ return self
123
+
124
+ async def __aexit__(self, exc_type, exc_value, exc_tb) -> None:
125
+ await self.client_session.close()
126
+
127
+ @classmethod
128
+ def connected_to(cls, host: str) -> Self:
129
+ """Return a Cbox connected to given host"""
130
+ return cls(ClientSession(f"http://{host}/"))
131
+
132
+ async def fetch_info(self) -> CboxInfo:
133
+ """Fetch all the general info in one call"""
134
+ logger.debug("Fetch infos")
135
+ async with self.client_session.get(self.path, params=[("cmd", "GET ALLS")]) as response:
136
+ if response.status != 200:
137
+ raise Exception("Can't fetch infos")
138
+ response_json = await response.json()
139
+ if response_json["SUCCESS"] is not True:
140
+ raise Exception("Request response is not SUCCESS")
141
+ return CboxInfo.from_dict(response_json)
142
+
143
+ async def get_info(self, cmd: str) -> None:
144
+ """Fetch cmd"""
145
+ logger.debug(f"Fetch cmd {cmd}")
146
+ async with self.client_session.get(self.path, params=[("cmd", f"GET {cmd}")]) as response:
147
+ if response.status != 200:
148
+ raise Exception(f"Can't fetch {cmd}")
149
+ response_json = await response.json()
150
+ if response_json["SUCCESS"] is not True:
151
+ raise Exception("Request response is not SUCCESS")
152
+ return response_json
153
+
154
+ async def bkp(self) -> None:
155
+ """Backup cmd"""
156
+ cmd = "BKP PARM JSON"
157
+ logger.debug(f"Backp cmd {cmd}")
158
+ async with self.client_session.get(self.path, params=[("cmd", f"{cmd}")]) as response:
159
+ if response.status != 200:
160
+ raise Exception(f"Can't fetch {cmd}")
161
+ response_json = await response.json()
162
+ if response_json["SUCCESS"] is not True:
163
+ raise Exception("Request response is not SUCCESS")
164
+ return response_json
165
+
166
+ async def power_on(self) -> None:
167
+ """Turn on the device"""
168
+ logger.debug("Power on")
169
+ async with self.client_session.get(self.path, params=[("cmd", "CMD on")]) as response:
170
+ await Cbox._check_response_success(response)
171
+
172
+ async def power_off(self) -> None:
173
+ """Turn off the device"""
174
+ logger.debug("Power off")
175
+ async with self.client_session.get(self.path, params=[("cmd", "CMD off")]) as response:
176
+ await Cbox._check_response_success(response)
177
+
178
+ async def change_temperature_setpoint(self, temperature: int) -> None:
179
+ """Change temperature setpoint"""
180
+ logger.debug(f"Change temperature setpoint => {temperature}")
181
+ if not 11 < temperature < 51:
182
+ raise Exception("Unexpected temperature, should be between 12 and 50")
183
+ async with self.client_session.get(self.path, params=[("cmd", f"SET SETP {temperature}")]) as response:
184
+ await Cbox._check_response_success(response)
185
+
186
+ async def change_power_setpoint(self, power: int) -> None:
187
+ """Change power setpoint"""
188
+ logger.debug(f"Change power setpoint => {power}")
189
+ if not 1 <= power <= 5:
190
+ logger.warning(f"Invalid power value {power}, value should be between 1-5")
191
+ raise "Unexpected power, should be between 1 and 5"
192
+ async with self.client_session.get(self.path, params=[("cmd", f"SET POWR {power}")]) as response:
193
+ await Cbox._check_response_success(response)
194
+
195
+ async def change_fan_setpoint(self, fan_status: FanStatus) -> None:
196
+ """Change fan setpoint"""
197
+ logger.debug(f"Change fan setpoint {fan_status.name}")
198
+ async with self.client_session.get(self.path, params=[("cmd", f"SET RFAN {fan_status.value}")]) as response:
199
+ await Cbox._check_response_success(response)
200
+
201
+ async def _check_response_success(response: ClientResponse):
202
+ if response.status != 200:
203
+ raise Exception(f"Got unexpected response status {response.status}")
204
+ response_json = await response.json()
205
+ if response_json["SUCCESS"] is not True:
206
+ raise Exception(f"Request response is not SUCCESS => {json.dumps(response_json)}")