Skip to content

Commit

Permalink
implement naviclim support
Browse files Browse the repository at this point in the history
  • Loading branch information
ucpy7374 committed May 13, 2024
1 parent a25c126 commit 02ad973
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Platform | Description
- Tyxal+, Tyxal CSX40
- TYXIA 6610
- BSO
- Naviclim Atlantic 875311

Some other functions may also work or only report attributes.

Expand Down
54 changes: 47 additions & 7 deletions custom_components/deltadore_tydom/ha_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,17 +610,20 @@ class HaClimate(ClimateEntity, HAEntity):

DICT_MODES_HA_TO_DD = {
HVACMode.AUTO: "ANTI_FROST",
HVACMode.COOL: None,
HVACMode.COOL: "COOLING",
HVACMode.HEAT: "NORMAL",
HVACMode.OFF: "STOP",
HVACMode.FAN_ONLY: "VENTILATING",
HVACMode.DRY: "DRYING"
}
DICT_MODES_DD_TO_HA = {
# "": HVACMode.AUTO,
# "": HVACMode.COOL,
"COOLING": HVACMode.COOL,
"ANTI_FROST": HVACMode.AUTO,
"NORMAL": HVACMode.HEAT,
"STOP": HVACMode.OFF,
"AUTO": HVACMode.AUTO,
"VENTILATING": HVACMode.FAN_ONLY,
"DRYING": HVACMode.DRY
}

def __init__(self, device: TydomBoiler, hass) -> None:
Expand All @@ -637,6 +640,12 @@ def __init__(self, device: TydomBoiler, hass) -> None:
self._attr_supported_features
| ClimateEntityFeature.TARGET_TEMPERATURE)

if hasattr(self._device, "minSetpoint"):
self._attr_min_temp = self._device.minSetpoint

if hasattr(self._device, "maxSetpoint"):
self._attr_max_temp = self._device.maxSetpoint

self._attr_supported_features = (
self._attr_supported_features
| ClimateEntityFeature.TURN_OFF
Expand All @@ -649,9 +658,15 @@ def __init__(self, device: TydomBoiler, hass) -> None:
# self._attr_preset_modes = ["NORMAL", "STOP", "ANTI_FROST"]
self._attr_hvac_modes = [
HVACMode.OFF,
HVACMode.HEAT,
HVACMode.AUTO,
]

if ("comfortMode" in self._device._metadata and "COOLING" in self._device._metadata["comfortMode"]["enum_values"]) or ("hvacMode" in self._device._metadata and "COOLING" in self._device._metadata["hvacMode"]["enum_values"]):
self._attr_hvac_modes.append(HVACMode.COOL)

if ("comfortMode" in self._device._metadata and "HEATING" in self._device._metadata["comfortMode"]["enum_values"]) or ("hvacMode" in self._device._metadata and "HEATING" in self._device._metadata["hvacMode"]["enum_values"]):
self._attr_hvac_modes.append(HVACMode.HEAT)

self._registered_sensors = []

if hasattr(self._device._metadata, "setpoint") and "min" in self._device._metadata["setpoint"]:
Expand All @@ -663,11 +678,16 @@ def __init__(self, device: TydomBoiler, hass) -> None:
@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
infos = {
"identifiers": {(DOMAIN, self._device.device_id)},
"name": self._device.device_name,
}

if hasattr(self._device, "manufacturer"):
infos["manufacturer"] = self._device.manufacturer

return infos

@property
def temperature_unit(self) -> str:
"""Return the unit of temperature measurement for the system."""
Expand All @@ -690,14 +710,34 @@ def current_temperature(self) -> float | None:
"""Return the current temperature."""
if hasattr(self._device, 'temperature'):
return self._device.temperature
elif hasattr(self._device, 'ambientTemperature'):
return self._device.ambientTemperature
else:
return None

@property
def target_temperature(self) -> float | None:
"""Return the temperature currently set to be reached."""
if self._device.authorization == "HEATING" and hasattr(self._device, "setpoint"):
return self._device.setpoint
if hasattr(self._device, 'hvacMode'):
if (self._device.hvacMode == "HEATING" or self._device.hvacMode == "NORMAL") and hasattr(self._device, "setpoint"):
return self._device.setpoint
elif (self._device.hvacMode == "HEATING" or self._device.hvacMode == "NORMAL") and hasattr(self._device, "heatSetpoint"):
return self._device.heatSetpoint
elif self._device.hvacMode == "COOLING" and hasattr(self._device, "setpoint"):
return self._device.setpoint
elif self._device.hvacMode == "COOLING" and hasattr(self._device, "coolSetpoint"):
return self._device.coolSetpoint

elif hasattr(self._device, 'comfortMode'):
if self._device.comfortMode == "HEATING" and hasattr(self._device, "setpoint"):
return self._device.setpoint
elif self._device.comfortMode == "HEATING" and hasattr(self._device, "heatSetpoint"):
return self._device.heatSetpoint
elif self._device.comfortMode == "COOLING" and hasattr(self._device, "setpoint"):
return self._device.setpoint
elif self._device.comfortMode == "COOLING" and hasattr(self._device, "coolSetpoint"):
return self._device.coolSetpoint

return None

async def async_set_hvac_mode(self, hvac_mode):
Expand Down
23 changes: 17 additions & 6 deletions custom_components/deltadore_tydom/tydom/tydom_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,19 @@ async def set_hvac_mode(self, mode):
self._id, self._endpoint, "antifrostOn", False
)
else:
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "thermicLevel", "COMFORT"
)
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "comfortMode", "HEATING"
)
if "COMFORT" in self._metadata["thermicLevel"]["enum_values"]:
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "thermicLevel", "COMFORT"
)
elif "HEATING" in self._metadata["thermicLevel"]["enum_values"]:
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "thermicLevel", "HEATING"
)

if "HEATING" in self._metadata["comfortMode"]["enum_values"]:
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "comfortMode", "HEATING"
)

elif mode == "STOP":
if hasattr(self, 'hvacMode'):
Expand All @@ -236,6 +243,10 @@ async def set_hvac_mode(self, mode):
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "comfortMode", "STOP"
)
elif mode == "COOLING":
await self._tydom_client.put_devices_data(
self._id, self._endpoint, "comfortMode", "COOLING"
)
else:
LOGGER.error("Unknown hvac mode: %s", mode)

Expand Down

0 comments on commit 02ad973

Please sign in to comment.