mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Remove xiaomi_aqara from mypy ignore list (#73526)
This commit is contained in:
parent
17eb8c95dd
commit
94a8fe0052
@ -82,7 +82,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
def play_ringtone_service(call: ServiceCall) -> None:
|
def play_ringtone_service(call: ServiceCall) -> None:
|
||||||
"""Service to play ringtone through Gateway."""
|
"""Service to play ringtone through Gateway."""
|
||||||
ring_id = call.data.get(ATTR_RINGTONE_ID)
|
ring_id = call.data.get(ATTR_RINGTONE_ID)
|
||||||
gateway = call.data.get(ATTR_GW_MAC)
|
gateway: XiaomiGateway = call.data[ATTR_GW_MAC]
|
||||||
|
|
||||||
kwargs = {"mid": ring_id}
|
kwargs = {"mid": ring_id}
|
||||||
|
|
||||||
@ -93,12 +93,12 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
|
|
||||||
def stop_ringtone_service(call: ServiceCall) -> None:
|
def stop_ringtone_service(call: ServiceCall) -> None:
|
||||||
"""Service to stop playing ringtone on Gateway."""
|
"""Service to stop playing ringtone on Gateway."""
|
||||||
gateway = call.data.get(ATTR_GW_MAC)
|
gateway: XiaomiGateway = call.data[ATTR_GW_MAC]
|
||||||
gateway.write_to_hub(gateway.sid, mid=10000)
|
gateway.write_to_hub(gateway.sid, mid=10000)
|
||||||
|
|
||||||
def add_device_service(call: ServiceCall) -> None:
|
def add_device_service(call: ServiceCall) -> None:
|
||||||
"""Service to add a new sub-device within the next 30 seconds."""
|
"""Service to add a new sub-device within the next 30 seconds."""
|
||||||
gateway = call.data.get(ATTR_GW_MAC)
|
gateway: XiaomiGateway = call.data[ATTR_GW_MAC]
|
||||||
gateway.write_to_hub(gateway.sid, join_permission="yes")
|
gateway.write_to_hub(gateway.sid, join_permission="yes")
|
||||||
persistent_notification.async_create(
|
persistent_notification.async_create(
|
||||||
hass,
|
hass,
|
||||||
@ -110,7 +110,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
def remove_device_service(call: ServiceCall) -> None:
|
def remove_device_service(call: ServiceCall) -> None:
|
||||||
"""Service to remove a sub-device from the gateway."""
|
"""Service to remove a sub-device from the gateway."""
|
||||||
device_id = call.data.get(ATTR_DEVICE_ID)
|
device_id = call.data.get(ATTR_DEVICE_ID)
|
||||||
gateway = call.data.get(ATTR_GW_MAC)
|
gateway: XiaomiGateway = call.data[ATTR_GW_MAC]
|
||||||
gateway.write_to_hub(gateway.sid, remove_device=device_id)
|
gateway.write_to_hub(gateway.sid, remove_device=device_id)
|
||||||
|
|
||||||
gateway_only_schema = _add_gateway_to_schema(hass, vol.Schema({}))
|
gateway_only_schema = _add_gateway_to_schema(hass, vol.Schema({}))
|
||||||
@ -181,6 +181,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
entry.data[CONF_HOST],
|
entry.data[CONF_HOST],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert entry.unique_id
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
device_registry.async_get_or_create(
|
device_registry.async_get_or_create(
|
||||||
config_entry_id=entry.entry_id,
|
config_entry_id=entry.entry_id,
|
||||||
|
@ -34,7 +34,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Perform the setup for Xiaomi devices."""
|
"""Perform the setup for Xiaomi devices."""
|
||||||
entities = []
|
entities: list[XiaomiBinarySensor] = []
|
||||||
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
|
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
|
||||||
for entity in gateway.devices["binary_sensor"]:
|
for entity in gateway.devices["binary_sensor"]:
|
||||||
model = entity["model"]
|
model = entity["model"]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Xiaomi Aqara locks."""
|
"""Support for Xiaomi Aqara locks."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.lock import LockEntity
|
from homeassistant.components.lock import LockEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
|
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
|
||||||
@ -44,13 +46,14 @@ class XiaomiAqaraLock(LockEntity, XiaomiDevice):
|
|||||||
super().__init__(device, name, xiaomi_hub, config_entry)
|
super().__init__(device, name, xiaomi_hub, config_entry)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_locked(self) -> bool:
|
def is_locked(self) -> bool | None:
|
||||||
"""Return true if lock is locked."""
|
"""Return true if lock is locked."""
|
||||||
if self._state is not None:
|
if self._state is not None:
|
||||||
return self._state == STATE_LOCKED
|
return self._state == STATE_LOCKED
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def changed_by(self) -> int:
|
def changed_by(self) -> str:
|
||||||
"""Last change triggered by."""
|
"""Last change triggered by."""
|
||||||
return self._changed_by
|
return self._changed_by
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Perform the setup for Xiaomi devices."""
|
"""Perform the setup for Xiaomi devices."""
|
||||||
entities = []
|
entities: list[XiaomiSensor | XiaomiBatterySensor] = []
|
||||||
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
|
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
|
||||||
for device in gateway.devices["sensor"]:
|
for device in gateway.devices["sensor"]:
|
||||||
if device["model"] == "sensor_ht":
|
if device["model"] == "sensor_ht":
|
||||||
|
12
mypy.ini
12
mypy.ini
@ -2976,18 +2976,6 @@ ignore_errors = true
|
|||||||
[mypy-homeassistant.components.xbox.sensor]
|
[mypy-homeassistant.components.xbox.sensor]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.xiaomi_aqara]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.xiaomi_aqara.binary_sensor]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.xiaomi_aqara.lock]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.xiaomi_aqara.sensor]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.xiaomi_miio]
|
[mypy-homeassistant.components.xiaomi_miio]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
@ -141,10 +141,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||||||
"homeassistant.components.xbox.browse_media",
|
"homeassistant.components.xbox.browse_media",
|
||||||
"homeassistant.components.xbox.media_source",
|
"homeassistant.components.xbox.media_source",
|
||||||
"homeassistant.components.xbox.sensor",
|
"homeassistant.components.xbox.sensor",
|
||||||
"homeassistant.components.xiaomi_aqara",
|
|
||||||
"homeassistant.components.xiaomi_aqara.binary_sensor",
|
|
||||||
"homeassistant.components.xiaomi_aqara.lock",
|
|
||||||
"homeassistant.components.xiaomi_aqara.sensor",
|
|
||||||
"homeassistant.components.xiaomi_miio",
|
"homeassistant.components.xiaomi_miio",
|
||||||
"homeassistant.components.xiaomi_miio.air_quality",
|
"homeassistant.components.xiaomi_miio.air_quality",
|
||||||
"homeassistant.components.xiaomi_miio.binary_sensor",
|
"homeassistant.components.xiaomi_miio.binary_sensor",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user