mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 01:11:51 -04:00
Update pylint rule for async_get_device_diagnostics (#179966)
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
"""Diagnostics support for Alexa Devices integration."""
|
||||
|
||||
from dataclasses import asdict
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from aioamazondevices.structures import AmazonDevice
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceEntry
|
||||
|
||||
from .coordinator import AmazonConfigEntry
|
||||
|
||||
@@ -48,13 +48,16 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: AmazonConfigEntry, device_entry: DeviceEntry
|
||||
hass: HomeAssistant, entry: AmazonConfigEntry, device_entry: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
|
||||
coordinator = entry.runtime_data
|
||||
|
||||
assert device_entry.serial_number
|
||||
if TYPE_CHECKING:
|
||||
# alexa_devices does not create child devices, and devices have a serial number
|
||||
assert isinstance(device_entry, DeviceEntry)
|
||||
assert device_entry.serial_number
|
||||
|
||||
return build_device_data(coordinator.data[device_entry.serial_number])
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Any, cast, overload
|
||||
import attr
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
from homeassistant.helpers.entity_registry import RegistryEntry
|
||||
|
||||
from .const import REDACTED
|
||||
@@ -65,7 +65,7 @@ def _device_entry_filter(a: attr.Attribute, _: Any) -> bool:
|
||||
|
||||
|
||||
@callback
|
||||
def device_entry_as_dict(entry: DeviceEntry) -> dict[str, Any]:
|
||||
def device_entry_as_dict(entry: AnyDeviceEntry) -> dict[str, Any]:
|
||||
"""Convert a device registry entry to a dict for diagnostics.
|
||||
|
||||
This excludes internal fields that should not be exposed in diagnostics.
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from . import EcowittConfigEntry
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: EcowittConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: EcowittConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
ecowitt = entry.runtime_data
|
||||
|
||||
@@ -7,7 +7,7 @@ from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from . import CONF_IMPORT_PLUGINS, FibaroConfigEntry
|
||||
|
||||
@@ -34,7 +34,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: FibaroConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, config_entry: FibaroConfigEntry, device: AnyDeviceEntry
|
||||
) -> Mapping[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
controller = config_entry.runtime_data
|
||||
|
||||
@@ -54,7 +54,7 @@ SETTINGS_TO_REDACT = {
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: FullyKioskConfigEntry, device: dr.DeviceEntry
|
||||
hass: HomeAssistant, entry: FullyKioskConfigEntry, device: dr.AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return device diagnostics."""
|
||||
coordinator = entry.runtime_data
|
||||
|
||||
@@ -9,7 +9,7 @@ from pyheos import HeosError
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import ATTR_PASSWORD, ATTR_USERNAME, DOMAIN
|
||||
from .coordinator import HeosConfigEntry
|
||||
@@ -66,7 +66,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: HeosConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, config_entry: HeosConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Any
|
||||
from aiohomeconnect.model import GetSetting, Status
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import HomeConnectApplianceData, HomeConnectConfigEntry
|
||||
@@ -53,7 +53,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: HomeConnectConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: HomeConnectConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
ha_id = next(
|
||||
|
||||
@@ -11,7 +11,7 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from . import DOMAIN, HomeeConfigEntry
|
||||
|
||||
@@ -42,7 +42,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: HomeeConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: HomeeConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Diagnostics support for HomeKit Controller."""
|
||||
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from aiohomekit.model.characteristics.characteristic_types import CharacteristicsTypes
|
||||
|
||||
@@ -8,7 +8,7 @@ from homeassistant.components.diagnostics import REDACTED, async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceEntry
|
||||
|
||||
from .connection import HKDevice
|
||||
from .const import KNOWN_DEVICES
|
||||
@@ -33,9 +33,13 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: ConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
if TYPE_CHECKING:
|
||||
# homekit_controller does not create child devices
|
||||
assert isinstance(device, DeviceEntry)
|
||||
|
||||
return _async_get_diagnostics(hass, entry, device)
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from homeassistant.components.diagnostics import (
|
||||
from homeassistant.const import ATTR_CONFIGURATION_URL, CONF_HOST
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import REDACT_HUB_ADDRESS, REDACT_MAC_ADDRESS, REDACT_SERIAL_NUMBER
|
||||
from .model import PowerviewConfigEntry
|
||||
@@ -43,7 +43,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: PowerviewConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: PowerviewConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
data = _async_get_diagnostics(hass, entry)
|
||||
@@ -71,7 +71,9 @@ def _async_get_diagnostics(
|
||||
|
||||
|
||||
@callback
|
||||
def _async_device_as_dict(hass: HomeAssistant, device: DeviceEntry) -> dict[str, Any]:
|
||||
def _async_device_as_dict(
|
||||
hass: HomeAssistant, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Represent a Powerview device as a dictionary."""
|
||||
|
||||
# Gather information how this device is represented in Home Assistant
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"""Diagnostics support for Husqvarna Automower."""
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceEntry
|
||||
|
||||
from . import AutomowerConfigEntry
|
||||
from .const import DOMAIN
|
||||
@@ -30,9 +30,13 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: AutomowerConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: AutomowerConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
if TYPE_CHECKING:
|
||||
# husqvarna_automower does not create child devices
|
||||
assert isinstance(device, DeviceEntry)
|
||||
|
||||
coordinator = entry.runtime_data
|
||||
for identifier in device.identifiers:
|
||||
if identifier[0] == DOMAIN:
|
||||
|
||||
@@ -53,7 +53,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: MatterConfigEntry, device: dr.DeviceEntry
|
||||
hass: HomeAssistant, config_entry: MatterConfigEntry, device: dr.AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
matter = get_matter(hass)
|
||||
|
||||
@@ -107,7 +107,7 @@ def node_from_ha_device_id(hass: HomeAssistant, ha_device_id: str) -> MatterNode
|
||||
|
||||
@callback
|
||||
def get_node_from_device_entry(
|
||||
hass: HomeAssistant, device: dr.DeviceEntry
|
||||
hass: HomeAssistant, device: dr.AnyDeviceEntry
|
||||
) -> MatterNode | None:
|
||||
"""Return MatterNode from device entry."""
|
||||
matter = get_matter(hass)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"""Diagnostics support for Miele."""
|
||||
|
||||
import hashlib
|
||||
from typing import Any, cast
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
|
||||
from pymiele import completed_warnings
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceEntry
|
||||
|
||||
from .coordinator import MieleConfigEntry
|
||||
|
||||
@@ -69,9 +69,13 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: MieleConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, config_entry: MieleConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
if TYPE_CHECKING:
|
||||
# miele does not create child devices
|
||||
assert isinstance(device, DeviceEntry)
|
||||
|
||||
info = {
|
||||
"manufacturer": device.manufacturer,
|
||||
"model": device.model,
|
||||
|
||||
@@ -8,7 +8,7 @@ from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EntityStateAttribute
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from . import debug_info, is_connected
|
||||
|
||||
@@ -27,7 +27,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: ConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
return _async_get_diagnostics(hass, entry, device)
|
||||
@@ -37,7 +37,7 @@ async def async_get_device_diagnostics(
|
||||
def _async_get_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
device: DeviceEntry | None = None,
|
||||
device: AnyDeviceEntry | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
redacted_config = {
|
||||
@@ -69,7 +69,9 @@ def _async_get_diagnostics(
|
||||
|
||||
|
||||
@callback
|
||||
def _async_device_as_dict(hass: HomeAssistant, device: DeviceEntry) -> dict[str, Any]:
|
||||
def _async_device_as_dict(
|
||||
hass: HomeAssistant, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Represent an MQTT device as a dictionary."""
|
||||
|
||||
# Gather information how this MQTT device is represented in Home Assistant
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"""Diagnostics support for Nederlandse Spoorwegen."""
|
||||
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceEntry
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import NSConfigEntry
|
||||
@@ -51,9 +51,13 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: NSConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: NSConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a route."""
|
||||
if TYPE_CHECKING:
|
||||
# nederlandse_spoorwegen does not create child devices
|
||||
assert isinstance(device, DeviceEntry)
|
||||
|
||||
# Find the coordinator for this device
|
||||
coordinator = None
|
||||
subentry_id = None
|
||||
|
||||
@@ -7,7 +7,7 @@ from google_nest_sdm.device_traits import InfoTrait
|
||||
|
||||
from homeassistant.components.camera import diagnostics as camera_diagnostics
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .types import NestConfigEntry
|
||||
|
||||
@@ -41,7 +41,7 @@ async def async_get_config_entry_diagnostics(
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
config_entry: NestConfigEntry,
|
||||
device: DeviceEntry,
|
||||
device: AnyDeviceEntry,
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
nest_devices = config_entry.runtime_data.device_manager.devices
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Diagnostics support for 1-Wire."""
|
||||
|
||||
from dataclasses import asdict
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.const import CONF_HOST
|
||||
@@ -30,9 +30,12 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: OneWireConfigEntry, device_entry: dr.DeviceEntry
|
||||
hass: HomeAssistant, entry: OneWireConfigEntry, device_entry: dr.AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
if TYPE_CHECKING:
|
||||
# onewire does not create child devices
|
||||
assert isinstance(device_entry, dr.DeviceEntry)
|
||||
|
||||
onewire_hub = entry.runtime_data
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"""Provides diagnostics for Overkiz."""
|
||||
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from pyoverkiz.enums import APIType
|
||||
from pyoverkiz.obfuscate import obfuscate_id
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry, DeviceEntry
|
||||
|
||||
from . import OverkizDataConfigEntry
|
||||
from .const import CONF_API_TYPE, CONF_HUB
|
||||
@@ -35,9 +35,13 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: OverkizDataConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: OverkizDataConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
if TYPE_CHECKING:
|
||||
# overkiz does not create child devices
|
||||
assert isinstance(device, DeviceEntry)
|
||||
|
||||
client = entry.runtime_data.coordinator.client
|
||||
|
||||
device_url = min(device.identifiers)[1]
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from . import RenaultConfigEntry
|
||||
from .const import RenaultConfigurationKeys
|
||||
@@ -40,7 +40,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: RenaultConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: RenaultConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
vin = next(iter(device.identifiers))[1]
|
||||
|
||||
@@ -7,7 +7,7 @@ from typing import Any
|
||||
from pysmartthings import DeviceEvent
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from . import SmartThingsConfigEntry
|
||||
from .const import DOMAIN
|
||||
@@ -25,7 +25,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: SmartThingsConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: SmartThingsConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
client = entry.runtime_data.client
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Any
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import DOMAIN
|
||||
from .helpers import SonosConfigEntry
|
||||
@@ -66,7 +66,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: SonosConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, config_entry: SonosConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
uid = next(
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_PASSWORD, CONF_PIN, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import VEHICLE_VIN
|
||||
from .coordinator import SubaruConfigEntry
|
||||
@@ -40,7 +40,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: SubaruConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, config_entry: SubaruConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
coordinator = config_entry.runtime_data.coordinator
|
||||
|
||||
@@ -68,7 +68,7 @@ async def async_get_config_entry_diagnostics(
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
entry: TraccarServerConfigEntry,
|
||||
device: dr.DeviceEntry,
|
||||
device: dr.AnyDeviceEntry,
|
||||
) -> dict[str, Any]:
|
||||
"""Return device diagnostics."""
|
||||
coordinator = entry.runtime_data
|
||||
|
||||
@@ -8,7 +8,7 @@ from tuya_sharing import CustomerDevice
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import DOMAIN, DPCode
|
||||
from .coordinator import TuyaConfigEntry
|
||||
@@ -29,7 +29,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: TuyaConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: TuyaConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
return _async_get_diagnostics(hass, entry, device)
|
||||
@@ -39,7 +39,7 @@ async def async_get_device_diagnostics(
|
||||
def _async_get_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
entry: TuyaConfigEntry,
|
||||
device: DeviceEntry | None = None,
|
||||
device: AnyDeviceEntry | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
manager = entry.runtime_data.manager
|
||||
|
||||
@@ -7,7 +7,7 @@ from pyvesync import VeSync
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import VesyncConfigEntry
|
||||
@@ -37,7 +37,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: VesyncConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, config_entry: VesyncConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
manager: VeSync = config_entry.runtime_data.manager
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Any
|
||||
from zeversolar import ZeverSolarData
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.device_registry import AnyDeviceEntry
|
||||
|
||||
from .coordinator import ZeversolarConfigEntry
|
||||
|
||||
@@ -34,7 +34,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, entry: ZeversolarConfigEntry, device: DeviceEntry
|
||||
hass: HomeAssistant, entry: ZeversolarConfigEntry, device: AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device entry."""
|
||||
coordinator = entry.runtime_data
|
||||
|
||||
@@ -119,7 +119,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, device: dr.DeviceEntry
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, device: dr.AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
zha_device_proxy: ZHADeviceProxy = async_get_zha_device_proxy(hass, device.id)
|
||||
|
||||
@@ -74,7 +74,7 @@ def get_device_entities(
|
||||
hass: HomeAssistant,
|
||||
node: Node,
|
||||
config_entry: ZwaveJSConfigEntry,
|
||||
device: dr.DeviceEntry,
|
||||
device: dr.AnyDeviceEntry,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Get entities for a device."""
|
||||
entity_entries = er.async_entries_for_device(
|
||||
@@ -145,7 +145,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
hass: HomeAssistant, config_entry: ZwaveJSConfigEntry, device: dr.DeviceEntry
|
||||
hass: HomeAssistant, config_entry: ZwaveJSConfigEntry, device: dr.AnyDeviceEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
client: Client = config_entry.runtime_data.client
|
||||
|
||||
@@ -256,7 +256,7 @@ def get_device_id_ext(driver: Driver, node: ZwaveNode) -> tuple[str, str] | None
|
||||
|
||||
|
||||
def get_home_and_node_id_from_device_entry(
|
||||
device_entry: dr.DeviceEntry,
|
||||
device_entry: dr.AnyDeviceEntry,
|
||||
) -> tuple[str, int] | None:
|
||||
"""Get home ID and node ID for Z-Wave device registry entry.
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
||||
arg_types={
|
||||
0: "HomeAssistant",
|
||||
1: "ConfigEntry",
|
||||
2: "DeviceEntry",
|
||||
2: "AnyDeviceEntry",
|
||||
},
|
||||
return_type="Mapping[str, Any]",
|
||||
mandatory=True,
|
||||
|
||||
Reference in New Issue
Block a user