PyViCare 2.63.0__tar.gz → 2.65.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. pyvicare-2.65.0/.gitignore +123 -0
  2. {pyvicare-2.63.0 → pyvicare-2.65.0}/PKG-INFO +16 -19
  3. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCare.py +3 -2
  4. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareAbstractOAuthManager.py +8 -6
  5. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareBrowserOAuthManager.py +5 -4
  6. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareCachedService.py +2 -2
  7. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareCachedServiceBase.py +23 -15
  8. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareCachedServiceViaGateway.py +3 -1
  9. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareDevice.py +35 -1
  10. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareDeviceConfig.py +14 -10
  11. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareElectricalEnergySystem.py +67 -1
  12. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareFloorHeating.py +1 -1
  13. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareFuelCell.py +8 -6
  14. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareGazBoiler.py +8 -6
  15. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareHeatPump.py +100 -10
  16. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareHeatingDevice.py +158 -16
  17. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareOAuthManager.py +8 -7
  18. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareOilBoiler.py +8 -6
  19. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCarePelletsBoiler.py +7 -4
  20. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareRoomControl.py +30 -2
  21. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareService.py +4 -4
  22. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareServiceViaGateway.py +1 -2
  23. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareUtils.py +1 -1
  24. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareVentilationDevice.py +34 -1
  25. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareWaterTreatment.py +15 -8
  26. {pyvicare-2.63.0 → pyvicare-2.65.0}/pyproject.toml +61 -47
  27. {pyvicare-2.63.0 → pyvicare-2.65.0}/LICENSE +0 -0
  28. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/Feature.py +0 -0
  29. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareGateway.py +0 -0
  30. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareHeatCurveCalculation.py +0 -0
  31. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareHybrid.py +0 -0
  32. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareRadiatorActuator.py +0 -0
  33. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareRepeater.py +0 -0
  34. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/PyViCareRoomSensor.py +0 -0
  35. {pyvicare-2.63.0 → pyvicare-2.65.0}/PyViCare/__init__.py +0 -0
  36. {pyvicare-2.63.0 → pyvicare-2.65.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,33 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: PyViCare
3
- Version: 2.63.0
3
+ Version: 2.65.0
4
4
  Summary: Library to communicate with the Viessmann ViCare API.
5
- License: Apache-2.0
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: viessmann,vicare,api
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
25
  Classifier: Programming Language :: Python :: 3.15
24
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
- Requires-Dist: authlib (>1.2.0)
26
- Requires-Dist: deprecated (>=1.3.0,<2.0.0)
27
- Requires-Dist: requests (>=2.31.0)
28
- Project-URL: Bug Tracker, https://github.com/openviess/PyViCare/issues
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
27
+ Requires-Python: >=3.11
28
+ Requires-Dist: authlib>1.2.0
29
+ Requires-Dist: deprecated<2,>=1.3.0
30
+ Requires-Dist: requests>=2.31.0
33
31
  Description-Content-Type: text/markdown
34
32
 
35
33
  # PyViCare
@@ -228,4 +226,3 @@ To install `ViCare` as a custom component, one can use the terminal addon to ins
228
226
  ```sh
229
227
  curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d vicare -p <pr-number>
230
228
  ```
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(object):
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 TokenExpiredError, InvalidTokenError
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 (PyViCareCommandError,
10
- PyViCareDeviceCommunicationError,
11
- PyViCareInternalServerError,
12
- PyViCareNotPaidForError,
13
- PyViCareRateLimitError)
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 (PyViCareBrowserOAuthTimeoutReachedError,
19
- PyViCareInvalidCredentialsError)
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
- refresh_token = self.oauth_session.refresh_token
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, List
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: List[str], cacheDuration: int) -> None:
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, Optional
5
-
6
- from PyViCare.PyViCareService import (ViCareDeviceAccessor, ViCareService,
7
- readFeature)
8
- from PyViCare.PyViCareUtils import (PyViCareDeviceCommunicationError,
9
- PyViCareInternalServerError,
10
- PyViCareInvalidDataError,
11
- PyViCareNotPaidForError,
12
- PyViCareNotSupportedFeatureError,
13
- ViCareTimer)
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,10 +26,15 @@ class ViCareCachedServiceBase(ViCareService):
25
26
 
26
27
  def _init_cache(self, cacheDuration: int) -> None:
27
28
  self._cacheDuration = cacheDuration
28
- self._cache: Optional[dict] = None
29
- self._cacheTime: Optional[datetime] = None
30
- self._cacheError: Optional[Exception] = None
29
+ self._cache: dict | None = None
30
+ self._cacheTime: datetime | None = None
31
+ self._cacheError: Exception | None = None
31
32
  self._cacheLock = threading.Lock()
33
+ self._lastFetchTime: datetime | None = None
34
+
35
+ @property
36
+ def cache_time(self):
37
+ return self._cacheTime
32
38
 
33
39
  def getProperty(self, accessor: ViCareDeviceAccessor, property_name: str) -> Any:
34
40
  data = self._get_or_update_cache(accessor)
@@ -52,7 +58,7 @@ class ViCareCachedServiceBase(ViCareService):
52
58
  # to avoid consuming all the api calls if the api is down
53
59
  # see https://github.com/home-assistant/core/issues/67052
54
60
  # we simply return the old cache in this case
55
- self._cacheTime = ViCareTimer().now()
61
+ self._lastFetchTime = ViCareTimer().now()
56
62
  self._cacheError = None
57
63
 
58
64
  try:
@@ -77,6 +83,7 @@ class ViCareCachedServiceBase(ViCareService):
77
83
  raise
78
84
 
79
85
  self._cache = data
86
+ self._cacheTime = self._lastFetchTime
80
87
  elif self._cache is None and self._cacheError is not None:
81
88
  # The fetch that opened this window failed and left nothing to
82
89
  # read. Replaying its error keeps every other reader from
@@ -86,13 +93,14 @@ class ViCareCachedServiceBase(ViCareService):
86
93
  return self._cache
87
94
 
88
95
  def is_cache_invalid(self) -> bool:
89
- return self._cacheTime is None or (ViCareTimer().now() - self._cacheTime).seconds > self._cacheDuration
96
+ return self._lastFetchTime is None or (ViCareTimer().now() - self._lastFetchTime).seconds > self._cacheDuration
90
97
 
91
98
  def clear_cache(self):
92
99
  with self._cacheLock:
93
100
  self._cache = None
94
101
  self._cacheTime = None
95
102
  self._cacheError = None
103
+ self._lastFetchTime = None
96
104
 
97
105
  def _fetch_uncached(self, accessor: ViCareDeviceAccessor) -> Any:
98
106
  raise NotImplementedError
@@ -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, filter_features_for_device)
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 PyViCareNotSupportedFeatureError, handleAPICommandErrors, handleNotSupported
4
+ from PyViCare.PyViCareUtils import (
5
+ PyViCareNotSupportedFeatureError,
6
+ handleAPICommandErrors,
7
+ handleNotSupported,
8
+ )
5
9
 
6
10
 
7
11
  class Device:
@@ -30,6 +34,36 @@ class Device:
30
34
  def getDeviceErrors(self) -> list[Any]:
31
35
  return list[Any](self.getProperty("device.messages.errors.raw")["properties"]["entries"]["value"])
32
36
 
37
+ # Power consumption limitation (§14a EnWG):
38
+ @handleNotSupported
39
+ def getPowerConsumptionLimit(self) -> int:
40
+ return int(self.getProperty("device.power.statusReport.consumption")["properties"]["limit"]["value"])
41
+
42
+ @handleNotSupported
43
+ def getPowerConsumptionLimitUnit(self) -> str:
44
+ return str(self.getProperty("device.power.statusReport.consumption")["properties"]["limit"]["unit"])
45
+
46
+ @handleNotSupported
47
+ def getPowerConsumptionLimitStatus(self) -> str:
48
+ return str(self.getProperty("device.power.statusReport.consumption")["properties"]["status"]["value"])
49
+
50
+ @handleNotSupported
51
+ def getPowerConsumptionLimitationSource(self) -> str:
52
+ return str(self.getProperty("device.power.consumption.limitation")["properties"]["value"]["value"])
53
+
54
+ # Power production limitation (feed-in):
55
+ @handleNotSupported
56
+ def getPowerProductionLimit(self) -> int:
57
+ return int(self.getProperty("device.power.statusReport.production")["properties"]["limit"]["value"])
58
+
59
+ @handleNotSupported
60
+ def getPowerProductionLimitUnit(self) -> str:
61
+ return str(self.getProperty("device.power.statusReport.production")["properties"]["limit"]["unit"])
62
+
63
+ @handleNotSupported
64
+ def getPowerProductionLimitStatus(self) -> str:
65
+ return str(self.getProperty("device.power.statusReport.production")["properties"]["status"]["value"])
66
+
33
67
  def isLegacyDevice(self) -> bool:
34
68
  return hasRoles(["type:legacy"], self.roles)
35
69
 
@@ -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.PyViCareRoomControl import RoomControl
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.PyViCareElectricalEnergySystem import ElectricalEnergySystem
18
- from PyViCare.PyViCareGateway import Gateway
19
- from PyViCare.PyViCareService import (ViCareDeviceAccessor, ViCareService,
20
- hasRoles, is_gateway_role)
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
- if self._isHybridByFeatures():
148
- logger.info("upgrading %s to Hybrid based on API features", self.device_model)
149
- return self.asHybridDevice()
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,5 +1,5 @@
1
1
  from PyViCare.PyViCareDevice import Device
2
- from PyViCare.PyViCareUtils import handleNotSupported
2
+ from PyViCare.PyViCareUtils import handleAPICommandErrors, handleNotSupported
3
3
 
4
4
 
5
5
  class ElectricalEnergySystem(Device):
@@ -52,6 +52,54 @@ class ElectricalEnergySystem(Device):
52
52
  "value"
53
53
  ]
54
54
 
55
+ @handleNotSupported
56
+ def getPhotovoltaicInstalledPeakPower(self):
57
+ return self.getProperty("photovoltaic.installedPeakPower")["properties"][
58
+ "value"
59
+ ]["value"]
60
+
61
+ @handleNotSupported
62
+ def getPhotovoltaicInstalledPeakPowerUnit(self):
63
+ return self.getProperty("photovoltaic.installedPeakPower")["properties"][
64
+ "value"
65
+ ]["unit"]
66
+
67
+ @handleNotSupported
68
+ def getPhotovoltaicStrings(self):
69
+ return self.getProperty("photovoltaic.string")["properties"]["enabled"][
70
+ "value"
71
+ ]
72
+
73
+ @handleNotSupported
74
+ def getPhotovoltaicStringName(self, string):
75
+ return self.getProperty(f"photovoltaic.string.{string}")["properties"][
76
+ "name"
77
+ ]["value"]
78
+
79
+ @handleNotSupported
80
+ def getPhotovoltaicStringPower(self, string):
81
+ return self.getProperty(f"photovoltaic.string.{string}.power")["properties"][
82
+ "value"
83
+ ]["value"]
84
+
85
+ @handleNotSupported
86
+ def getPhotovoltaicStringPowerUnit(self, string):
87
+ return self.getProperty(f"photovoltaic.string.{string}.power")["properties"][
88
+ "value"
89
+ ]["unit"]
90
+
91
+ @handleNotSupported
92
+ def getPhotovoltaicStringVoltage(self, string):
93
+ return self.getProperty(f"photovoltaic.string.{string}.voltage")["properties"][
94
+ "value"
95
+ ]["value"]
96
+
97
+ @handleNotSupported
98
+ def getPhotovoltaicStringCurrent(self, string):
99
+ return self.getProperty(f"photovoltaic.string.{string}.electricity")[
100
+ "properties"
101
+ ]["value"]["value"]
102
+
55
103
  @handleNotSupported
56
104
  def getPhotovoltaicProductionCurrent(self):
57
105
  return self.getProperty("photovoltaic.production.current")[
@@ -185,3 +233,21 @@ class ElectricalEnergySystem(Device):
185
233
  return self.getProperty("ess.operationState")["properties"]["value"][
186
234
  "value"
187
235
  ]
236
+
237
+ @handleNotSupported
238
+ def getElectricalEnergySystemBatteryControlMode(self):
239
+ return self.getProperty("ess.battery.control.mode.active")["properties"][
240
+ "value"
241
+ ]["value"]
242
+
243
+ @handleNotSupported
244
+ def getElectricalEnergySystemBatteryControlModes(self):
245
+ return self.getProperty("ess.battery.control.mode.active")["commands"][
246
+ "setMode"
247
+ ]["params"]["value"]["constraints"]["enum"]
248
+
249
+ @handleAPICommandErrors
250
+ def setElectricalEnergySystemBatteryControlMode(self, mode: str):
251
+ return self.setProperty(
252
+ "ess.battery.control.mode.active", "setMode", {"value": mode}
253
+ )
@@ -1,4 +1,4 @@
1
- from PyViCare.PyViCareDevice import ZigbeeDevice, Device
1
+ from PyViCare.PyViCareDevice import Device, ZigbeeDevice
2
2
  from PyViCare.PyViCareUtils import handleAPICommandErrors, handleNotSupported
3
3
 
4
4
 
@@ -1,16 +1,18 @@
1
- from typing import Any, List
1
+ from typing import Any
2
2
 
3
- from PyViCare.PyViCareHeatingDevice import (HeatingDevice,
4
- HeatingDeviceWithComponent,
5
- get_available_burners)
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) -> List[Any]:
13
- return list([self.getBurner(x) for x in self.getAvailableBurners()])
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, List
1
+ from typing import Any
2
2
 
3
- from PyViCare.PyViCareHeatingDevice import (HeatingDevice,
4
- HeatingDeviceWithComponent,
5
- get_available_burners)
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) -> List[Any]:
13
- return list([self.getBurner(x) for x in self.getAvailableBurners()])
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)