diff --git a/PyViCare/PyViCareDeviceConfig.py b/PyViCare/PyViCareDeviceConfig.py index 990864bc..6f3baca3 100644 --- a/PyViCare/PyViCareDeviceConfig.py +++ b/PyViCare/PyViCareDeviceConfig.py @@ -84,6 +84,7 @@ def asAutoDetectDevice(self): (self.asPelletsBoiler, r"Vitoligno|Ecotronic|VBC550P", []), (self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:ees"]), (self.asVentilation, r"E3_ViAir", ["type:ventilation"]), + (self.asVentilation, r"E3_VitoPure", ["type:ventilation;purifier"]), (self.asRadiatorActuator, r"E3_RadiatorActuator", ["type:radiator"]), (self.asRoomSensor, r"E3_RoomSensor", ["type:climateSensor"]), (self.asGateway, r"E3_TCU41_x04", ["type:gateway;TCU100"]), diff --git a/tests/test_PyViCareDeviceConfig.py b/tests/test_PyViCareDeviceConfig.py index efe324ef..2452c9ec 100644 --- a/tests/test_PyViCareDeviceConfig.py +++ b/tests/test_PyViCareDeviceConfig.py @@ -66,6 +66,17 @@ def test_autoDetect_Vitoair_FS_300E_asVentilation(self): device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) + def test_autoDetect_RoleVentilationPurifier_asVentilation(self): + self.service.hasRoles = has_roles(["type:ventilation;purifier"]) + c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + device_type = c.asAutoDetectDevice() + self.assertEqual("VentilationDevice", type(device_type).__name__) + + def test_autoDetect_Vitopure_350_asVentilation(self): + c = PyViCareDeviceConfig(self.service, "0", "E3_VitoPure", "Online") + device_type = c.asAutoDetectDevice() + self.assertEqual("VentilationDevice", type(device_type).__name__) + def test_autoDetect_VitoconnectOpto1_asGateway(self): c = PyViCareDeviceConfig(self.service, "0", "Heatbox1", "Online") device_type = c.asAutoDetectDevice() diff --git a/tests/test_Vitopure350.py b/tests/test_Vitopure350.py new file mode 100644 index 00000000..9b32282b --- /dev/null +++ b/tests/test_Vitopure350.py @@ -0,0 +1,33 @@ +import unittest + +from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError +from PyViCare.PyViCareVentilationDevice import VentilationDevice +from tests.ViCareServiceMock import ViCareServiceMock + + +class Vitopure350(unittest.TestCase): + def setUp(self): + self.service = ViCareServiceMock('response/Vitopure350.json') + self.device = VentilationDevice(self.service) + + def test_getActiveMode(self): + self.assertEqual("sensorDriven", self.device.getActiveMode()) + + def test_getAvailableModes(self): + expected_modes = ['permanent', 'ventilation', 'sensorDriven'] + self.assertListEqual(expected_modes, self.device.getAvailableModes()) + + def test_getActiveProgram(self): + self.assertEqual("automatic", self.device.getActiveProgram()) + + def test_getAvailablePrograms(self): + expected_programs = ['standby'] + self.assertListEqual(expected_programs, self.device.getAvailablePrograms()) + + def test_getSchedule(self): + keys = ['active', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] + self.assertListEqual(keys, list(self.device.getSchedule().keys())) + + def test_getSerial(self): + with self.assertRaises(PyViCareNotSupportedFeatureError): + self.device.getSerial()