1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
|
%global _empty_manifest_terminate_build 0
Name: python-PyViCare
Version: 2.25.0
Release: 1
Summary: Library to communicate with the Viessmann ViCare API
License: Apache Software License
URL: https://github.com/somm15/PyViCare
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a2/a9/0c65e8f135a25f91cad6c0ca714ff7ddbdeb23fe13c7d55756543578ccca/PyViCare-2.25.0.tar.gz
BuildArch: noarch
Requires: python3-requests-oauthlib
Requires: python3-pkce
%description
# PyViCare
This library implements access to Viessmann devices by using the official API from the [Viessmann Developer Portal](https://developer.viessmann.com/).
## Breaking changes in version 2.8.x
- The circuit, burner (Gaz) and compressor (Heat Pump) is now separted. Accessing the properties of the burner/compressor is moved from `device.curcuits` to `device.burners` and `device.compressor`.
## Breaking changes in version 2.x
- The API to access your device changed to a general `PyViCare` class. Use this class to load all available devices.
- The API to access the heating circuit of the device has moved to the `Device` class. You can now access and iterate over all available circuits via `device.curcuits`. This allows to easily see which properties are depending on the circuit.
See the example below for how you can use that.
## Breaking changes in version 1.x
- The versions prior to 1.x used an inofficial API which stopped working on July, 15th 2021. All users need to migrate to version 1.0.0 to continue using the API.
- Exception is raised if the library runs into a API rate limit. (See feature flag `raise_exception_on_rate_limit`)
- Exception is raised if an unsupported device feature is used. (See feature flag `raise_exception_on_not_supported_device_feature`)
- Python 3.4 is no longer supported.
- Python 3.9 is now supported.
## Prerequisites
To use PyViCare, every user has to register and create their private API key. Follow these steps to create your API key:
1. Login to the [Viessmann Developer Portal](https://developer.viessmann.com/) with your existing ViCare username from the ViCare app.
2. In the menu navigate to `API Keys`.
3. Create a new OAuth client using following data:
- Name: PyViCare
- Google reCAPTCHA: Disabled
- Redirect URIs: `vicare://oauth-callback/everest`
4. Copy the `Client ID` to use in your code. Pass it as constructor parameter to the device.
Please note that not all properties from older versions and the ViCare mobile app are available in the new API. Missing properties were removed and might be added later if they are available again.
## Help
We need help testing and improving PyViCare, since the maintainers only have specific types of heating systems. For bugs, questions or feature requests join the [PyViCare channel on Discord](https://discord.gg/aM3SqCD88f) or create an issue in this repository.
## Device Features / Errors
Depending on the device, some features are not available/supported. This results in a raising of a `PyViCareNotSupportedFeatureError` if the dedicated method is called. This is most likely not a bug, but a limitation of the device itself.
Tip: You can use Pythons [contextlib.suppress](https://docs.python.org/3/library/contextlib.html#contextlib.suppress) to handle it gracefully.
## Types of heatings
- Use `asGazBoiler` for gas heatings
- Use `asHeatPump` for heat pumps
- Use `asFuelCell` for fuel cells
- Use `asPelletsBoiler` for pellets heatings
- Use `asOilBoiler` for oil heatings
- Use `asHybridDevice` for gas/heat pump hybrid heatings
## Basic Usage:
```python
import sys
import logging
from PyViCare.PyViCare import PyViCare
client_id = "INSERT CLIENT ID"
email = "email@domain"
password = "password"
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
device = vicare.devices[0]
print(device.getModel())
print("Online" if device.isOnline() else "Offline")
t = device.asAutoDetectDevice()
print(t.getDomesticHotWaterConfiguredTemperature())
print(t.getDomesticHotWaterStorageTemperature())
print(t.getOutsideTemperature())
print(t.getRoomTemperature())
print(t.getBoilerTemperature())
print(t.setDomesticHotWaterTemperature(59))
circuit = t.circuits[0] #select heating circuit
print(circuit.getSupplyTemperature())
print(circuit.getHeatingCurveShift())
print(circuit.getHeatingCurveSlope())
print(circuit.getActiveProgram())
print(circuit.getPrograms())
print(circuit.getCurrentDesiredTemperature())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.getActiveMode())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.setProgramTemperature("comfort",21))
print(circuit.activateProgram("comfort"))
print(circuit.deactivateComfort())
burner = t.burners[0] #select burner
print(burner.getActive())
compressor = t.compressors[0] #select compressor
print(compressor.getActive())
```
## API Usage in Postman
Follow these steps to access the API in Postman:
1. Create an access token in the `Authorization` tab with type `OAuth 2.0` and following inputs:
- Token Name: `PyViCare`
- Grant Type: `Authorization Code (With PKCE)`
- Callback URL: `vicare://oauth-callback/everest`
- Authorize using browser: Disabled
- Auth URL: `https://iam.viessmann.com/idp/v2/authorize`
- Access Token URL: `https://iam.viessmann.com/idp/v2/token`
- Client ID: Your personal Client ID created in the developer portal.
- Client Secret: Blank
- Code Challenge Method: `SHA-256`
- Code Veriefier: Blank
- Scope: `IoT User`
- State: Blank
- Client Authentication: `Send client credentials in body`.
A login popup will open. Enter your ViCare username and password.
2. Use this URL to access your `installationId` and `gatewaySerial`:
`https://api.viessmann.com/iot/v1/equipment/installations?includeGateways=true`
- `installationId` is `data[0].id`
- `gatewaySerial` is `data[0].gateways[0].serial`
3. Use above data to replace `{installationId}` and `{gatewaySerial}` in this URL to investigate the Viessmann API:
`https://api.viessmann.com/iot/v1/equipment/installations/{installationId}/gateways/{gatewaySerial}/devices/0/features`
## Rate Limits
[Due to latest changes in the Viessmann API](https://www.viessmann-community.com/t5/Konnektivitaet/Q-amp-A-Viessmann-API/td-p/127660) rate limits can be hit. In that case a `PyViCareRateLimitError` is raised. You can read from the error (`limitResetDate`) when the rate limit is reset.
## More different devices for test cases needed
In order to help ensuring making it easier to create more test cases you can run this code and make a pull request with the new test of your device type added. Your test should be commited into [tests/response](tests/response) and named `<family><model>`.
The code to run to make this happen is below. This automatically removes "sensitive" information like installation id and serial numbers.
You can either replace default values or use the `PYVICARE_*` environment variables.
```python
import sys
import os
from PyViCare.PyViCare import PyViCare
client_id = os.getenv("PYVICARE_CLIENT_ID", "INSERT CLIENT_ID")
email = os.getenv("PYVICARE_EMAIL", "email@domain")
password = os.getenv("PYVICARE_PASSWORD", "password")
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
with open(f"dump.json", mode='w') as output:
output.write(vicare.devices[0].dump_secure())
```
%package -n python3-PyViCare
Summary: Library to communicate with the Viessmann ViCare API
Provides: python-PyViCare
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-PyViCare
# PyViCare
This library implements access to Viessmann devices by using the official API from the [Viessmann Developer Portal](https://developer.viessmann.com/).
## Breaking changes in version 2.8.x
- The circuit, burner (Gaz) and compressor (Heat Pump) is now separted. Accessing the properties of the burner/compressor is moved from `device.curcuits` to `device.burners` and `device.compressor`.
## Breaking changes in version 2.x
- The API to access your device changed to a general `PyViCare` class. Use this class to load all available devices.
- The API to access the heating circuit of the device has moved to the `Device` class. You can now access and iterate over all available circuits via `device.curcuits`. This allows to easily see which properties are depending on the circuit.
See the example below for how you can use that.
## Breaking changes in version 1.x
- The versions prior to 1.x used an inofficial API which stopped working on July, 15th 2021. All users need to migrate to version 1.0.0 to continue using the API.
- Exception is raised if the library runs into a API rate limit. (See feature flag `raise_exception_on_rate_limit`)
- Exception is raised if an unsupported device feature is used. (See feature flag `raise_exception_on_not_supported_device_feature`)
- Python 3.4 is no longer supported.
- Python 3.9 is now supported.
## Prerequisites
To use PyViCare, every user has to register and create their private API key. Follow these steps to create your API key:
1. Login to the [Viessmann Developer Portal](https://developer.viessmann.com/) with your existing ViCare username from the ViCare app.
2. In the menu navigate to `API Keys`.
3. Create a new OAuth client using following data:
- Name: PyViCare
- Google reCAPTCHA: Disabled
- Redirect URIs: `vicare://oauth-callback/everest`
4. Copy the `Client ID` to use in your code. Pass it as constructor parameter to the device.
Please note that not all properties from older versions and the ViCare mobile app are available in the new API. Missing properties were removed and might be added later if they are available again.
## Help
We need help testing and improving PyViCare, since the maintainers only have specific types of heating systems. For bugs, questions or feature requests join the [PyViCare channel on Discord](https://discord.gg/aM3SqCD88f) or create an issue in this repository.
## Device Features / Errors
Depending on the device, some features are not available/supported. This results in a raising of a `PyViCareNotSupportedFeatureError` if the dedicated method is called. This is most likely not a bug, but a limitation of the device itself.
Tip: You can use Pythons [contextlib.suppress](https://docs.python.org/3/library/contextlib.html#contextlib.suppress) to handle it gracefully.
## Types of heatings
- Use `asGazBoiler` for gas heatings
- Use `asHeatPump` for heat pumps
- Use `asFuelCell` for fuel cells
- Use `asPelletsBoiler` for pellets heatings
- Use `asOilBoiler` for oil heatings
- Use `asHybridDevice` for gas/heat pump hybrid heatings
## Basic Usage:
```python
import sys
import logging
from PyViCare.PyViCare import PyViCare
client_id = "INSERT CLIENT ID"
email = "email@domain"
password = "password"
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
device = vicare.devices[0]
print(device.getModel())
print("Online" if device.isOnline() else "Offline")
t = device.asAutoDetectDevice()
print(t.getDomesticHotWaterConfiguredTemperature())
print(t.getDomesticHotWaterStorageTemperature())
print(t.getOutsideTemperature())
print(t.getRoomTemperature())
print(t.getBoilerTemperature())
print(t.setDomesticHotWaterTemperature(59))
circuit = t.circuits[0] #select heating circuit
print(circuit.getSupplyTemperature())
print(circuit.getHeatingCurveShift())
print(circuit.getHeatingCurveSlope())
print(circuit.getActiveProgram())
print(circuit.getPrograms())
print(circuit.getCurrentDesiredTemperature())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.getActiveMode())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.setProgramTemperature("comfort",21))
print(circuit.activateProgram("comfort"))
print(circuit.deactivateComfort())
burner = t.burners[0] #select burner
print(burner.getActive())
compressor = t.compressors[0] #select compressor
print(compressor.getActive())
```
## API Usage in Postman
Follow these steps to access the API in Postman:
1. Create an access token in the `Authorization` tab with type `OAuth 2.0` and following inputs:
- Token Name: `PyViCare`
- Grant Type: `Authorization Code (With PKCE)`
- Callback URL: `vicare://oauth-callback/everest`
- Authorize using browser: Disabled
- Auth URL: `https://iam.viessmann.com/idp/v2/authorize`
- Access Token URL: `https://iam.viessmann.com/idp/v2/token`
- Client ID: Your personal Client ID created in the developer portal.
- Client Secret: Blank
- Code Challenge Method: `SHA-256`
- Code Veriefier: Blank
- Scope: `IoT User`
- State: Blank
- Client Authentication: `Send client credentials in body`.
A login popup will open. Enter your ViCare username and password.
2. Use this URL to access your `installationId` and `gatewaySerial`:
`https://api.viessmann.com/iot/v1/equipment/installations?includeGateways=true`
- `installationId` is `data[0].id`
- `gatewaySerial` is `data[0].gateways[0].serial`
3. Use above data to replace `{installationId}` and `{gatewaySerial}` in this URL to investigate the Viessmann API:
`https://api.viessmann.com/iot/v1/equipment/installations/{installationId}/gateways/{gatewaySerial}/devices/0/features`
## Rate Limits
[Due to latest changes in the Viessmann API](https://www.viessmann-community.com/t5/Konnektivitaet/Q-amp-A-Viessmann-API/td-p/127660) rate limits can be hit. In that case a `PyViCareRateLimitError` is raised. You can read from the error (`limitResetDate`) when the rate limit is reset.
## More different devices for test cases needed
In order to help ensuring making it easier to create more test cases you can run this code and make a pull request with the new test of your device type added. Your test should be commited into [tests/response](tests/response) and named `<family><model>`.
The code to run to make this happen is below. This automatically removes "sensitive" information like installation id and serial numbers.
You can either replace default values or use the `PYVICARE_*` environment variables.
```python
import sys
import os
from PyViCare.PyViCare import PyViCare
client_id = os.getenv("PYVICARE_CLIENT_ID", "INSERT CLIENT_ID")
email = os.getenv("PYVICARE_EMAIL", "email@domain")
password = os.getenv("PYVICARE_PASSWORD", "password")
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
with open(f"dump.json", mode='w') as output:
output.write(vicare.devices[0].dump_secure())
```
%package help
Summary: Development documents and examples for PyViCare
Provides: python3-PyViCare-doc
%description help
# PyViCare
This library implements access to Viessmann devices by using the official API from the [Viessmann Developer Portal](https://developer.viessmann.com/).
## Breaking changes in version 2.8.x
- The circuit, burner (Gaz) and compressor (Heat Pump) is now separted. Accessing the properties of the burner/compressor is moved from `device.curcuits` to `device.burners` and `device.compressor`.
## Breaking changes in version 2.x
- The API to access your device changed to a general `PyViCare` class. Use this class to load all available devices.
- The API to access the heating circuit of the device has moved to the `Device` class. You can now access and iterate over all available circuits via `device.curcuits`. This allows to easily see which properties are depending on the circuit.
See the example below for how you can use that.
## Breaking changes in version 1.x
- The versions prior to 1.x used an inofficial API which stopped working on July, 15th 2021. All users need to migrate to version 1.0.0 to continue using the API.
- Exception is raised if the library runs into a API rate limit. (See feature flag `raise_exception_on_rate_limit`)
- Exception is raised if an unsupported device feature is used. (See feature flag `raise_exception_on_not_supported_device_feature`)
- Python 3.4 is no longer supported.
- Python 3.9 is now supported.
## Prerequisites
To use PyViCare, every user has to register and create their private API key. Follow these steps to create your API key:
1. Login to the [Viessmann Developer Portal](https://developer.viessmann.com/) with your existing ViCare username from the ViCare app.
2. In the menu navigate to `API Keys`.
3. Create a new OAuth client using following data:
- Name: PyViCare
- Google reCAPTCHA: Disabled
- Redirect URIs: `vicare://oauth-callback/everest`
4. Copy the `Client ID` to use in your code. Pass it as constructor parameter to the device.
Please note that not all properties from older versions and the ViCare mobile app are available in the new API. Missing properties were removed and might be added later if they are available again.
## Help
We need help testing and improving PyViCare, since the maintainers only have specific types of heating systems. For bugs, questions or feature requests join the [PyViCare channel on Discord](https://discord.gg/aM3SqCD88f) or create an issue in this repository.
## Device Features / Errors
Depending on the device, some features are not available/supported. This results in a raising of a `PyViCareNotSupportedFeatureError` if the dedicated method is called. This is most likely not a bug, but a limitation of the device itself.
Tip: You can use Pythons [contextlib.suppress](https://docs.python.org/3/library/contextlib.html#contextlib.suppress) to handle it gracefully.
## Types of heatings
- Use `asGazBoiler` for gas heatings
- Use `asHeatPump` for heat pumps
- Use `asFuelCell` for fuel cells
- Use `asPelletsBoiler` for pellets heatings
- Use `asOilBoiler` for oil heatings
- Use `asHybridDevice` for gas/heat pump hybrid heatings
## Basic Usage:
```python
import sys
import logging
from PyViCare.PyViCare import PyViCare
client_id = "INSERT CLIENT ID"
email = "email@domain"
password = "password"
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
device = vicare.devices[0]
print(device.getModel())
print("Online" if device.isOnline() else "Offline")
t = device.asAutoDetectDevice()
print(t.getDomesticHotWaterConfiguredTemperature())
print(t.getDomesticHotWaterStorageTemperature())
print(t.getOutsideTemperature())
print(t.getRoomTemperature())
print(t.getBoilerTemperature())
print(t.setDomesticHotWaterTemperature(59))
circuit = t.circuits[0] #select heating circuit
print(circuit.getSupplyTemperature())
print(circuit.getHeatingCurveShift())
print(circuit.getHeatingCurveSlope())
print(circuit.getActiveProgram())
print(circuit.getPrograms())
print(circuit.getCurrentDesiredTemperature())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.getActiveMode())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.setProgramTemperature("comfort",21))
print(circuit.activateProgram("comfort"))
print(circuit.deactivateComfort())
burner = t.burners[0] #select burner
print(burner.getActive())
compressor = t.compressors[0] #select compressor
print(compressor.getActive())
```
## API Usage in Postman
Follow these steps to access the API in Postman:
1. Create an access token in the `Authorization` tab with type `OAuth 2.0` and following inputs:
- Token Name: `PyViCare`
- Grant Type: `Authorization Code (With PKCE)`
- Callback URL: `vicare://oauth-callback/everest`
- Authorize using browser: Disabled
- Auth URL: `https://iam.viessmann.com/idp/v2/authorize`
- Access Token URL: `https://iam.viessmann.com/idp/v2/token`
- Client ID: Your personal Client ID created in the developer portal.
- Client Secret: Blank
- Code Challenge Method: `SHA-256`
- Code Veriefier: Blank
- Scope: `IoT User`
- State: Blank
- Client Authentication: `Send client credentials in body`.
A login popup will open. Enter your ViCare username and password.
2. Use this URL to access your `installationId` and `gatewaySerial`:
`https://api.viessmann.com/iot/v1/equipment/installations?includeGateways=true`
- `installationId` is `data[0].id`
- `gatewaySerial` is `data[0].gateways[0].serial`
3. Use above data to replace `{installationId}` and `{gatewaySerial}` in this URL to investigate the Viessmann API:
`https://api.viessmann.com/iot/v1/equipment/installations/{installationId}/gateways/{gatewaySerial}/devices/0/features`
## Rate Limits
[Due to latest changes in the Viessmann API](https://www.viessmann-community.com/t5/Konnektivitaet/Q-amp-A-Viessmann-API/td-p/127660) rate limits can be hit. In that case a `PyViCareRateLimitError` is raised. You can read from the error (`limitResetDate`) when the rate limit is reset.
## More different devices for test cases needed
In order to help ensuring making it easier to create more test cases you can run this code and make a pull request with the new test of your device type added. Your test should be commited into [tests/response](tests/response) and named `<family><model>`.
The code to run to make this happen is below. This automatically removes "sensitive" information like installation id and serial numbers.
You can either replace default values or use the `PYVICARE_*` environment variables.
```python
import sys
import os
from PyViCare.PyViCare import PyViCare
client_id = os.getenv("PYVICARE_CLIENT_ID", "INSERT CLIENT_ID")
email = os.getenv("PYVICARE_EMAIL", "email@domain")
password = os.getenv("PYVICARE_PASSWORD", "password")
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
with open(f"dump.json", mode='w') as output:
output.write(vicare.devices[0].dump_secure())
```
%prep
%autosetup -n PyViCare-2.25.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-PyViCare -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 2.25.0-1
- Package Spec generated
|