Fix issues from refactoring

This commit is contained in:
Andre Basche 2023-07-24 21:37:48 +02:00
parent 2acc6225c4
commit 3924c6ed77
7 changed files with 90 additions and 89 deletions

View file

@ -41,7 +41,7 @@ Support has been confirmed for these models, but many more will work. Please add
| | **Haier** | **Hoover** | **Candy** | | | **Haier** | **Hoover** | **Candy** |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| |---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| **Washing Machine** | HW80-B14959TU1DE <br/> HW90-B14TEAM5 <br/> HW100-B14959U1 | H-WASH 500 <br/> H7W4 48MBC-S <br/> HLWPS495TAMBE-11 <br/> HW 410AMBCB/1-80 | CO4 107T1/2-07 <br/> CBWO49TWME-S <br/> RO44 1286DWMC4-07 <br/> HW 68AMC/1-80 <br/> HWPD 69AMBC/1-S | | **Washing Machine** | HW80-B14959TU1DE <br/> HW90-B14TEAM5 <br/> HW100-B14959U1 | H-WASH 500 <br/> H7W4 48MBC-S <br/> HLWPS495TAMBE-11 <br/> HW 410AMBCB/1-80 | CO4 107T1/2-07 <br/> CBWO49TWME-S <br/> RO44 1286DWMC4-07 <br/> HW 68AMC/1-80 <br/> HWPD 69AMBC/1-S |
| **Tumble Dryer** | HD80-A3959 | H-DRY 500 <br/> H9A3TCBEXS-S <br/> HLE C10DCE-80 <br/> H5WPB447AMBC/1-S <br/> NDE H10A2TCE-80 <br/> NDE H9A2TSBEXS-S <br/> NDPHY10A2TCBEXSS | BCTDH7A1TE <br/> CSOE C10DE-80 <br/> ROE H9A3TCEX-S | | **Tumble Dryer** | HD80-A3959 <br/> HD90-A3TEAM5 | H-DRY 500 <br/> H9A3TCBEXS-S <br/> HLE C10DCE-80 <br/> H5WPB447AMBC/1-S <br/> NDE H10A2TCE-80 <br/> NDE H9A2TSBEXS-S <br/> NDPHY10A2TCBEXSS | BCTDH7A1TE <br/> CSOE C10DE-80 <br/> ROE H9A3TCEX-S |
| **Washer Dryer** | HWD100-B14979 | HDQ 496AMBS/1-S <br/> HWPS4954DAMR-11 | RPW41066BWMR/1-S | | **Washer Dryer** | HWD100-B14979 | HDQ 496AMBS/1-S <br/> HWPS4954DAMR-11 | RPW41066BWMR/1-S |
| **Oven** | HWO60SM2F3XH | HSOT3161WG | | | **Oven** | HWO60SM2F3XH | HSOT3161WG | |
| **Dish Washer** | XIB 3B2SFS-80 <br/> XIB 6B2D3FB | HFB 6B2S3FX | | | **Dish Washer** | XIB 3B2SFS-80 <br/> XIB 6B2D3FB | HFB 6B2S3FX | |

View file

@ -25,7 +25,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None: async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
session = aiohttp_client.async_get_clientsession(hass) session = aiohttp_client.async_get_clientsession(hass)
if (config_dir := hass.config.config_dir) is None: if (config_dir := hass.config.config_dir) is None:
raise ValueError("Missing Config Dir") raise ValueError("Missing Config Dir")
@ -43,7 +43,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None
hass.async_create_task( hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform) hass.config_entries.async_forward_entry_setup(entry, platform)
) )
return return True
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:

View file

@ -155,7 +155,7 @@ class HonACClimateEntity(HonEntity, ClimateEntity):
self._handle_coordinator_update(update=False) self._handle_coordinator_update(update=False)
def _set_temperature_bound(self) -> None: def _set_temperature_bound(self) -> None:
temperature = self._device.settings[self.entity_description.key] temperature = self._device.settings["settings.tempSel"]
if not isinstance(temperature, HonParameterRange): if not isinstance(temperature, HonParameterRange):
raise ValueError raise ValueError
self._attr_max_temp = temperature.max self._attr_max_temp = temperature.max

View file

@ -72,7 +72,7 @@ class HonLightEntity(HonEntity, LightEntity):
device: HonAppliance, device: HonAppliance,
description: LightEntityDescription, description: LightEntityDescription,
) -> None: ) -> None:
light = self._device.settings.get(self.entity_description.key) light = device.settings.get(description.key)
if not isinstance(light, HonParameterRange): if not isinstance(light, HonParameterRange):
raise ValueError() raise ValueError()
self._light_range = (light.min, light.max) self._light_range = (light.min, light.max)

View file

@ -9,7 +9,7 @@
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues", "issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": [ "requirements": [
"pyhOn==0.14.10" "pyhOn==0.15.5"
], ],
"version": "0.9.1-beta.1" "version": "0.9.1"
} }

View file

@ -1,5 +1,6 @@
from typing import Union, TypeVar from typing import Union, TypeVar, TYPE_CHECKING
if TYPE_CHECKING:
from homeassistant.components.button import ButtonEntityDescription from homeassistant.components.button import ButtonEntityDescription
from homeassistant.components.fan import FanEntityDescription from homeassistant.components.fan import FanEntityDescription
from homeassistant.components.light import LightEntityDescription from homeassistant.components.light import LightEntityDescription
@ -34,61 +35,61 @@ from .switch import (
) )
HonButtonType = Union[ HonButtonType = Union[
HonButtonEntity, "HonButtonEntity",
HonDataArchive, "HonDataArchive",
HonDeviceInfo, "HonDeviceInfo",
] ]
HonEntityDescription = Union[ HonEntityDescription = Union[
HonBinarySensorEntityDescription, "HonBinarySensorEntityDescription",
HonControlSwitchEntityDescription, "HonControlSwitchEntityDescription",
HonSwitchEntityDescription, "HonSwitchEntityDescription",
HonConfigSwitchEntityDescription, "HonConfigSwitchEntityDescription",
HonSensorEntityDescription, "HonSensorEntityDescription",
HonConfigSelectEntityDescription, "HonConfigSelectEntityDescription",
HonConfigNumberEntityDescription, "HonConfigNumberEntityDescription",
HonACClimateEntityDescription, "HonACClimateEntityDescription",
HonClimateEntityDescription, "HonClimateEntityDescription",
HonNumberEntityDescription, "HonNumberEntityDescription",
HonSelectEntityDescription, "HonSelectEntityDescription",
HonConfigSensorEntityDescription, "HonConfigSensorEntityDescription",
FanEntityDescription, "FanEntityDescription",
LightEntityDescription, "LightEntityDescription",
LockEntityDescription, "LockEntityDescription",
ButtonEntityDescription, "ButtonEntityDescription",
SwitchEntityDescription, "SwitchEntityDescription",
SensorEntityDescription, "SensorEntityDescription",
SelectEntityDescription, "SelectEntityDescription",
NumberEntityDescription, "NumberEntityDescription",
] ]
HonOptionEntityDescription = Union[ HonOptionEntityDescription = Union[
HonConfigSelectEntityDescription, "HonConfigSelectEntityDescription",
HonSelectEntityDescription, "HonSelectEntityDescription",
HonConfigSensorEntityDescription, "HonConfigSensorEntityDescription",
HonSensorEntityDescription, "HonSensorEntityDescription",
] ]
T = TypeVar( T = TypeVar(
"T", "T",
HonBinarySensorEntityDescription, "HonBinarySensorEntityDescription",
HonControlSwitchEntityDescription, "HonControlSwitchEntityDescription",
HonSwitchEntityDescription, "HonSwitchEntityDescription",
HonConfigSwitchEntityDescription, "HonConfigSwitchEntityDescription",
HonSensorEntityDescription, "HonSensorEntityDescription",
HonConfigSelectEntityDescription, "HonConfigSelectEntityDescription",
HonConfigNumberEntityDescription, "HonConfigNumberEntityDescription",
HonACClimateEntityDescription, "HonACClimateEntityDescription",
HonClimateEntityDescription, "HonClimateEntityDescription",
HonNumberEntityDescription, "HonNumberEntityDescription",
HonSelectEntityDescription, "HonSelectEntityDescription",
HonConfigSensorEntityDescription, "HonConfigSensorEntityDescription",
FanEntityDescription, "FanEntityDescription",
LightEntityDescription, "LightEntityDescription",
LockEntityDescription, "LockEntityDescription",
ButtonEntityDescription, "ButtonEntityDescription",
SwitchEntityDescription, "SwitchEntityDescription",
SensorEntityDescription, "SensorEntityDescription",
SelectEntityDescription, "SelectEntityDescription",
NumberEntityDescription, "NumberEntityDescription",
) )

View file

@ -30,7 +30,7 @@ Support has been confirmed for these models, but many more will work. Please add
| | **Haier** | **Hoover** | **Candy** | | | **Haier** | **Hoover** | **Candy** |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| |---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| **Washing Machine** | HW80-B14959TU1DE <br/> HW90-B14TEAM5 <br/> HW100-B14959U1 | H-WASH 500 <br/> H7W4 48MBC-S <br/> HLWPS495TAMBE-11 <br/> HW 410AMBCB/1-80 | CO4 107T1/2-07 <br/> CBWO49TWME-S <br/> RO44 1286DWMC4-07 <br/> HW 68AMC/1-80 <br/> HWPD 69AMBC/1-S | | **Washing Machine** | HW80-B14959TU1DE <br/> HW90-B14TEAM5 <br/> HW100-B14959U1 | H-WASH 500 <br/> H7W4 48MBC-S <br/> HLWPS495TAMBE-11 <br/> HW 410AMBCB/1-80 | CO4 107T1/2-07 <br/> CBWO49TWME-S <br/> RO44 1286DWMC4-07 <br/> HW 68AMC/1-80 <br/> HWPD 69AMBC/1-S |
| **Tumble Dryer** | HD80-A3959 | H-DRY 500 <br/> H9A3TCBEXS-S <br/> HLE C10DCE-80 <br/> H5WPB447AMBC/1-S <br/> NDE H10A2TCE-80 <br/> NDE H9A2TSBEXS-S <br/> NDPHY10A2TCBEXSS | BCTDH7A1TE <br/> CSOE C10DE-80 <br/> ROE H9A3TCEX-S | | **Tumble Dryer** | HD80-A3959 <br/> HD90-A3TEAM5 | H-DRY 500 <br/> H9A3TCBEXS-S <br/> HLE C10DCE-80 <br/> H5WPB447AMBC/1-S <br/> NDE H10A2TCE-80 <br/> NDE H9A2TSBEXS-S <br/> NDPHY10A2TCBEXSS | BCTDH7A1TE <br/> CSOE C10DE-80 <br/> ROE H9A3TCEX-S |
| **Washer Dryer** | HWD100-B14979 | HDQ 496AMBS/1-S <br/> HWPS4954DAMR-11 | RPW41066BWMR/1-S | | **Washer Dryer** | HWD100-B14979 | HDQ 496AMBS/1-S <br/> HWPS4954DAMR-11 | RPW41066BWMR/1-S |
| **Oven** | HWO60SM2F3XH | HSOT3161WG | | | **Oven** | HWO60SM2F3XH | HSOT3161WG | |
| **Dish Washer** | XIB 3B2SFS-80 <br/> XIB 6B2D3FB | HFB 6B2S3FX | | | **Dish Washer** | XIB 3B2SFS-80 <br/> XIB 6B2D3FB | HFB 6B2S3FX | |