Skip to content

Commit e91229b

Browse files
committed
vicare: switched to new Vissmann API version v2.
1 parent 60458af commit e91229b

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

vicare/__init__.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
33
#########################################################################
4-
# Copyright 2023 Alexander Schwithal
4+
# Copyright 2025 Alexander Schwithal
55
#########################################################################
66
# This file is part of SmartHomeNG.
77
#
@@ -34,16 +34,12 @@
3434
# Necessary python package for funktion "generate_code_verifier":
3535
from authlib.common.security import generate_token
3636

37-
#AUTHORIZE_URL = 'https://iam.viessmann.com/idp/v3/authorize'
3837
AUTHORIZE_URL = 'https://iam.viessmann-climatesolutions.com/idp/v3/authorize'
39-
#TOKEN_URL = 'https://iam.viessmann.com/idp/v3/token'
4038
TOKEN_URL = 'https://iam.viessmann-climatesolutions.com/idp/v3/token'
41-
#API_URL = 'https://api.viessmann.com'
4239
API_URL = 'https://api.viessmann-climatesolutions.com'
4340

44-
4541
class Vicare(SmartPlugin):
46-
PLUGIN_VERSION = '1.9.6'
42+
PLUGIN_VERSION = '1.9.7'
4743

4844
def __init__(self, sh):
4945
"""
@@ -395,8 +391,7 @@ def checkErrors(self, response):
395391

396392

397393
def pollInstallationId(self):
398-
#old url = f"https://api.viessmann.com/iot/v1/equipment/installations"
399-
url = f"{API_URL}/iot/v1/equipment/installations"
394+
url = f"{API_URL}/iot/v2/equipment/installations"
400395

401396
response = self.pollUrlInterface(url)
402397

@@ -430,8 +425,7 @@ def pollInstallationId(self):
430425
self.logger.info(f"InstallationId is {self.installationId}")
431426

432427
def pollSerial(self):
433-
#old url = f"https://api.viessmann.com/iot/v1/equipment/gateways"
434-
url = f"{API_URL}/iot/v1/equipment/gateways"
428+
url = f"{API_URL}/iot/v2/equipment/gateways"
435429

436430
response = self.pollUrlInterface(url)
437431

@@ -440,7 +434,7 @@ def pollSerial(self):
440434
if response.status_code == 200:
441435
self.logger.debug(f"pollSerial request successfull")
442436
else:
443-
self.logger.warning(f"pollSerial request was unsuccessfull. Status code: {response.status_code}")
437+
self.logger.warning(f"pollSerial request was unsuccessfull. Status code: {response.status_code}, Text: {response.text}")
444438
return
445439

446440
if response.json() is not None:
@@ -466,8 +460,7 @@ def pollDevices(self):
466460
self.logger.debug(f"pollSerial, invalid installationId, aborting!")
467461
return
468462

469-
#old url = f"https://api.viessmann.com/iot/v1/equipment/installations/{self.installationId}/gateways/{self.gatewaySerial}/devices"
470-
url = f"{API_URL}/iot/v1/equipment/installations/{self.installationId}/gateways/{self.gatewaySerial}/devices"
463+
url = f"{API_URL}/iot/v2/equipment/installations/{self.installationId}/gateways/{self.gatewaySerial}/devices"
471464

472465
response = self.pollUrlInterface(url)
473466

@@ -476,7 +469,7 @@ def pollDevices(self):
476469
if response.status_code == 200:
477470
self.logger.debug(f"pollDevices request successfull: {response.text}")
478471
else:
479-
self.logger.warning(f"pollDevices request was unsuccessfull. Status code: {response.status_code}")
472+
self.logger.warning(f"pollDevicesrequest was unsuccessfull. Status code: {response.status_code}, Text: {response.text}")
480473
return
481474

482475
if response.json() is not None:
@@ -549,7 +542,6 @@ def pollFeatures(self):
549542
self.logger.debug(f"pollFeatures, invalid deviceId, aborting!")
550543
return
551544

552-
#old url = f"https://api.viessmann.com/iot/v2/features/installations/{self.installationId}/gateways/{self.gatewaySerial}/devices/{self.deviceId}/features"
553545
url = f"{API_URL}/iot/v2/features/installations/{self.installationId}/gateways/{self.gatewaySerial}/devices/{self.deviceId}/features"
554546

555547
response = self.pollUrlInterface(url)
@@ -795,7 +787,6 @@ def generateAPIToken(self, codeVerifier = ''):
795787
authorization_url, _ = oauth_session.create_authorization_url(AUTHORIZE_URL, code_verifier=codeVerifier)
796788
self.logger.warning(f"Authorization URL is: {authorization_url}")
797789

798-
799790
self.logger.warning(f"Debug: Sending authorization pos...")
800791
header = {'Content-Type': 'application/x-www-form-urlencoded'}
801792
response = requests.post(authorization_url, headers=header, auth=(self.user, self.password), allow_redirects=True)

vicare/plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ plugin:
1212
#documentation:
1313
support: https://knx-user-forum.de/forum/supportforen/smarthome-py/1916122-support-thread-f%C3%BCr-das-viessmann-plugin
1414

15-
version: 1.9.6 # Plugin version
16-
sh_minversion: '1.9.0' # minimum shNG version to use this plugin
15+
version: 1.9.7 # Plugin version
16+
sh_minversion: '1.9.0' # minimum shNG version to use this plugin
1717
#sh_maxversion: # maximum shNG version to use this plugin (leave empty if latest)
1818
multi_instance: False # plugin supports multi instance
1919
restartable: True

0 commit comments

Comments
 (0)