Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Naviclim Atlantic support #87

Merged
merged 8 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
111 changes: 79 additions & 32 deletions custom_components/deltadore_tydom/ha_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,21 +608,6 @@ class HaClimate(ClimateEntity, HAEntity):
"temperature": UnitOfTemperature.CELSIUS,
}

DICT_MODES_HA_TO_DD = {
HVACMode.AUTO: "ANTI_FROST",
HVACMode.COOL: None,
HVACMode.HEAT: "NORMAL",
HVACMode.OFF: "STOP",
}
DICT_MODES_DD_TO_HA = {
# "": HVACMode.AUTO,
# "": HVACMode.COOL,
"ANTI_FROST": HVACMode.AUTO,
"NORMAL": HVACMode.HEAT,
"STOP": HVACMode.OFF,
"AUTO": HVACMode.AUTO,
}

def __init__(self, device: TydomBoiler, hass) -> None:
"""Initialize Climate."""
super().__init__()
Expand All @@ -632,26 +617,61 @@ def __init__(self, device: TydomBoiler, hass) -> None:
self._attr_unique_id = f"{self._device.device_id}_climate"
self._attr_name = self._device.device_name
self._enable_turn_on_off_backwards_compatibility = False
if hasattr(self._device, "temperature"):
self._attr_supported_features = (
self._attr_supported_features
| ClimateEntityFeature.TARGET_TEMPERATURE)

self.dict_modes_ha_to_dd = {
HVACMode.COOL: "COOLING",
HVACMode.HEAT: "NORMAL",
HVACMode.OFF: "STOP",
HVACMode.FAN_ONLY: "VENTILATING",
HVACMode.DRY: "DRYING"
}
self.dict_modes_dd_to_ha = {
"COOLING": HVACMode.COOL,
"ANTI_FROST": HVACMode.AUTO,
"NORMAL": HVACMode.HEAT,
"HEATING": HVACMode.HEAT,
"STOP": HVACMode.OFF,
"AUTO": HVACMode.AUTO,
"VENTILATING": HVACMode.FAN_ONLY,
"DRYING": HVACMode.DRY
}

if "hvacMode" in self._device._metadata and "AUTO" in self._device._metadata["hvacMode"]["enum_values"]:
self.dict_modes_ha_to_dd[HVACMode.AUTO] = "AUTO"
elif "hvacMode" in self._device._metadata and "ANTI_FROST" in self._device._metadata["hvacMode"]["enum_values"]:
self.dict_modes_ha_to_dd[HVACMode.AUTO] = "ANTI_FROST"
else:
self.dict_modes_ha_to_dd[HVACMode.AUTO] = "AUTO"


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
| ClimateEntityFeature.TURN_ON
| ClimateEntityFeature.TARGET_TEMPERATURE
)

if "NORMAL" in self._device._metadata["thermicLevel"] and "AUTO" in self._device._metadata["thermicLevel"]:
self.DICT_MODES_HA_TO_DD[HVACMode.HEAT] = "AUTO"
if "NORMAL" in self._device._metadata["thermicLevel"] or "AUTO" in self._device._metadata["thermicLevel"]:
self.dict_modes_ha_to_dd[HVACMode.HEAT] = "AUTO"

# 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 +683,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 @@ -676,12 +701,15 @@ def temperature_unit(self) -> str:
@property
def hvac_mode(self) -> HVACMode:
"""Return the current operation (e.g. heat, cool, idle)."""
if (hasattr(self._device, 'hvacMode')):
LOGGER.debug("hvac_mode = %s", self.DICT_MODES_DD_TO_HA[self._device.hvacMode])
return self.DICT_MODES_DD_TO_HA[self._device.hvacMode]
elif (hasattr(self._device, 'thermicLevel')):
LOGGER.debug("thermicLevel = %s", self.DICT_MODES_DD_TO_HA[self._device.thermicLevel])
return self.DICT_MODES_DD_TO_HA[self._device.thermicLevel]
if hasattr(self._device, 'hvacMode'):
LOGGER.debug("hvac_mode = %s", self.dict_modes_dd_to_ha[self._device.hvacMode])
return self.dict_modes_dd_to_ha[self._device.hvacMode]
elif hasattr(self._device, 'authorization'):
LOGGER.debug("authorization = %s", self.dict_modes_dd_to_ha[self._device.thermicLevel])
return self.dict_modes_dd_to_ha[self._device.authorization]
elif hasattr(self._device, 'thermicLevel'):
LOGGER.debug("thermicLevel = %s", self.dict_modes_dd_to_ha[self._device.thermicLevel])
return self.dict_modes_dd_to_ha[self._device.thermicLevel]
else:
return None

Expand All @@ -690,19 +718,38 @@ 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, 'authorization'):
if self._device.authorization == "HEATING" and hasattr(self._device, "heatSetpoint"):
return self._device.heatSetpoint
elif self._device.authorization == "HEATING" and hasattr(self._device, "setpoint"):
return self._device.setpoint
elif self._device.authorization == "COOLING" and hasattr(self._device, "coolSetpoint"):
return self._device.coolSetpoint
elif self._device.authorization == "COOLING" and hasattr(self._device, "setpoint"):
return self._device.setpoint
return None

async def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
await self._device.set_hvac_mode(self.DICT_MODES_HA_TO_DD[hvac_mode])
await self._device.set_hvac_mode(self.dict_modes_ha_to_dd[hvac_mode])

async def async_set_preset_mode(self, preset_mode):
"""Set new target preset mode."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/deltadore_tydom/tydom/MessageHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ async def get_device(
return TydomSmoke(
tydom_client, uid, device_id, name, last_usage, endpoint, device_metadata[uid], data
)
case "boiler" | "sh_hvac" | "electric":
case "boiler" | "sh_hvac" | "electric" | "aeraulic":
return TydomBoiler(
tydom_client, uid, device_id, name, last_usage, endpoint, device_metadata[uid], data
)
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
11 changes: 11 additions & 0 deletions tools/traces-naviclim-atlantic.txt

Large diffs are not rendered by default.