Repository: somm15/PyViCare

Issue:
getCurrentDesiredTemperature for standby is throwing not supported error
The only "circuit"-function not working since the last api-update is getCurrentDesiredTemperature().
error-message: 

```
site-packages\PyViCare\PyViCareUtils.py", line 45, in feature_flag_wrapper return wrapper(*args, **kwargs)
site-packages\PyViCare\PyViCareUtils.py", line 40, in wrapper raise PyViCareNotSupportedFeatureError(func.__name__)
PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: getCurrentDesiredTemperature
```



_Originally posted by @kruemel746 in https://github.com/somm15/PyViCare/issues/194#issuecomment-931603388_

Discussion:

Patch:
diff --git a/PyViCare/PyViCareDevice.py b/PyViCare/PyViCareDevice.py
index 18a993d..cda7fa1 100644
--- a/PyViCare/PyViCareDevice.py
+++ b/PyViCare/PyViCareDevice.py
@@ -440,6 +440,8 @@ class HeatingCircuit(DeviceWithComponent):
     @handleNotSupported
     def getCurrentDesiredTemperature(self):
         active_programm = self.getActiveProgram()
+        if active_programm in ['standby']:
+            return None
         return self.service.getProperty(f"heating.circuits.{self.circuit}.operating.programs.{active_programm}")["properties"]["temperature"]["value"]
 
     @handleNotSupported


Test patch:
diff --git a/tests/test_Vitocal222S.py b/tests/test_Vitocal222S.py
index abe4f81..a85b510 100644
--- a/tests/test_Vitocal222S.py
+++ b/tests/test_Vitocal222S.py
@@ -14,3 +14,7 @@ class Vitocal222S(unittest.TestCase):
         with now_is('2000-01-01 10:10:00'):
             self.assertEqual(
                 self.device.getDomesticHotWaterActiveMode(), 'normal')
+
+    def test_getCurrentDesiredTemperature(self):
+        self.assertEqual(
+            self.device.circuits[0].getCurrentDesiredTemperature(), 23)
diff --git a/tests/test_Vitodens300W.py b/tests/test_Vitodens300W.py
index 82b7c35..50d3302 100644
--- a/tests/test_Vitodens300W.py
+++ b/tests/test_Vitodens300W.py
@@ -49,6 +49,10 @@ class Vitodens300W(unittest.TestCase):
         self.assertEqual(
             self.device.getDomesticHotWaterCirculationPumpActive(), True)
 
+    def test_getCurrentDesiredTemperature(self):
+        self.assertEqual(
+            self.device.circuits[0].getCurrentDesiredTemperature(), None)
+
     # Is currently (August, 2021) not supported by the Viessman API even though it works for the Vitodens 200W.
     def test_getDomesticHotWaterOutletTemperature(self):
         self.assertRaises(PyViCareNotSupportedFeatureError,