Skip to content

Commit

Permalink
Fix warnings introduced in HA 2024.2 (#51)
Browse files Browse the repository at this point in the history
* fix Warnings introduced in HA 2024.2
* remove buggy error log
  • Loading branch information
CyrilP authored Feb 9, 2024
1 parent 53de6cc commit 410f95b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
40 changes: 17 additions & 23 deletions custom_components/deltadore_tydom/ha_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
SUPPORT_STOP,
SUPPORT_SET_TILT_POSITION,
SUPPORT_OPEN_TILT,
SUPPORT_CLOSE_TILT,
SUPPORT_STOP_TILT,
CoverEntity,
CoverDeviceClass,
CoverEntityFeature,
)

from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass, SensorEntity
from homeassistant.components.light import LightEntity
from homeassistant.components.lock import LockEntity
Expand Down Expand Up @@ -455,18 +449,18 @@ def __init__(self, device: TydomShutter, hass) -> None:
if hasattr(device, "position"):
self.supported_features = (
self.supported_features
| SUPPORT_SET_POSITION
| SUPPORT_OPEN
| SUPPORT_CLOSE
| SUPPORT_STOP
| CoverEntityFeature.SET_POSITION
| CoverEntityFeature.OPEN
| CoverEntityFeature.CLOSE
| CoverEntityFeature.STOP
)
if hasattr(device, "slope"):
self.supported_features = (
self.supported_features
| SUPPORT_SET_TILT_POSITION
| SUPPORT_OPEN_TILT
| SUPPORT_CLOSE_TILT
| SUPPORT_STOP_TILT
| CoverEntityFeature.SET_TILT_POSITION
| CoverEntityFeature.OPEN_TILT
| CoverEntityFeature.CLOSE_TILT
| CoverEntityFeature.STOP_TILT
)

@property
Expand Down Expand Up @@ -613,6 +607,13 @@ def __init__(self, device: TydomBoiler, hass) -> None:
self._device._ha_device = self
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
self._attr_supported_features = (
self._attr_supported_features
| ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.TURN_OFF
| ClimateEntityFeature.TURN_ON
)

# self._attr_preset_modes = ["NORMAL", "STOP", "ANTI_FROST"]
self._attr_hvac_modes = [
Expand All @@ -628,13 +629,6 @@ def __init__(self, device: TydomBoiler, hass) -> None:
if "max" in self._device._metadata["setpoint"]:
self._attr_max_temp = self._device._metadata["setpoint"]["max"]

@property
def supported_features(self) -> ClimateEntityFeature:
"""Return the list of supported features."""
features = ClimateEntityFeature(0)
features = features | ClimateEntityFeature.TARGET_TEMPERATURE #| ClimateEntityFeature.PRESET_MODE
return features

@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
Expand Down
1 change: 0 additions & 1 deletion custom_components/deltadore_tydom/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ async def create_ha_device(self, device):
match device:
case Tydom():
LOGGER.debug("Create Tydom gateway %s", device.device_id)
LOGGER.error("Tydom gateway %s", device._tydom_client)
self.devices[device.device_id] = device
ha_device = HATydom(device, self._hass, self._entry)
self.ha_devices[device.device_id] = ha_device
Expand Down

0 comments on commit 410f95b

Please sign in to comment.