Repository: somm15/PyViCare

Issue:
Compressor feature 'phase' 
Hi, there is an additional feature to 'active' in heatpump/compressor that is 'phase'.  It can be easily read by adding 

    @handleNotSupported
    def getPhase(self):
        return self.service.getProperty(f"heating.compressors.{self.compressor}")["properties"]["phase"]["value"]

at the end of PyViCareHeatPump.py

I am not familiar with  github and won't mess-up the code. If it is interesting to the crowd, maybe it can be inserted at the next maintenance.

Discussion:

Patch:
diff --git a/PyViCare/PyViCareHeatPump.py b/PyViCare/PyViCareHeatPump.py
index 6a15ad7..3c407ba 100644
--- a/PyViCare/PyViCareHeatPump.py
+++ b/PyViCare/PyViCareHeatPump.py
@@ -138,3 +138,7 @@ class Compressor(HeatingDeviceWithComponent):
     @handleNotSupported
     def getActive(self):
         return self.service.getProperty(f"heating.compressors.{self.compressor}")["properties"]["active"]["value"]
+    
+    @handleNotSupported
+    def getPhase(self):
+        return self.service.getProperty(f"heating.compressors.{self.compressor}")["properties"]["phase"]["value"]


Test patch:
diff --git a/tests/test_Vitocal200.py b/tests/test_Vitocal200.py
index 39edcf1..202c14c 100644
--- a/tests/test_Vitocal200.py
+++ b/tests/test_Vitocal200.py
@@ -12,38 +12,42 @@ class Vitocal200(unittest.TestCase):
         self.device = HeatPump(self.service)
 
     def test_getCompressorActive(self):
-        self.assertEqual(self.device.compressors[0].getActive(), False)
+        self.assertEqual(self.device.getCompressor(0).getActive(), False)
 
     def test_getCompressorHours(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getHours(), 13651.9)
+            self.device.getCompressor(0).getHours(), 13651.9)
 
     def test_getAvailableCompressors(self):
         self.assertEqual(self.device.getAvailableCompressors(), ['0'])
 
     def test_getCompressorStarts(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getStarts(), 6973)
+            self.device.getCompressor(0).getStarts(), 6973)
 
     def test_getCompressorHoursLoadClass1(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getHoursLoadClass1(), 366)
+            self.device.getCompressor(0).getHoursLoadClass1(), 366)
 
     def test_getCompressorHoursLoadClass2(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getHoursLoadClass2(), 5579)
+            self.device.getCompressor(0).getHoursLoadClass2(), 5579)
 
     def test_getCompressorHoursLoadClass3(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getHoursLoadClass3(), 6024)
+            self.device.getCompressor(0).getHoursLoadClass3(), 6024)
 
     def test_getCompressorHoursLoadClass4(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getHoursLoadClass4(), 659)
+            self.device.getCompressor(0).getHoursLoadClass4(), 659)
 
     def test_getCompressorHoursLoadClass5(self):
         self.assertAlmostEqual(
-            self.device.compressors[0].getHoursLoadClass5(), 715)
+            self.device.getCompressor(0).getHoursLoadClass5(), 715)
+
+    def test_getCompressorPhase(self):
+        self.assertEqual(
+            self.device.getCompressor(0).getPhase(), "off")
 
     def test_getHeatingCurveSlope(self):
         self.assertAlmostEqual(
diff --git a/tests/test_Vitocal250A.py b/tests/test_Vitocal250A.py
index fbc904f..caa5148 100644
--- a/tests/test_Vitocal250A.py
+++ b/tests/test_Vitocal250A.py
@@ -124,3 +124,8 @@ class Vitocal250A(unittest.TestCase):
     def test_getPowerSummaryConsumptionDomesticHotWaterLastYear(self):
         self.assertEqual(
             self.device.getPowerSummaryConsumptionDomesticHotWaterLastYear(), 177.7)
+        
+    def test_getCompressorPhase(self):
+        self.assertEqual(
+            self.device.getCompressor(0).getPhase(), "ready")
+