Remove melcloud from mypy ignore list (#74410)
This commit is contained in:
parent
ebc8fba5bf
commit
110d9232cd
4 changed files with 22 additions and 23 deletions
|
@ -142,7 +142,7 @@ class MelCloudDevice:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def mel_devices_setup(hass, token) -> list[MelCloudDevice]:
|
async def mel_devices_setup(hass, token) -> dict[str, list[MelCloudDevice]]:
|
||||||
"""Query connected devices from MELCloud."""
|
"""Query connected devices from MELCloud."""
|
||||||
session = async_get_clientsession(hass)
|
session = async_get_clientsession(hass)
|
||||||
try:
|
try:
|
||||||
|
@ -156,7 +156,7 @@ async def mel_devices_setup(hass, token) -> list[MelCloudDevice]:
|
||||||
except (asyncio.TimeoutError, ClientConnectionError) as ex:
|
except (asyncio.TimeoutError, ClientConnectionError) as ex:
|
||||||
raise ConfigEntryNotReady() from ex
|
raise ConfigEntryNotReady() from ex
|
||||||
|
|
||||||
wrapped_devices = {}
|
wrapped_devices: dict[str, list[MelCloudDevice]] = {}
|
||||||
for device_type, devices in all_devices.items():
|
for device_type, devices in all_devices.items():
|
||||||
wrapped_devices[device_type] = [MelCloudDevice(device) for device in devices]
|
wrapped_devices[device_type] = [MelCloudDevice(device) for device in devices]
|
||||||
return wrapped_devices
|
return wrapped_devices
|
||||||
|
|
|
@ -66,16 +66,19 @@ async def async_setup_entry(
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up MelCloud device climate based on config_entry."""
|
"""Set up MelCloud device climate based on config_entry."""
|
||||||
mel_devices = hass.data[DOMAIN][entry.entry_id]
|
mel_devices = hass.data[DOMAIN][entry.entry_id]
|
||||||
async_add_entities(
|
entities: list[AtaDeviceClimate | AtwDeviceZoneClimate] = [
|
||||||
[
|
|
||||||
AtaDeviceClimate(mel_device, mel_device.device)
|
AtaDeviceClimate(mel_device, mel_device.device)
|
||||||
for mel_device in mel_devices[DEVICE_TYPE_ATA]
|
for mel_device in mel_devices[DEVICE_TYPE_ATA]
|
||||||
]
|
]
|
||||||
+ [
|
entities.extend(
|
||||||
|
[
|
||||||
AtwDeviceZoneClimate(mel_device, mel_device.device, zone)
|
AtwDeviceZoneClimate(mel_device, mel_device.device, zone)
|
||||||
for mel_device in mel_devices[DEVICE_TYPE_ATW]
|
for mel_device in mel_devices[DEVICE_TYPE_ATW]
|
||||||
for zone in mel_device.device.zones
|
for zone in mel_device.device.zones
|
||||||
],
|
]
|
||||||
|
)
|
||||||
|
async_add_entities(
|
||||||
|
entities,
|
||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -157,14 +160,16 @@ class AtaDeviceClimate(MelCloudClimate):
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> HVACMode:
|
def hvac_mode(self) -> HVACMode | None:
|
||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
mode = self._device.operation_mode
|
mode = self._device.operation_mode
|
||||||
if not self._device.power or mode is None:
|
if not self._device.power or mode is None:
|
||||||
return HVACMode.OFF
|
return HVACMode.OFF
|
||||||
return ATA_HVAC_MODE_LOOKUP.get(mode)
|
return ATA_HVAC_MODE_LOOKUP.get(mode)
|
||||||
|
|
||||||
def _apply_set_hvac_mode(self, hvac_mode: str, set_dict: dict[str, Any]) -> None:
|
def _apply_set_hvac_mode(
|
||||||
|
self, hvac_mode: HVACMode, set_dict: dict[str, Any]
|
||||||
|
) -> None:
|
||||||
"""Apply hvac mode changes to a dict used to call _device.set."""
|
"""Apply hvac mode changes to a dict used to call _device.set."""
|
||||||
if hvac_mode == HVACMode.OFF:
|
if hvac_mode == HVACMode.OFF:
|
||||||
set_dict["power"] = False
|
set_dict["power"] = False
|
||||||
|
@ -180,7 +185,7 @@ class AtaDeviceClimate(MelCloudClimate):
|
||||||
|
|
||||||
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||||
"""Set new target hvac mode."""
|
"""Set new target hvac mode."""
|
||||||
set_dict = {}
|
set_dict: dict[str, Any] = {}
|
||||||
self._apply_set_hvac_mode(hvac_mode, set_dict)
|
self._apply_set_hvac_mode(hvac_mode, set_dict)
|
||||||
await self._device.set(set_dict)
|
await self._device.set(set_dict)
|
||||||
|
|
||||||
|
@ -188,7 +193,9 @@ class AtaDeviceClimate(MelCloudClimate):
|
||||||
def hvac_modes(self) -> list[HVACMode]:
|
def hvac_modes(self) -> list[HVACMode]:
|
||||||
"""Return the list of available hvac operation modes."""
|
"""Return the list of available hvac operation modes."""
|
||||||
return [HVACMode.OFF] + [
|
return [HVACMode.OFF] + [
|
||||||
ATA_HVAC_MODE_LOOKUP.get(mode) for mode in self._device.operation_modes
|
ATA_HVAC_MODE_LOOKUP[mode]
|
||||||
|
for mode in self._device.operation_modes
|
||||||
|
if mode in ATA_HVAC_MODE_LOOKUP
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -201,9 +208,9 @@ class AtaDeviceClimate(MelCloudClimate):
|
||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
return self._device.target_temperature
|
return self._device.target_temperature
|
||||||
|
|
||||||
async def async_set_temperature(self, **kwargs) -> None:
|
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
set_dict = {}
|
set_dict: dict[str, Any] = {}
|
||||||
if ATTR_HVAC_MODE in kwargs:
|
if ATTR_HVAC_MODE in kwargs:
|
||||||
self._apply_set_hvac_mode(
|
self._apply_set_hvac_mode(
|
||||||
kwargs.get(ATTR_HVAC_MODE, self.hvac_mode), set_dict
|
kwargs.get(ATTR_HVAC_MODE, self.hvac_mode), set_dict
|
||||||
|
@ -255,7 +262,7 @@ class AtaDeviceClimate(MelCloudClimate):
|
||||||
await self.async_set_vane_vertical(swing_mode)
|
await self.async_set_vane_vertical(swing_mode)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def swing_modes(self) -> str | None:
|
def swing_modes(self) -> list[str] | None:
|
||||||
"""Return a list of available vertical vane positions and modes."""
|
"""Return a list of available vertical vane positions and modes."""
|
||||||
return self._device.vane_vertical_positions
|
return self._device.vane_vertical_positions
|
||||||
|
|
||||||
|
|
6
mypy.ini
6
mypy.ini
|
@ -2761,12 +2761,6 @@ ignore_errors = true
|
||||||
[mypy-homeassistant.components.lyric.sensor]
|
[mypy-homeassistant.components.lyric.sensor]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.melcloud]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.melcloud.climate]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.meteo_france.sensor]
|
[mypy-homeassistant.components.meteo_france.sensor]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||||
"homeassistant.components.lyric.climate",
|
"homeassistant.components.lyric.climate",
|
||||||
"homeassistant.components.lyric.config_flow",
|
"homeassistant.components.lyric.config_flow",
|
||||||
"homeassistant.components.lyric.sensor",
|
"homeassistant.components.lyric.sensor",
|
||||||
"homeassistant.components.melcloud",
|
|
||||||
"homeassistant.components.melcloud.climate",
|
|
||||||
"homeassistant.components.meteo_france.sensor",
|
"homeassistant.components.meteo_france.sensor",
|
||||||
"homeassistant.components.meteo_france.weather",
|
"homeassistant.components.meteo_france.weather",
|
||||||
"homeassistant.components.minecraft_server",
|
"homeassistant.components.minecraft_server",
|
||||||
|
|
Loading…
Add table
Reference in a new issue