mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove redundant source_type property from ScannerEntities (#126716)
This commit is contained in:
parent
a3c2a7e1e0
commit
b48c439bff
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -71,11 +71,6 @@ class AsusWrtDevice(ScannerEntity):
|
|||||||
"""Return true if the device is connected to the network."""
|
"""Return true if the device is connected to the network."""
|
||||||
return self._device.is_connected
|
return self._device.is_connected
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hostname(self) -> str | None:
|
def hostname(self) -> str | None:
|
||||||
"""Return the hostname of device."""
|
"""Return the hostname of device."""
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -98,11 +98,6 @@ class FreeboxDevice(ScannerEntity):
|
|||||||
"""Return true if the device is connected to the network."""
|
"""Return true if the device is connected to the network."""
|
||||||
return self._active
|
return self._active
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_on_demand_update(self) -> None:
|
def async_on_demand_update(self) -> None:
|
||||||
"""Update state."""
|
"""Update state."""
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -112,8 +112,3 @@ class FritzBoxTracker(FritzDeviceBase, ScannerEntity):
|
|||||||
if device.ssid:
|
if device.ssid:
|
||||||
attrs["ssid"] = device.ssid
|
attrs["ssid"] = device.ssid
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return tracker source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
@ -11,7 +11,6 @@ from stringcase import snakecase
|
|||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
DOMAIN as DEVICE_TRACKER_DOMAIN,
|
DOMAIN as DEVICE_TRACKER_DOMAIN,
|
||||||
ScannerEntity,
|
ScannerEntity,
|
||||||
SourceType,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -195,11 +194,6 @@ class HuaweiLteScannerEntity(HuaweiLteBaseEntity, ScannerEntity):
|
|||||||
def _device_unique_id(self) -> str:
|
def _device_unique_id(self) -> str:
|
||||||
return self.mac_address
|
return self.mac_address
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return SourceType.ROUTER."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip_address(self) -> str | None:
|
def ip_address(self) -> str | None:
|
||||||
"""Return the primary ip address of the device."""
|
"""Return the primary ip address of the device."""
|
||||||
|
@ -9,7 +9,6 @@ from ndms2_client import Device
|
|||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
DOMAIN as DEVICE_TRACKER_DOMAIN,
|
DOMAIN as DEVICE_TRACKER_DOMAIN,
|
||||||
ScannerEntity,
|
ScannerEntity,
|
||||||
SourceType,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -103,11 +102,6 @@ class KeeneticTracker(ScannerEntity):
|
|||||||
< self._router.consider_home_interval
|
< self._router.consider_home_interval
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type of the client."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
"""Return the name of the device."""
|
"""Return the name of the device."""
|
||||||
|
@ -7,7 +7,6 @@ from typing import Any
|
|||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
DOMAIN as DEVICE_TRACKER,
|
DOMAIN as DEVICE_TRACKER,
|
||||||
ScannerEntity,
|
ScannerEntity,
|
||||||
SourceType,
|
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@ -94,11 +93,6 @@ class MikrotikDataUpdateCoordinatorTracker(
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type of the client."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hostname(self) -> str:
|
def hostname(self) -> str:
|
||||||
"""Return the hostname of the client."""
|
"""Return the hostname of the client."""
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -81,11 +81,6 @@ class NetgearScannerEntity(NetgearDeviceEntity, ScannerEntity):
|
|||||||
"""Return true if the device is connected to the router."""
|
"""Return true if the device is connected to the router."""
|
||||||
return self._active
|
return self._active
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip_address(self) -> str:
|
def ip_address(self) -> str:
|
||||||
"""Return the IP address."""
|
"""Return the IP address."""
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -95,11 +95,6 @@ class NmapTrackerEntity(ScannerEntity):
|
|||||||
return None
|
return None
|
||||||
return short_hostname(self._device.hostname)
|
return short_hostname(self._device.hostname)
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return tracker source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_process_update(self, online: bool) -> None:
|
def async_process_update(self, online: bool) -> None:
|
||||||
"""Update device."""
|
"""Update device."""
|
||||||
|
@ -8,7 +8,6 @@ from homeassistant.components.device_tracker import (
|
|||||||
CONF_CONSIDER_HOME,
|
CONF_CONSIDER_HOME,
|
||||||
DEFAULT_CONSIDER_HOME,
|
DEFAULT_CONSIDER_HOME,
|
||||||
ScannerEntity,
|
ScannerEntity,
|
||||||
SourceType,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -57,11 +56,6 @@ class PingDeviceTracker(CoordinatorEntity[PingUpdateCoordinator], ScannerEntity)
|
|||||||
"""Return a unique ID."""
|
"""Return a unique ID."""
|
||||||
return self.config_entry.entry_id
|
return self.config_entry.entry_id
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type which is router."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_connected(self) -> bool:
|
def is_connected(self) -> bool:
|
||||||
"""Return true if ping returns is_alive or considered home."""
|
"""Return true if ping returns is_alive or considered home."""
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@ -121,8 +121,3 @@ class RuckusDevice(CoordinatorEntity, ScannerEntity):
|
|||||||
def is_connected(self) -> bool:
|
def is_connected(self) -> bool:
|
||||||
"""Return true if the device is connected to the network."""
|
"""Return true if the device is connected to the network."""
|
||||||
return self._mac in self.coordinator.data[KEY_SYS_CLIENTS]
|
return self._mac in self.coordinator.data[KEY_SYS_CLIENTS]
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
|
|
||||||
from tplink_omada_client.clients import OmadaWirelessClient
|
from tplink_omada_client.clients import OmadaWirelessClient
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -61,11 +61,6 @@ class OmadaClientScannerEntity(
|
|||||||
self._client_id = client_id
|
self._client_id = client_id
|
||||||
self._attr_name = display_name
|
self._attr_name = display_name
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type of the device."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
def _do_update(self) -> None:
|
def _do_update(self) -> None:
|
||||||
self._client_details = self.coordinator.data.get(self._client_id)
|
self._client_details = self.coordinator.data.get(self._client_id)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from aiovodafone import VodafoneStationDevice
|
from aiovodafone import VodafoneStationDevice
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -91,11 +91,6 @@ class VodafoneStationTracker(CoordinatorEntity[VodafoneStationRouter], ScannerEn
|
|||||||
"""Return true if the device is connected to the network."""
|
"""Return true if the device is connected to the network."""
|
||||||
return self._device_info.home
|
return self._device_info.home
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hostname(self) -> str | None:
|
def hostname(self) -> str | None:
|
||||||
"""Return the hostname of device."""
|
"""Return the hostname of device."""
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import ScannerEntity, SourceType
|
from homeassistant.components.device_tracker import ScannerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -53,11 +53,6 @@ class ZHADeviceScannerEntity(ScannerEntity, ZHAEntity):
|
|||||||
"""Return true if the device is connected to the network."""
|
"""Return true if the device is connected to the network."""
|
||||||
return self.entity_data.entity.is_connected
|
return self.entity_data.entity.is_connected
|
||||||
|
|
||||||
@property
|
|
||||||
def source_type(self) -> SourceType:
|
|
||||||
"""Return the source type, eg gps or router, of the device."""
|
|
||||||
return SourceType.ROUTER
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def battery_level(self) -> int | None:
|
def battery_level(self) -> int | None:
|
||||||
"""Return the battery level of the device.
|
"""Return the battery level of the device.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user