Small improvements

This commit is contained in:
Andre Basche 2024-03-18 01:11:23 +01:00
parent 6e8576c7bd
commit 38a67ad64c
5 changed files with 34 additions and 12 deletions

View file

@ -153,7 +153,9 @@ class HonACClimateEntity(HonEntity, ClimateEntity):
SWING_BOTH,
]
self._attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE
ClimateEntityFeature.TURN_ON
| ClimateEntityFeature.TURN_OFF
| ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.FAN_MODE
| ClimateEntityFeature.SWING_MODE
| ClimateEntityFeature.PRESET_MODE
@ -295,11 +297,17 @@ class HonClimateEntity(HonEntity, ClimateEntity):
) -> None:
super().__init__(hass, entry, device, description)
self._attr_supported_features = (
ClimateEntityFeature.TURN_ON
| ClimateEntityFeature.TARGET_TEMPERATURE
)
self._attr_temperature_unit = UnitOfTemperature.CELSIUS
self._set_temperature_bound()
self._attr_hvac_modes = [description.mode]
if "stopProgram" in device.commands:
self._attr_supported_features |= ClimateEntityFeature.TURN_OFF
self._attr_hvac_modes += [HVACMode.OFF]
modes = []
else:
@ -317,13 +325,8 @@ class HonClimateEntity(HonEntity, ClimateEntity):
modes.append(mode)
if modes:
self._attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.PRESET_MODE
)
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE
self._attr_preset_modes = modes
else:
self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
self._handle_coordinator_update(update=False)

View file

@ -42,6 +42,13 @@ LIGHTS: dict[str, tuple[LightEntityDescription, ...]] = {
translation_key="light",
),
),
"DW": (
LightEntityDescription(
key="settings.lightStatus",
name="Light status",
translation_key="light",
),
),
}

View file

@ -9,7 +9,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": [
"pyhOn==0.16.0"
"pyhOn==0.16.1"
],
"version": "0.13.0"
"version": "0.13.1"
}

View file

@ -139,6 +139,12 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
icon="mdi:water",
translation_key="water_hard",
),
HonNumberEntityDescription(
key="settings.waterHard",
name="Water hard",
icon="mdi:water",
translation_key="water_hard",
),
),
"AC": (
HonNumberEntityDescription(

View file

@ -269,6 +269,12 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
icon="mdi:volume-off",
translation_key="buzzer",
),
HonConfigSwitchEntityDescription(
key="startProgram.tabStatus",
name="Tab Status",
icon="mdi:silverware-clean",
# translation_key="buzzer",
),
),
"AC": (
HonSwitchEntityDescription(
@ -408,9 +414,9 @@ async def async_setup_entry(
entity = HonConfigSwitchEntity(hass, entry, device, description)
elif isinstance(description, HonControlSwitchEntityDescription):
if not (
device.get(description.key) is not None
or description.turn_on_key in list(device.commands)
or description.turn_off_key in list(device.commands)
device.get(description.key) is not None
or description.turn_on_key in list(device.commands)
or description.turn_off_key in list(device.commands)
):
continue
entity = HonControlSwitchEntity(hass, entry, device, description)