Skip to content

Commit

Permalink
fix: autodetection of oil boiler (#514)
Browse files Browse the repository at this point in the history
* add test case

* fix autodetect

* rename test case

* Update test_PyViCareDeviceConfig.py
  • Loading branch information
CFenner authored Feb 13, 2025
1 parent d6af99f commit 34c4a95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PyViCare/PyViCareDeviceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def asAutoDetectDevice(self):
device_types = [
(self.asFuelCell, r"Vitovalor|Vitocharge|Vitoblo", []),
(self.asPelletsBoiler, r"Vitoligno|Ecotronic|VBC550P", []),
(self.asOilBoiler, r"Vitoladens|Vitoradial|Vitorondens|VPlusH|V200KW2_6", []),
(self.asGazBoiler, r"Vitodens|VScotH|Vitocrossal|VDensH|Vitopend|VPendH|OT_Heating_System", ["type:boiler"]),
(self.asHeatPump, r"Vitocal|VBC70|V200WO1A|CU401B", ["type:heatpump"]),
(self.asOilBoiler, r"Vitoladens|Vitoradial|Vitorondens|VPlusH|V200KW2_6", []),
(self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:ees"]), # ees, it this a typo?
(self.asElectricalEnergySystem, r"E3_VitoCharge_05", ["type:ess"]),
(self.asVentilation, r"E3_ViAir", ["type:ventilation"]),
Expand Down
6 changes: 6 additions & 0 deletions tests/test_PyViCareDeviceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def test_autoDetect_Ecotronic_asPelletsBoiler(self):
device_type = c.asAutoDetectDevice()
self.assertEqual("PelletsBoiler", type(device_type).__name__)

def test_autoDetect_Vitoladens_asOilBoiler(self):
self.service.hasRoles = has_roles(["type:boiler"])
c = PyViCareDeviceConfig(self.service, "0", "Vitoladens", "Online")
device_type = c.asAutoDetectDevice()
self.assertEqual("OilBoiler", type(device_type).__name__)

def test_autoDetect_RoleGateway_asGateway(self):
self.service.hasRoles = has_roles(["type:gateway;VitoconnectOpto1"])
c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online")
Expand Down

0 comments on commit 34c4a95

Please sign in to comment.