Skip to content

Commit

Permalink
Added proper Combi_Controller Support
Browse files Browse the repository at this point in the history
Combi controller supported
  • Loading branch information
veista committed Feb 5, 2024
1 parent 27c0ff4 commit 1cdeb58
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 83 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CTS602 supported devices (as typed in HMI menu):
- CompactS
- VP18cCom
- COMFORT
- CompactP Air
- CompactP Combi (AIR/GEO)
- VP 18c
- VP 18ek
- VP 18cek
Expand Down
59 changes: 39 additions & 20 deletions custom_components/nilan/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,46 @@ async def setup(self):
if hw_type in CTS602_DEVICE_TYPES:
self._device_sw_ver = await self.get_controller_software_version()
self._device_type = CTS602_DEVICE_TYPES[hw_type]
if bus_version >= 10: # PH
if (bus_version >= 10 and hw_type != 16) or (
bus_version >= 1 and hw_type == 16
):
co2_present = await self.get_co2_present()
else:
co2_present = True
for entity, value in CTS602_ENTITY_MAP.items():
if bus_version >= value["min_bus_version"] and (
hw_type in value["supported_devices"]
or "all" in value["supported_devices"]
):
if "excluded_bus_versions" in value:
if bus_version in value["excluded_bus_versions"]:
continue
if "extra_type" in value:
if co2_present and value["extra_type"] == "co2":
self._attributes[entity] = value["entity_type"]
else:
continue
if "max_bus_version" in value:
if bus_version >= value["max_bus_version"]:
continue
self._attributes[entity] = value["entity_type"]
co2_present = False
if hw_type != 16:
for entity, value in CTS602_ENTITY_MAP.items():
if "min_bus_version" not in value:
continue
if bus_version >= value["min_bus_version"] and (
hw_type in value["supported_devices"]
or "all" in value["supported_devices"]
):
if "excluded_bus_versions" in value:
if bus_version in value["excluded_bus_versions"]:
continue
if "extra_type" in value:
if co2_present and value["extra_type"] == "co2":
self._attributes[entity] = value["entity_type"]
else:
continue
if "max_bus_version" in value:
if bus_version >= value["max_bus_version"]:
continue
self._attributes[entity] = value["entity_type"]
else:
for entity, value in CTS602_ENTITY_MAP.items():
if "min_combi_bus_version" not in value:
continue
if bus_version >= value["min_combi_bus_version"] and (
hw_type in value["supported_devices"]
or "all" in value["supported_devices"]
):
if "extra_type" in value:
if co2_present and value["extra_type"] == "co2":
self._attributes[entity] = value["entity_type"]
else:
continue
self._attributes[entity] = value["entity_type"]
else:
self._modbus.async_close()
raise ValueError("HW type not supported")
Expand Down Expand Up @@ -636,7 +655,7 @@ async def get_exchanger_efficiency(self) -> float:
async def get_hps_compressor_capacity(self) -> float:
"""Get HPS Compressor Capacity."""
result = await self._modbus.async_pb_call(
self._unit_id, CTS602InputRegisters.air_temp_eff_pct, 1, "input"
self._unit_id, CTS602InputRegisters.hps_heat_pump_capacity_act, 1, "input"
)
if result is not None:
value = int.from_bytes(
Expand Down
Loading

0 comments on commit 1cdeb58

Please sign in to comment.