mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove lutron_caseta from mypy ignore list (#74427)
This commit is contained in:
parent
02a0b8b649
commit
560fbd1a0e
@ -215,10 +215,10 @@ def _async_register_button_devices(
|
|||||||
config_entry_id: str,
|
config_entry_id: str,
|
||||||
bridge_device,
|
bridge_device,
|
||||||
button_devices_by_id: dict[int, dict],
|
button_devices_by_id: dict[int, dict],
|
||||||
) -> dict[str, dr.DeviceEntry]:
|
) -> dict[str, dict]:
|
||||||
"""Register button devices (Pico Remotes) in the device registry."""
|
"""Register button devices (Pico Remotes) in the device registry."""
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
button_devices_by_dr_id = {}
|
button_devices_by_dr_id: dict[str, dict] = {}
|
||||||
seen = set()
|
seen = set()
|
||||||
|
|
||||||
for device in button_devices_by_id.values():
|
for device in button_devices_by_id.values():
|
||||||
@ -226,7 +226,7 @@ def _async_register_button_devices(
|
|||||||
continue
|
continue
|
||||||
seen.add(device["serial"])
|
seen.add(device["serial"])
|
||||||
area, name = _area_and_name_from_name(device["name"])
|
area, name = _area_and_name_from_name(device["name"])
|
||||||
device_args = {
|
device_args: dict[str, Any] = {
|
||||||
"name": f"{area} {name}",
|
"name": f"{area} {name}",
|
||||||
"manufacturer": MANUFACTURER,
|
"manufacturer": MANUFACTURER,
|
||||||
"config_entry_id": config_entry_id,
|
"config_entry_id": config_entry_id,
|
||||||
@ -246,7 +246,8 @@ def _async_register_button_devices(
|
|||||||
def _area_and_name_from_name(device_name: str) -> tuple[str, str]:
|
def _area_and_name_from_name(device_name: str) -> tuple[str, str]:
|
||||||
"""Return the area and name from the devices internal name."""
|
"""Return the area and name from the devices internal name."""
|
||||||
if "_" in device_name:
|
if "_" in device_name:
|
||||||
return device_name.split("_", 1)
|
area_device_name = device_name.split("_", 1)
|
||||||
|
return area_device_name[0], area_device_name[1]
|
||||||
return UNASSIGNED_AREA, device_name
|
return UNASSIGNED_AREA, device_name
|
||||||
|
|
||||||
|
|
||||||
@ -381,13 +382,13 @@ class LutronCasetaDevice(Entity):
|
|||||||
class LutronCasetaDeviceUpdatableEntity(LutronCasetaDevice):
|
class LutronCasetaDeviceUpdatableEntity(LutronCasetaDevice):
|
||||||
"""A lutron_caseta entity that can update by syncing data from the bridge."""
|
"""A lutron_caseta entity that can update by syncing data from the bridge."""
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self) -> None:
|
||||||
"""Update when forcing a refresh of the device."""
|
"""Update when forcing a refresh of the device."""
|
||||||
self._device = self._smartbridge.get_device_by_id(self.device_id)
|
self._device = self._smartbridge.get_device_by_id(self.device_id)
|
||||||
_LOGGER.debug(self._device)
|
_LOGGER.debug(self._device)
|
||||||
|
|
||||||
|
|
||||||
def _id_to_identifier(lutron_id: str) -> None:
|
def _id_to_identifier(lutron_id: str) -> tuple[str, str]:
|
||||||
"""Convert a lutron caseta identifier to a device identifier."""
|
"""Convert a lutron caseta identifier to a device identifier."""
|
||||||
return (DOMAIN, lutron_id)
|
return (DOMAIN, lutron_id)
|
||||||
|
|
||||||
|
@ -66,13 +66,13 @@ class LutronCasetaCover(LutronCasetaDeviceUpdatableEntity, CoverEntity):
|
|||||||
async def async_close_cover(self, **kwargs: Any) -> None:
|
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
await self._smartbridge.lower_cover(self.device_id)
|
await self._smartbridge.lower_cover(self.device_id)
|
||||||
self.async_update()
|
await self.async_update()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_open_cover(self, **kwargs: Any) -> None:
|
async def async_open_cover(self, **kwargs: Any) -> None:
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
await self._smartbridge.raise_cover(self.device_id)
|
await self._smartbridge.raise_cover(self.device_id)
|
||||||
self.async_update()
|
await self.async_update()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_set_cover_position(self, **kwargs: Any) -> None:
|
async def async_set_cover_position(self, **kwargs: Any) -> None:
|
||||||
|
@ -430,9 +430,11 @@ async def async_attach_trigger(
|
|||||||
"""Attach a trigger."""
|
"""Attach a trigger."""
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
device = device_registry.async_get(config[CONF_DEVICE_ID])
|
device = device_registry.async_get(config[CONF_DEVICE_ID])
|
||||||
|
assert device
|
||||||
|
assert device.model
|
||||||
device_type = _device_model_to_type(device.model)
|
device_type = _device_model_to_type(device.model)
|
||||||
_, serial = list(device.identifiers)[0]
|
_, serial = list(device.identifiers)[0]
|
||||||
schema = DEVICE_TYPE_SCHEMA_MAP.get(device_type)
|
schema = DEVICE_TYPE_SCHEMA_MAP[device_type]
|
||||||
valid_buttons = DEVICE_TYPE_SUBTYPE_MAP_TO_LEAP[device_type]
|
valid_buttons = DEVICE_TYPE_SUBTYPE_MAP_TO_LEAP[device_type]
|
||||||
config = schema(config)
|
config = schema(config)
|
||||||
event_config = {
|
event_config = {
|
||||||
|
@ -6,8 +6,6 @@ from typing import Any
|
|||||||
|
|
||||||
from pylutron_caseta.smartbridge import Smartbridge
|
from pylutron_caseta.smartbridge import Smartbridge
|
||||||
|
|
||||||
from homeassistant.helpers.device_registry import DeviceEntry
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LutronCasetaData:
|
class LutronCasetaData:
|
||||||
@ -15,4 +13,4 @@ class LutronCasetaData:
|
|||||||
|
|
||||||
bridge: Smartbridge
|
bridge: Smartbridge
|
||||||
bridge_device: dict[str, Any]
|
bridge_device: dict[str, Any]
|
||||||
button_devices: dict[str, DeviceEntry]
|
button_devices: dict[str, dict]
|
||||||
|
9
mypy.ini
9
mypy.ini
@ -2752,15 +2752,6 @@ ignore_errors = true
|
|||||||
[mypy-homeassistant.components.lovelace.websocket]
|
[mypy-homeassistant.components.lovelace.websocket]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.lutron_caseta]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.lutron_caseta.device_trigger]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.lutron_caseta.switch]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.lyric.climate]
|
[mypy-homeassistant.components.lyric.climate]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
@ -59,9 +59,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||||||
"homeassistant.components.lovelace.dashboard",
|
"homeassistant.components.lovelace.dashboard",
|
||||||
"homeassistant.components.lovelace.resources",
|
"homeassistant.components.lovelace.resources",
|
||||||
"homeassistant.components.lovelace.websocket",
|
"homeassistant.components.lovelace.websocket",
|
||||||
"homeassistant.components.lutron_caseta",
|
|
||||||
"homeassistant.components.lutron_caseta.device_trigger",
|
|
||||||
"homeassistant.components.lutron_caseta.switch",
|
|
||||||
"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",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user