PyViCare 2.63.0__tar.gz → 2.64.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.
- pyvicare-2.64.0/.gitignore +123 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PKG-INFO +16 -20
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCare.py +3 -2
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareAbstractOAuthManager.py +8 -6
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareBrowserOAuthManager.py +5 -4
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareCachedService.py +2 -2
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareCachedServiceBase.py +14 -13
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareCachedServiceViaGateway.py +3 -1
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareDevice.py +5 -1
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareDeviceConfig.py +14 -10
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareFloorHeating.py +1 -1
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareFuelCell.py +8 -6
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareGazBoiler.py +8 -6
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareHeatPump.py +13 -8
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareHeatingDevice.py +85 -16
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareOAuthManager.py +8 -7
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareOilBoiler.py +8 -6
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCarePelletsBoiler.py +7 -4
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareRoomControl.py +30 -2
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareService.py +4 -4
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareServiceViaGateway.py +1 -2
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareUtils.py +1 -1
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareVentilationDevice.py +6 -1
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareWaterTreatment.py +7 -8
- {pyvicare-2.63.0 → pyvicare-2.64.0}/pyproject.toml +60 -47
- {pyvicare-2.63.0 → pyvicare-2.64.0}/LICENSE +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/Feature.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareElectricalEnergySystem.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareGateway.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareHeatCurveCalculation.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareHybrid.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareRadiatorActuator.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareRepeater.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/PyViCareRoomSensor.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/PyViCare/__init__.py +0 -0
- {pyvicare-2.63.0 → pyvicare-2.64.0}/README.md +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
local_settings.py
|
|
58
|
+
db.sqlite3
|
|
59
|
+
|
|
60
|
+
# Flask stuff:
|
|
61
|
+
instance/
|
|
62
|
+
.webassets-cache
|
|
63
|
+
|
|
64
|
+
# Scrapy stuff:
|
|
65
|
+
.scrapy
|
|
66
|
+
|
|
67
|
+
# Sphinx documentation
|
|
68
|
+
docs/_build/
|
|
69
|
+
|
|
70
|
+
# PyBuilder
|
|
71
|
+
target/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# IPython
|
|
77
|
+
profile_default/
|
|
78
|
+
ipython_config.py
|
|
79
|
+
|
|
80
|
+
# celery beat schedule file
|
|
81
|
+
celerybeat-schedule
|
|
82
|
+
|
|
83
|
+
# SageMath parsed files
|
|
84
|
+
*.sage.py
|
|
85
|
+
|
|
86
|
+
# Environments
|
|
87
|
+
.env
|
|
88
|
+
.venv
|
|
89
|
+
env/
|
|
90
|
+
venv/
|
|
91
|
+
ENV/
|
|
92
|
+
env.bak/
|
|
93
|
+
venv.bak/
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# mkdocs documentation
|
|
103
|
+
/site
|
|
104
|
+
|
|
105
|
+
# mypy
|
|
106
|
+
.mypy_cache/
|
|
107
|
+
.dmypy.json
|
|
108
|
+
dmypy.json
|
|
109
|
+
|
|
110
|
+
# Pyre type checker
|
|
111
|
+
.pyre/
|
|
112
|
+
token.bin
|
|
113
|
+
|
|
114
|
+
.DS_Store
|
|
115
|
+
.vscode/settings.json
|
|
116
|
+
|
|
117
|
+
*.save
|
|
118
|
+
*.local.sh
|
|
119
|
+
env*
|
|
120
|
+
dump.*json
|
|
121
|
+
|
|
122
|
+
# PyCharm
|
|
123
|
+
.idea
|
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: PyViCare
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.64.0
|
|
4
4
|
Summary: Library to communicate with the Viessmann ViCare API.
|
|
5
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/openviess/PyViCare
|
|
6
|
+
Project-URL: Repository, https://github.com/openviess/PyViCare
|
|
7
|
+
Project-URL: Documentation, https://github.com/openviess/PyViCare
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/openviess/PyViCare/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/openviess/PyViCare/releases
|
|
10
|
+
Author-email: Simon Gillet <mail+pyvicare@gillet.ninja>
|
|
11
|
+
Maintainer: Martin, Lukas Wöhrl
|
|
12
|
+
Maintainer-email: Christopher Fenner <fenner.christopher@gmail.com>
|
|
13
|
+
License-Expression: Apache-2.0
|
|
6
14
|
License-File: LICENSE
|
|
7
|
-
Keywords:
|
|
8
|
-
Author: Simon Gillet
|
|
9
|
-
Author-email: mail+pyvicare@gillet.ninja
|
|
10
|
-
Maintainer: Christopher Fenner
|
|
11
|
-
Maintainer-email: fenner.christopher@gmail.com
|
|
12
|
-
Requires-Python: >=3.10,<4.0
|
|
15
|
+
Keywords: api,vicare,viessmann
|
|
13
16
|
Classifier: Intended Audience :: Developers
|
|
14
17
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
18
|
Classifier: Natural Language :: English
|
|
16
19
|
Classifier: Operating System :: OS Independent
|
|
17
20
|
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
23
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
24
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.15
|
|
24
25
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
-
Requires-
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
|
|
29
|
-
Project-URL: Changelog, https://github.com/openviess/PyViCare/releases
|
|
30
|
-
Project-URL: Documentation, https://github.com/openviess/PyViCare
|
|
31
|
-
Project-URL: Homepage, https://github.com/openviess/PyViCare
|
|
32
|
-
Project-URL: Repository, https://github.com/openviess/PyViCare
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Requires-Dist: authlib>1.2.0
|
|
28
|
+
Requires-Dist: deprecated<2,>=1.3.0
|
|
29
|
+
Requires-Dist: requests>=2.31.0
|
|
33
30
|
Description-Content-Type: text/markdown
|
|
34
31
|
|
|
35
32
|
# PyViCare
|
|
@@ -228,4 +225,3 @@ To install `ViCare` as a custom component, one can use the terminal addon to ins
|
|
|
228
225
|
```sh
|
|
229
226
|
curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d vicare -p <pr-number>
|
|
230
227
|
```
|
|
231
|
-
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from datetime import datetime
|
|
3
|
+
from typing import ClassVar
|
|
3
4
|
|
|
4
5
|
from PyViCare.PyViCareAbstractOAuthManager import AbstractViCareOAuthManager
|
|
5
6
|
from PyViCare.PyViCareBrowserOAuthManager import ViCareBrowserOAuthManager
|
|
@@ -70,7 +71,7 @@ class PyViCare:
|
|
|
70
71
|
self.devices = [d for d in self.all_devices
|
|
71
72
|
if d.device_type in self.SUPPORTED_DEVICE_TYPES]
|
|
72
73
|
|
|
73
|
-
SUPPORTED_DEVICE_TYPES = [
|
|
74
|
+
SUPPORTED_DEVICE_TYPES: ClassVar[list[str]] = [
|
|
74
75
|
"heating", "zigbee", "vitoconnect", "electricityStorage",
|
|
75
76
|
"tcu", "ventilation", "roomControl", "systemController",
|
|
76
77
|
"outdoorUnit",
|
|
@@ -90,7 +91,7 @@ class PyViCare:
|
|
|
90
91
|
yield PyViCareDeviceConfig(accessor, service, device.modelId, device.status, device.deviceType, device.roles)
|
|
91
92
|
|
|
92
93
|
|
|
93
|
-
class DictWrap
|
|
94
|
+
class DictWrap:
|
|
94
95
|
def __init__(self, d):
|
|
95
96
|
for k, v in d.items():
|
|
96
97
|
setattr(self, k, Wrap(v))
|
|
@@ -2,15 +2,17 @@ import logging
|
|
|
2
2
|
from abc import abstractmethod
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
|
-
from authlib.integrations.base_client import
|
|
5
|
+
from authlib.integrations.base_client import InvalidTokenError, TokenExpiredError
|
|
6
6
|
from authlib.integrations.requests_client import OAuth2Session
|
|
7
7
|
|
|
8
8
|
from PyViCare import Feature
|
|
9
|
-
from PyViCare.PyViCareUtils import (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
from PyViCare.PyViCareUtils import (
|
|
10
|
+
PyViCareCommandError,
|
|
11
|
+
PyViCareDeviceCommunicationError,
|
|
12
|
+
PyViCareInternalServerError,
|
|
13
|
+
PyViCareNotPaidForError,
|
|
14
|
+
PyViCareRateLimitError,
|
|
15
|
+
)
|
|
14
16
|
|
|
15
17
|
logger = logging.getLogger(__name__)
|
|
16
18
|
logger.addHandler(logging.NullHandler())
|
|
@@ -15,8 +15,10 @@ from PyViCare.PyViCareAbstractOAuthManager import (
|
|
|
15
15
|
TOKEN_URL,
|
|
16
16
|
AbstractViCareOAuthManager,
|
|
17
17
|
)
|
|
18
|
-
from PyViCare.PyViCareUtils import (
|
|
19
|
-
|
|
18
|
+
from PyViCare.PyViCareUtils import (
|
|
19
|
+
PyViCareBrowserOAuthTimeoutReachedError,
|
|
20
|
+
PyViCareInvalidCredentialsError,
|
|
21
|
+
)
|
|
20
22
|
|
|
21
23
|
logger = logging.getLogger(__name__)
|
|
22
24
|
logger.addHandler(logging.NullHandler())
|
|
@@ -109,5 +111,4 @@ class ViCareBrowserOAuthManager(AbstractViCareOAuthManager):
|
|
|
109
111
|
return OAuth2Session(self.client_id, token=token)
|
|
110
112
|
|
|
111
113
|
def renewToken(self) -> None: # type: ignore
|
|
112
|
-
|
|
113
|
-
self.oauth_session.refresh_token(TOKEN_URL, refresh_token=refresh_token)
|
|
114
|
+
self.oauth_session.refresh_token(TOKEN_URL)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from PyViCare.PyViCareAbstractOAuthManager import AbstractViCareOAuthManager
|
|
5
5
|
from PyViCare.PyViCareCachedServiceBase import ViCareCachedServiceBase
|
|
@@ -11,7 +11,7 @@ logger.addHandler(logging.NullHandler())
|
|
|
11
11
|
|
|
12
12
|
class ViCareCachedService(ViCareCachedServiceBase, ViCareService):
|
|
13
13
|
|
|
14
|
-
def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles:
|
|
14
|
+
def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles: list[str], cacheDuration: int) -> None:
|
|
15
15
|
ViCareService.__init__(self, oauth_manager, roles)
|
|
16
16
|
self._init_cache(cacheDuration)
|
|
17
17
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import threading
|
|
3
3
|
from datetime import datetime
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from PyViCare.PyViCareService import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from PyViCare.PyViCareService import ViCareDeviceAccessor, ViCareService, readFeature
|
|
7
|
+
from PyViCare.PyViCareUtils import (
|
|
8
|
+
PyViCareDeviceCommunicationError,
|
|
9
|
+
PyViCareInternalServerError,
|
|
10
|
+
PyViCareInvalidDataError,
|
|
11
|
+
PyViCareNotPaidForError,
|
|
12
|
+
PyViCareNotSupportedFeatureError,
|
|
13
|
+
ViCareTimer,
|
|
14
|
+
)
|
|
14
15
|
|
|
15
16
|
logger = logging.getLogger(__name__)
|
|
16
17
|
logger.addHandler(logging.NullHandler())
|
|
@@ -25,9 +26,9 @@ class ViCareCachedServiceBase(ViCareService):
|
|
|
25
26
|
|
|
26
27
|
def _init_cache(self, cacheDuration: int) -> None:
|
|
27
28
|
self._cacheDuration = cacheDuration
|
|
28
|
-
self._cache:
|
|
29
|
-
self._cacheTime:
|
|
30
|
-
self._cacheError:
|
|
29
|
+
self._cache: dict | None = None
|
|
30
|
+
self._cacheTime: datetime | None = None
|
|
31
|
+
self._cacheError: Exception | None = None
|
|
31
32
|
self._cacheLock = threading.Lock()
|
|
32
33
|
|
|
33
34
|
def getProperty(self, accessor: ViCareDeviceAccessor, property_name: str) -> Any:
|
|
@@ -5,7 +5,9 @@ from PyViCare.PyViCareAbstractOAuthManager import AbstractViCareOAuthManager
|
|
|
5
5
|
from PyViCare.PyViCareCachedServiceBase import ViCareCachedServiceBase
|
|
6
6
|
from PyViCare.PyViCareService import ViCareDeviceAccessor
|
|
7
7
|
from PyViCare.PyViCareServiceViaGateway import (
|
|
8
|
-
ViCareServiceViaGateway,
|
|
8
|
+
ViCareServiceViaGateway,
|
|
9
|
+
filter_features_for_device,
|
|
10
|
+
)
|
|
9
11
|
|
|
10
12
|
logger = logging.getLogger(__name__)
|
|
11
13
|
logger.addHandler(logging.NullHandler())
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
3
|
from PyViCare.PyViCareService import ViCareDeviceAccessor, ViCareService, hasRoles
|
|
4
|
-
from PyViCare.PyViCareUtils import
|
|
4
|
+
from PyViCare.PyViCareUtils import (
|
|
5
|
+
PyViCareNotSupportedFeatureError,
|
|
6
|
+
handleAPICommandErrors,
|
|
7
|
+
handleNotSupported,
|
|
8
|
+
)
|
|
5
9
|
|
|
6
10
|
|
|
7
11
|
class Device:
|
|
@@ -2,9 +2,10 @@ import json
|
|
|
2
2
|
import logging
|
|
3
3
|
import re
|
|
4
4
|
|
|
5
|
+
from PyViCare.PyViCareElectricalEnergySystem import ElectricalEnergySystem
|
|
5
6
|
from PyViCare.PyViCareFloorHeating import FloorHeating, FloorHeatingChannel
|
|
6
7
|
from PyViCare.PyViCareFuelCell import FuelCell
|
|
7
|
-
from PyViCare.
|
|
8
|
+
from PyViCare.PyViCareGateway import Gateway
|
|
8
9
|
from PyViCare.PyViCareGazBoiler import GazBoiler
|
|
9
10
|
from PyViCare.PyViCareHeatingDevice import HeatingDevice
|
|
10
11
|
from PyViCare.PyViCareHeatPump import HeatPump
|
|
@@ -12,12 +13,15 @@ from PyViCare.PyViCareHybrid import Hybrid
|
|
|
12
13
|
from PyViCare.PyViCareOilBoiler import OilBoiler
|
|
13
14
|
from PyViCare.PyViCarePelletsBoiler import PelletsBoiler
|
|
14
15
|
from PyViCare.PyViCareRadiatorActuator import RadiatorActuator
|
|
15
|
-
from PyViCare.PyViCareRoomSensor import RoomSensor
|
|
16
16
|
from PyViCare.PyViCareRepeater import Repeater
|
|
17
|
-
from PyViCare.
|
|
18
|
-
from PyViCare.
|
|
19
|
-
from PyViCare.PyViCareService import (
|
|
20
|
-
|
|
17
|
+
from PyViCare.PyViCareRoomControl import RoomControl
|
|
18
|
+
from PyViCare.PyViCareRoomSensor import RoomSensor
|
|
19
|
+
from PyViCare.PyViCareService import (
|
|
20
|
+
ViCareDeviceAccessor,
|
|
21
|
+
ViCareService,
|
|
22
|
+
hasRoles,
|
|
23
|
+
is_gateway_role,
|
|
24
|
+
)
|
|
21
25
|
from PyViCare.PyViCareUtils import PyViCareNotPaidForError
|
|
22
26
|
from PyViCare.PyViCareVentilationDevice import VentilationDevice
|
|
23
27
|
from PyViCare.PyViCareWaterTreatment import WaterTreatment
|
|
@@ -143,10 +147,10 @@ class PyViCareDeviceConfig:
|
|
|
143
147
|
if re.search(type_name, self.device_model) or self.hasRoles(roles):
|
|
144
148
|
logger.info("detected %s %s", self.device_model, creator_method.__name__)
|
|
145
149
|
device = creator_method()
|
|
146
|
-
if isinstance(device, (GazBoiler, HeatPump)) and not isinstance(device, Hybrid)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
if (isinstance(device, (GazBoiler, HeatPump)) and not isinstance(device, Hybrid)
|
|
151
|
+
and self._isHybridByFeatures()):
|
|
152
|
+
logger.info("upgrading %s to Hybrid based on API features", self.device_model)
|
|
153
|
+
return self.asHybridDevice()
|
|
150
154
|
return device
|
|
151
155
|
|
|
152
156
|
logger.info("Could not auto detect %s. Use generic device.", self.device_model)
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
|
-
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
+
HeatingDevice,
|
|
5
|
+
HeatingDeviceWithComponent,
|
|
6
|
+
get_available_burners,
|
|
7
|
+
)
|
|
6
8
|
from PyViCare.PyViCareUtils import handleNotSupported
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
class FuelCell(HeatingDevice):
|
|
10
12
|
|
|
11
13
|
@property
|
|
12
|
-
def burners(self) ->
|
|
13
|
-
return
|
|
14
|
+
def burners(self) -> list[Any]:
|
|
15
|
+
return [self.getBurner(x) for x in self.getAvailableBurners()]
|
|
14
16
|
|
|
15
17
|
def getBurner(self, burner):
|
|
16
18
|
return FuelCellBurner(self, burner)
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
|
-
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
+
HeatingDevice,
|
|
5
|
+
HeatingDeviceWithComponent,
|
|
6
|
+
get_available_burners,
|
|
7
|
+
)
|
|
6
8
|
from PyViCare.PyViCareUtils import handleNotSupported
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
class GazBoiler(HeatingDevice):
|
|
10
12
|
|
|
11
13
|
@property
|
|
12
|
-
def burners(self) ->
|
|
13
|
-
return
|
|
14
|
+
def burners(self) -> list[Any]:
|
|
15
|
+
return [self.getBurner(x) for x in self.getAvailableBurners()]
|
|
14
16
|
|
|
15
17
|
def getBurner(self, burner):
|
|
16
18
|
return GazBurner(self, burner)
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
+
|
|
2
3
|
from contextlib import suppress
|
|
3
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
4
6
|
from deprecated import deprecated
|
|
5
7
|
|
|
6
8
|
from PyViCare.PyViCareHeatingDevice import HeatingDevice, HeatingDeviceWithComponent
|
|
7
|
-
from PyViCare.PyViCareUtils import (
|
|
8
|
-
|
|
9
|
+
from PyViCare.PyViCareUtils import (
|
|
10
|
+
PyViCareNotSupportedFeatureError,
|
|
11
|
+
handleAPICommandErrors,
|
|
12
|
+
handleNotSupported,
|
|
13
|
+
)
|
|
9
14
|
from PyViCare.PyViCareVentilationDevice import VentilationDevice
|
|
10
15
|
|
|
11
16
|
|
|
12
17
|
class HeatPump(HeatingDevice, VentilationDevice):
|
|
13
18
|
|
|
14
19
|
@property
|
|
15
|
-
def compressors(self) ->
|
|
20
|
+
def compressors(self) -> list[Compressor]:
|
|
16
21
|
return [self.getCompressor(x) for x in self.getAvailableCompressors()]
|
|
17
22
|
|
|
18
23
|
def getCompressor(self, compressor) -> Compressor:
|
|
@@ -23,21 +28,21 @@ class HeatPump(HeatingDevice, VentilationDevice):
|
|
|
23
28
|
return self.getProperty("heating.compressors")["properties"]["enabled"]["value"]
|
|
24
29
|
|
|
25
30
|
@property
|
|
26
|
-
def condensors(self) ->
|
|
31
|
+
def condensors(self) -> list[Condensor]:
|
|
27
32
|
return [self.getCondensor(x) for x in self.getAvailableCompressors()]
|
|
28
33
|
|
|
29
34
|
def getCondensor(self, condensor) -> Condensor:
|
|
30
35
|
return Condensor(self, condensor)
|
|
31
36
|
|
|
32
37
|
@property
|
|
33
|
-
def evaporators(self) ->
|
|
38
|
+
def evaporators(self) -> list[Evaporator]:
|
|
34
39
|
return [self.getEvaporator(x) for x in self.getAvailableCompressors()]
|
|
35
40
|
|
|
36
41
|
def getEvaporator(self, evaporator) -> Evaporator:
|
|
37
42
|
return Evaporator(self, evaporator)
|
|
38
43
|
|
|
39
44
|
@property
|
|
40
|
-
def inverters(self) ->
|
|
45
|
+
def inverters(self) -> list[Inverter]:
|
|
41
46
|
return [self.getInverter(x) for x in self.getAvailableCompressors()]
|
|
42
47
|
|
|
43
48
|
def getInverter(self, inverter) -> Inverter:
|
|
@@ -532,7 +537,7 @@ class HeatPump(HeatingDevice, VentilationDevice):
|
|
|
532
537
|
|
|
533
538
|
# Cooling circuits
|
|
534
539
|
@property
|
|
535
|
-
def coolingCircuits(self) ->
|
|
540
|
+
def coolingCircuits(self) -> list[CoolingCircuit]:
|
|
536
541
|
return [self.getCoolingCircuit(x) for x in self.getAvailableCoolingCircuits()]
|
|
537
542
|
|
|
538
543
|
def getCoolingCircuit(self, circuit) -> CoolingCircuit:
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
from contextlib import suppress
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from PyViCare.PyViCareDevice import Device
|
|
5
|
-
from PyViCare.PyViCareService import hasRoles
|
|
6
5
|
from PyViCare.PyViCareHeatCurveCalculation import (
|
|
7
|
-
heat_curve_formular_variant1,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
heat_curve_formular_variant1,
|
|
7
|
+
heat_curve_formular_variant2,
|
|
8
|
+
)
|
|
9
|
+
from PyViCare.PyViCareService import hasRoles
|
|
10
|
+
from PyViCare.PyViCareUtils import (
|
|
11
|
+
VICARE_DAYS,
|
|
12
|
+
PyViCareNotSupportedFeatureError,
|
|
13
|
+
ViCareTimer,
|
|
14
|
+
handleAPICommandErrors,
|
|
15
|
+
handleNotSupported,
|
|
16
|
+
parse_time_as_delta,
|
|
17
|
+
time_as_delta,
|
|
18
|
+
)
|
|
13
19
|
|
|
14
20
|
VICARE_DHW_TEMP2 = "temp-2"
|
|
15
21
|
|
|
16
22
|
|
|
17
|
-
def all_set(_list:
|
|
23
|
+
def all_set(_list: list[Any]) -> bool:
|
|
18
24
|
return all(v is not None for v in _list)
|
|
19
25
|
|
|
20
26
|
|
|
@@ -42,8 +48,8 @@ class HeatingDevice(Device):
|
|
|
42
48
|
return int(self.getProperty("tcu.wifi")["properties"]["strength"]["value"])
|
|
43
49
|
|
|
44
50
|
@property
|
|
45
|
-
def circuits(self) ->
|
|
46
|
-
return
|
|
51
|
+
def circuits(self) -> list[Any]:
|
|
52
|
+
return [self.getCircuit(x) for x in self.getAvailableCircuits()]
|
|
47
53
|
|
|
48
54
|
def getCircuit(self, circuit):
|
|
49
55
|
return HeatingCircuit(self, circuit)
|
|
@@ -56,11 +62,11 @@ class HeatingDevice(Device):
|
|
|
56
62
|
return heat_curve_formular_variant1
|
|
57
63
|
|
|
58
64
|
@property
|
|
59
|
-
def burners(self) ->
|
|
65
|
+
def burners(self) -> list[Any]:
|
|
60
66
|
return []
|
|
61
67
|
|
|
62
68
|
@property
|
|
63
|
-
def compressors(self) ->
|
|
69
|
+
def compressors(self) -> list[Any]:
|
|
64
70
|
return []
|
|
65
71
|
|
|
66
72
|
@handleNotSupported
|
|
@@ -116,7 +122,7 @@ class HeatingDevice(Device):
|
|
|
116
122
|
for s in schedule[current_day]:
|
|
117
123
|
startTime = parse_time_as_delta(s["start"])
|
|
118
124
|
endTime = parse_time_as_delta(s["end"])
|
|
119
|
-
if startTime <= currentTime
|
|
125
|
+
if startTime <= currentTime <= endTime:
|
|
120
126
|
if s["mode"] == VICARE_DHW_TEMP2: # temp-2 overrides all other modes
|
|
121
127
|
return VICARE_DHW_TEMP2
|
|
122
128
|
mode = s["mode"]
|
|
@@ -295,6 +301,65 @@ class HeatingDevice(Device):
|
|
|
295
301
|
def activateOneTimeCharge(self):
|
|
296
302
|
return self.setProperty("heating.dhw.oneTimeCharge", "activate", {})
|
|
297
303
|
|
|
304
|
+
# Viessmann reports an unset holiday date as "" or "2000-01-01".
|
|
305
|
+
def _getHolidayDate(self, program: str, field: str) -> str | None:
|
|
306
|
+
value = self.getProperty(f"heating.operating.programs.{program}")["properties"][field]["value"]
|
|
307
|
+
return value if value not in ("", "2000-01-01") else None
|
|
308
|
+
|
|
309
|
+
@handleNotSupported
|
|
310
|
+
def getHolidayActive(self) -> bool:
|
|
311
|
+
return bool(self.getProperty("heating.operating.programs.holiday")["properties"]["active"]["value"])
|
|
312
|
+
|
|
313
|
+
@handleNotSupported
|
|
314
|
+
def getHolidayStart(self) -> str | None:
|
|
315
|
+
return self._getHolidayDate("holiday", "start")
|
|
316
|
+
|
|
317
|
+
@handleNotSupported
|
|
318
|
+
def getHolidayEnd(self) -> str | None:
|
|
319
|
+
return self._getHolidayDate("holiday", "end")
|
|
320
|
+
|
|
321
|
+
@handleAPICommandErrors
|
|
322
|
+
def scheduleHoliday(self, start: str, end: str):
|
|
323
|
+
"""Dates as YYYY-MM-DD. Whether end may equal start depends on the device."""
|
|
324
|
+
return self.setProperty("heating.operating.programs.holiday", "schedule", {'start': start, 'end': end})
|
|
325
|
+
|
|
326
|
+
@handleAPICommandErrors
|
|
327
|
+
def changeHolidayEndDate(self, end: str):
|
|
328
|
+
return self.setProperty("heating.operating.programs.holiday", "changeEndDate", {'end': end})
|
|
329
|
+
|
|
330
|
+
@handleAPICommandErrors
|
|
331
|
+
def unscheduleHoliday(self):
|
|
332
|
+
return self.setProperty("heating.operating.programs.holiday", "unschedule", {})
|
|
333
|
+
|
|
334
|
+
@handleNotSupported
|
|
335
|
+
def getHolidayAtHomeActive(self) -> bool:
|
|
336
|
+
return bool(self.getProperty("heating.operating.programs.holidayAtHome")["properties"]["active"]["value"])
|
|
337
|
+
|
|
338
|
+
@handleNotSupported
|
|
339
|
+
def getHolidayAtHomeStart(self) -> str | None:
|
|
340
|
+
return self._getHolidayDate("holidayAtHome", "start")
|
|
341
|
+
|
|
342
|
+
@handleNotSupported
|
|
343
|
+
def getHolidayAtHomeEnd(self) -> str | None:
|
|
344
|
+
return self._getHolidayDate("holidayAtHome", "end")
|
|
345
|
+
|
|
346
|
+
@handleAPICommandErrors
|
|
347
|
+
def scheduleHolidayAtHome(self, start: str, end: str):
|
|
348
|
+
"""Dates as YYYY-MM-DD. Whether end may equal start depends on the device."""
|
|
349
|
+
return self.setProperty("heating.operating.programs.holidayAtHome", "schedule", {'start': start, 'end': end})
|
|
350
|
+
|
|
351
|
+
@handleAPICommandErrors
|
|
352
|
+
def changeHolidayAtHomeEndDate(self, end: str):
|
|
353
|
+
return self.setProperty("heating.operating.programs.holidayAtHome", "changeEndDate", {'end': end})
|
|
354
|
+
|
|
355
|
+
@handleAPICommandErrors
|
|
356
|
+
def unscheduleHolidayAtHome(self):
|
|
357
|
+
return self.setProperty("heating.operating.programs.holidayAtHome", "unschedule", {})
|
|
358
|
+
|
|
359
|
+
@handleAPICommandErrors
|
|
360
|
+
def setDomesticHotWaterSchedule(self, schedule: dict) -> None:
|
|
361
|
+
self.setProperty("heating.dhw.schedule", "setSchedule", {'newSchedule': schedule})
|
|
362
|
+
|
|
298
363
|
@handleAPICommandErrors
|
|
299
364
|
def setDomesticHotWaterCirculationSchedule(self, schedule):
|
|
300
365
|
return self.setProperty("heating.dhw.pumps.circulation.schedule", "setSchedule",
|
|
@@ -339,7 +404,7 @@ class HeatingDevice(Device):
|
|
|
339
404
|
for s in schedule[current_day]:
|
|
340
405
|
startTime = parse_time_as_delta(s["start"])
|
|
341
406
|
endTime = parse_time_as_delta(s["end"])
|
|
342
|
-
if startTime <= currentTime
|
|
407
|
+
if startTime <= currentTime <= endTime:
|
|
343
408
|
return s["mode"]
|
|
344
409
|
return schedule['default_mode']
|
|
345
410
|
|
|
@@ -588,6 +653,10 @@ class HeatingCircuit(HeatingDeviceWithComponent):
|
|
|
588
653
|
self.getProperty(f"heating.circuits.{self.circuit}.operating.modes.active")["properties"]["value"][
|
|
589
654
|
"value"]
|
|
590
655
|
|
|
656
|
+
@handleNotSupported
|
|
657
|
+
def getCoolingActive(self):
|
|
658
|
+
return self.getProperty(f"heating.circuits.{self.circuit}.operating.modes.cooling")["properties"]["active"]["value"]
|
|
659
|
+
|
|
591
660
|
@handleNotSupported
|
|
592
661
|
def getHeatingCurveShift(self):
|
|
593
662
|
return self.getProperty(f"heating.circuits.{self.circuit}.heating.curve")["properties"]["shift"][
|
|
@@ -716,7 +785,7 @@ class HeatingCircuit(HeatingDeviceWithComponent):
|
|
|
716
785
|
|
|
717
786
|
# Calculates target supply temperature based on data from Viessmann
|
|
718
787
|
# See: https://www.viessmann-community.com/t5/Gas/Mathematische-Formel-fuer-Vorlauftemperatur-aus-den-vier/m-p/68890#M27556
|
|
719
|
-
def getTargetSupplyTemperature(self) ->
|
|
788
|
+
def getTargetSupplyTemperature(self) -> float | None:
|
|
720
789
|
inside = None
|
|
721
790
|
outside = None
|
|
722
791
|
shift = None
|
|
@@ -18,8 +18,10 @@ from PyViCare.PyViCareAbstractOAuthManager import (
|
|
|
18
18
|
TOKEN_URL,
|
|
19
19
|
AbstractViCareOAuthManager,
|
|
20
20
|
)
|
|
21
|
-
from PyViCare.PyViCareUtils import (
|
|
22
|
-
|
|
21
|
+
from PyViCare.PyViCareUtils import (
|
|
22
|
+
PyViCareInvalidConfigurationError,
|
|
23
|
+
PyViCareInvalidCredentialsError,
|
|
24
|
+
)
|
|
23
25
|
|
|
24
26
|
logger = logging.getLogger(__name__)
|
|
25
27
|
logger.addHandler(logging.NullHandler())
|
|
@@ -184,10 +186,9 @@ class ViCareOAuthManager(AbstractViCareOAuthManager):
|
|
|
184
186
|
return None
|
|
185
187
|
|
|
186
188
|
logger.info("Token file exists")
|
|
187
|
-
with suppress(UnpicklingError):
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return s_token
|
|
189
|
+
with suppress(UnpicklingError), open(token_file, mode='rb') as binary_file:
|
|
190
|
+
s_token = pickle.load(binary_file)
|
|
191
|
+
logger.info("Token restored from file")
|
|
192
|
+
return s_token
|
|
192
193
|
logger.warning("Could not restore token")
|
|
193
194
|
return None
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
|
-
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
+
HeatingDevice,
|
|
5
|
+
HeatingDeviceWithComponent,
|
|
6
|
+
get_available_burners,
|
|
7
|
+
)
|
|
6
8
|
from PyViCare.PyViCareUtils import handleNotSupported
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
class OilBoiler(HeatingDevice):
|
|
10
12
|
|
|
11
13
|
@property
|
|
12
|
-
def burners(self) ->
|
|
13
|
-
return
|
|
14
|
+
def burners(self) -> list[Any]:
|
|
15
|
+
return [self.getBurner(x) for x in self.getAvailableBurners()]
|
|
14
16
|
|
|
15
17
|
def getBurner(self, burner):
|
|
16
18
|
return OilBurner(self, burner)
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from typing import List
|
|
3
2
|
|
|
4
|
-
from PyViCare.PyViCareHeatingDevice import (
|
|
3
|
+
from PyViCare.PyViCareHeatingDevice import (
|
|
4
|
+
HeatingDevice,
|
|
5
|
+
HeatingDeviceWithComponent,
|
|
6
|
+
get_available_burners,
|
|
7
|
+
)
|
|
5
8
|
from PyViCare.PyViCareUtils import handleNotSupported
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class PelletsBoiler(HeatingDevice):
|
|
9
12
|
|
|
10
13
|
@property
|
|
11
|
-
def burners(self) ->
|
|
12
|
-
return
|
|
14
|
+
def burners(self) -> list[PelletsBurner]:
|
|
15
|
+
return [self.getBurner(x) for x in self.getAvailableBurners()]
|
|
13
16
|
|
|
14
17
|
def getBurner(self, burner) -> PelletsBurner:
|
|
15
18
|
return PelletsBurner(self, burner)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import re
|
|
2
|
+
from typing import Any
|
|
2
3
|
|
|
3
4
|
from PyViCare.PyViCareDevice import Device
|
|
5
|
+
from PyViCare.PyViCareHeatingDevice import HeatingDeviceWithComponent
|
|
4
6
|
from PyViCare.PyViCareUtils import handleNotSupported
|
|
5
7
|
|
|
6
8
|
|
|
@@ -18,7 +20,8 @@ class RoomControl(Device):
|
|
|
18
20
|
|
|
19
21
|
IoT scope no longer exposes a `rooms` parent feature, so we scan
|
|
20
22
|
the full feature list for `rooms.<n>.*` prefixes and report the
|
|
21
|
-
unique numeric indices, sorted numerically.
|
|
23
|
+
unique numeric indices, sorted numerically. Placeholder slots whose
|
|
24
|
+
features are all disabled are skipped.
|
|
22
25
|
"""
|
|
23
26
|
features = self.service.fetch_all_features(self.accessor).get("data", [])
|
|
24
27
|
ids = set()
|
|
@@ -26,10 +29,14 @@ class RoomControl(Device):
|
|
|
26
29
|
for feature in features:
|
|
27
30
|
name = feature.get("feature", "")
|
|
28
31
|
match = pattern.match(name)
|
|
29
|
-
if match:
|
|
32
|
+
if match and feature.get("isEnabled"):
|
|
30
33
|
ids.add(match.group(1))
|
|
31
34
|
return sorted(ids, key=int)
|
|
32
35
|
|
|
36
|
+
@property
|
|
37
|
+
def rooms(self) -> list[Any]:
|
|
38
|
+
return [Room(self, room_id) for room_id in self.getAvailableRoomIds()]
|
|
39
|
+
|
|
33
40
|
# --- sensor readings ---
|
|
34
41
|
|
|
35
42
|
@handleNotSupported
|
|
@@ -112,3 +119,24 @@ class RoomControl(Device):
|
|
|
112
119
|
@handleNotSupported
|
|
113
120
|
def getRoomHeatOnTimeEnabled(self, room_id: str) -> bool:
|
|
114
121
|
return bool(self.getProperty(f"rooms.{room_id}.configuration.heatOnTime")["properties"]["active"]["value"])
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class Room(HeatingDeviceWithComponent):
|
|
125
|
+
"""One room of a RoomControl device."""
|
|
126
|
+
|
|
127
|
+
def __init__(self, device: RoomControl, room_id: str) -> None:
|
|
128
|
+
# The base class only uses service and getProperty, which RoomControl has.
|
|
129
|
+
super().__init__(device, room_id) # type: ignore[arg-type]
|
|
130
|
+
self.room_control = device
|
|
131
|
+
|
|
132
|
+
def getTemperature(self):
|
|
133
|
+
return self.room_control.getRoomTemperature(self.id)
|
|
134
|
+
|
|
135
|
+
def getHumidity(self):
|
|
136
|
+
return self.room_control.getRoomHumidity(self.id)
|
|
137
|
+
|
|
138
|
+
def getCO2(self):
|
|
139
|
+
return self.room_control.getRoomCO2(self.id)
|
|
140
|
+
|
|
141
|
+
def getCondensationRisk(self):
|
|
142
|
+
return self.room_control.getRoomCondensationRisk(self.id)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any
|
|
4
4
|
|
|
5
5
|
from PyViCare.PyViCareAbstractOAuthManager import AbstractViCareOAuthManager
|
|
6
6
|
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError
|
|
@@ -17,7 +17,7 @@ def readFeature(entities, property_name):
|
|
|
17
17
|
|
|
18
18
|
return feature
|
|
19
19
|
|
|
20
|
-
def hasRoles(requested_roles:
|
|
20
|
+
def hasRoles(requested_roles: list[str], existing_roles: list[str]) -> bool:
|
|
21
21
|
return len(requested_roles) > 0 and set(requested_roles).issubset(set(existing_roles))
|
|
22
22
|
|
|
23
23
|
GATEWAY_ROLES = [
|
|
@@ -28,7 +28,7 @@ GATEWAY_ROLES = [
|
|
|
28
28
|
"type:gateway;TCU300",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
|
-
def is_gateway_role(roles:
|
|
31
|
+
def is_gateway_role(roles: list[str]) -> bool:
|
|
32
32
|
return any(hasRoles([role], roles) for role in GATEWAY_ROLES)
|
|
33
33
|
|
|
34
34
|
def buildSetPropertyUrl(accessor, property_name, action):
|
|
@@ -41,7 +41,7 @@ class ViCareDeviceAccessor:
|
|
|
41
41
|
self.device_id = device_id
|
|
42
42
|
|
|
43
43
|
class ViCareService:
|
|
44
|
-
def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles:
|
|
44
|
+
def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles: list[str]) -> None:
|
|
45
45
|
self.oauth_manager = oauth_manager
|
|
46
46
|
self.roles = roles
|
|
47
47
|
|
|
@@ -2,8 +2,7 @@ import logging
|
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
4
|
from PyViCare.PyViCareAbstractOAuthManager import AbstractViCareOAuthManager
|
|
5
|
-
from PyViCare.PyViCareService import
|
|
6
|
-
readFeature)
|
|
5
|
+
from PyViCare.PyViCareService import ViCareDeviceAccessor, ViCareService, readFeature
|
|
7
6
|
|
|
8
7
|
logger = logging.getLogger(__name__)
|
|
9
8
|
logger.addHandler(logging.NullHandler())
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
from contextlib import suppress
|
|
2
|
+
|
|
2
3
|
from deprecated import deprecated
|
|
3
4
|
|
|
4
5
|
from PyViCare.PyViCareDevice import Device
|
|
5
|
-
from PyViCare.PyViCareUtils import (
|
|
6
|
+
from PyViCare.PyViCareUtils import (
|
|
7
|
+
PyViCareNotSupportedFeatureError,
|
|
8
|
+
handleAPICommandErrors,
|
|
9
|
+
handleNotSupported,
|
|
10
|
+
)
|
|
6
11
|
|
|
7
12
|
|
|
8
13
|
class VentilationDevice(Device):
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
from contextlib import suppress
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from PyViCare.PyViCareDevice import Device
|
|
5
5
|
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleNotSupported
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
_LEAK_SENSOR_SLOTS = 5
|
|
9
8
|
|
|
10
9
|
|
|
@@ -42,11 +41,11 @@ class WaterTreatment(Device):
|
|
|
42
41
|
# --- Leak Detection ---
|
|
43
42
|
|
|
44
43
|
@property
|
|
45
|
-
def leakSensors(self) ->
|
|
44
|
+
def leakSensors(self) -> list["LeakSensor"]:
|
|
46
45
|
return [LeakSensor(self, slot) for slot in self.getAvailableLeakSensorSlots()]
|
|
47
46
|
|
|
48
|
-
def getAvailableLeakSensorSlots(self) ->
|
|
49
|
-
available:
|
|
47
|
+
def getAvailableLeakSensorSlots(self) -> list[int]:
|
|
48
|
+
available: list[int] = []
|
|
50
49
|
for slot in range(_LEAK_SENSOR_SLOTS):
|
|
51
50
|
with suppress(PyViCareNotSupportedFeatureError):
|
|
52
51
|
feature = self.getProperty(f"water.leakDetection.sensors.leakage.{slot}")
|
|
@@ -116,14 +115,14 @@ class LeakSensor:
|
|
|
116
115
|
def getRssi(self) -> int:
|
|
117
116
|
return int(self.getProperty(f"water.leakDetection.sensors.leakage.{self.slot}.rssi")["properties"]["value"]["value"])
|
|
118
117
|
|
|
119
|
-
def getHardwareVersion(self) ->
|
|
118
|
+
def getHardwareVersion(self) -> dict[str, int] | None:
|
|
120
119
|
try:
|
|
121
120
|
feature = self.getProperty(f"water.leakDetection.sensors.leakage.{self.slot}.version.hardware")
|
|
122
121
|
except PyViCareNotSupportedFeatureError:
|
|
123
122
|
return None
|
|
124
123
|
return self._versionFields(feature.get("properties") or {})
|
|
125
124
|
|
|
126
|
-
def getSoftwareVersion(self) ->
|
|
125
|
+
def getSoftwareVersion(self) -> dict[str, int] | None:
|
|
127
126
|
try:
|
|
128
127
|
feature = self.getProperty(f"water.leakDetection.sensors.leakage.{self.slot}.version.software")
|
|
129
128
|
except PyViCareNotSupportedFeatureError:
|
|
@@ -131,7 +130,7 @@ class LeakSensor:
|
|
|
131
130
|
return self._versionFields(feature.get("properties") or {})
|
|
132
131
|
|
|
133
132
|
@staticmethod
|
|
134
|
-
def _versionFields(props: dict[str, Any]) ->
|
|
133
|
+
def _versionFields(props: dict[str, Any]) -> dict[str, int] | None:
|
|
135
134
|
if not props:
|
|
136
135
|
return None
|
|
137
136
|
return {
|
|
@@ -1,61 +1,67 @@
|
|
|
1
|
-
[
|
|
1
|
+
[project]
|
|
2
2
|
name = "PyViCare"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.64.0"
|
|
4
4
|
description = "Library to communicate with the Viessmann ViCare API."
|
|
5
|
-
authors = [
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
authors = [{ name = "Simon Gillet", email = "mail+pyvicare@gillet.ninja" }]
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
license = "Apache-2.0"
|
|
8
9
|
maintainers = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
{ name = "Christopher Fenner", email = "fenner.christopher@gmail.com" },
|
|
11
|
+
{ name = "Martin" },
|
|
12
|
+
{ name = "Lukas Wöhrl" },
|
|
12
13
|
]
|
|
13
|
-
license = "Apache-2.0"
|
|
14
|
-
readme = "README.md"
|
|
15
|
-
homepage = "https://github.com/openviess/PyViCare"
|
|
16
|
-
repository = "https://github.com/openviess/PyViCare"
|
|
17
|
-
documentation = "https://github.com/openviess/PyViCare"
|
|
18
14
|
keywords = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
"viessmann",
|
|
16
|
+
"vicare",
|
|
17
|
+
"api",
|
|
22
18
|
]
|
|
23
19
|
classifiers = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"Operating System :: OS Independent",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Natural Language :: English",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"License :: OSI Approved :: Apache Software License",
|
|
28
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
35
30
|
]
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
dependencies = [
|
|
32
|
+
"authlib>1.2.0",
|
|
33
|
+
"requests>=2.31.0",
|
|
34
|
+
"deprecated>=1.3.0,<2",
|
|
38
35
|
]
|
|
39
36
|
|
|
40
|
-
[
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/openviess/PyViCare"
|
|
39
|
+
Repository = "https://github.com/openviess/PyViCare"
|
|
40
|
+
Documentation = "https://github.com/openviess/PyViCare"
|
|
41
41
|
"Bug Tracker" = "https://github.com/openviess/PyViCare/issues"
|
|
42
42
|
Changelog = "https://github.com/openviess/PyViCare/releases"
|
|
43
43
|
|
|
44
|
-
[
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"codespell==2.4.3",
|
|
47
|
+
"mypy==2.4.1",
|
|
48
|
+
"pylint==4.1.3",
|
|
49
|
+
"pytest==9.1.1",
|
|
50
|
+
"pytest-cov==7.1.0",
|
|
51
|
+
"ruff==0.17.3",
|
|
52
|
+
"types-deprecated>=1.2.15.20241117,<2",
|
|
53
|
+
"types-requests>=2.31",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[tool.hatch.build.targets.sdist]
|
|
57
|
+
include = ["PyViCare"]
|
|
58
|
+
|
|
59
|
+
[tool.hatch.build.targets.wheel]
|
|
60
|
+
packages = ["PyViCare"]
|
|
49
61
|
|
|
50
|
-
[
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
pylint = "4.0.10"
|
|
54
|
-
pytest = "9.1.1"
|
|
55
|
-
pytest-cov = "7.1.0"
|
|
56
|
-
ruff = "0.15.22"
|
|
57
|
-
types-deprecated = "^1.2.15.20241117"
|
|
58
|
-
types-requests = ">=2.31"
|
|
62
|
+
[build-system]
|
|
63
|
+
requires = ["hatchling"]
|
|
64
|
+
build-backend = "hatchling.build"
|
|
59
65
|
|
|
60
66
|
[tool.mypy]
|
|
61
67
|
# Specify the target platform details in config, so your developers are
|
|
@@ -91,6 +97,9 @@ warn_unused_ignores = true
|
|
|
91
97
|
module = "authlib.*"
|
|
92
98
|
ignore_missing_imports = true
|
|
93
99
|
|
|
100
|
+
[tool.pylint.MAIN]
|
|
101
|
+
py-version = "3.11"
|
|
102
|
+
|
|
94
103
|
[tool.pylint."MESSAGES CONTROL"]
|
|
95
104
|
disable = [
|
|
96
105
|
"duplicate-code",
|
|
@@ -118,6 +127,10 @@ disable = [
|
|
|
118
127
|
"useless-parent-delegation",
|
|
119
128
|
]
|
|
120
129
|
|
|
121
|
-
[
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
[tool.ruff.lint]
|
|
131
|
+
ignore = [
|
|
132
|
+
# module names are part of the public API (e.g. PyViCare.PyViCare)
|
|
133
|
+
"N999",
|
|
134
|
+
# switching to timezone-aware datetimes changes behavior
|
|
135
|
+
"DTZ",
|
|
136
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|