Skip to content

Commit

Permalink
Remove redundant source_type property from ScannerEntities (#126716)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Sep 25, 2024
1 parent a3c2a7e commit b48c439
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 78 deletions.
7 changes: 1 addition & 6 deletions homeassistant/components/asuswrt/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -71,11 +71,6 @@ def is_connected(self) -> bool:
"""Return true if the device is connected to the network."""
return self._device.is_connected

@property
def source_type(self) -> SourceType:
"""Return the source type."""
return SourceType.ROUTER

@property
def hostname(self) -> str | None:
"""Return the hostname of device."""
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/freebox/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import datetime
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.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -98,11 +98,6 @@ def is_connected(self) -> bool:
"""Return true if the device is connected to the network."""
return self._active

@property
def source_type(self) -> SourceType:
"""Return the source type."""
return SourceType.ROUTER

@callback
def async_on_demand_update(self) -> None:
"""Update state."""
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/fritz/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import datetime
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.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -112,8 +112,3 @@ def extra_state_attributes(self) -> dict[str, str]:
if device.ssid:
attrs["ssid"] = device.ssid
return attrs

@property
def source_type(self) -> SourceType:
"""Return tracker source type."""
return SourceType.ROUTER
6 changes: 0 additions & 6 deletions homeassistant/components/huawei_lte/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from homeassistant.components.device_tracker import (
DOMAIN as DEVICE_TRACKER_DOMAIN,
ScannerEntity,
SourceType,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -195,11 +194,6 @@ def name(self) -> str:
def _device_unique_id(self) -> str:
return self.mac_address

@property
def source_type(self) -> SourceType:
"""Return SourceType.ROUTER."""
return SourceType.ROUTER

@property
def ip_address(self) -> str | None:
"""Return the primary ip address of the device."""
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/keenetic_ndms2/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from homeassistant.components.device_tracker import (
DOMAIN as DEVICE_TRACKER_DOMAIN,
ScannerEntity,
SourceType,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -103,11 +102,6 @@ def is_connected(self) -> bool:
< self._router.consider_home_interval
)

@property
def source_type(self) -> SourceType:
"""Return the source type of the client."""
return SourceType.ROUTER

@property
def name(self) -> str:
"""Return the name of the device."""
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/mikrotik/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from homeassistant.components.device_tracker import (
DOMAIN as DEVICE_TRACKER,
ScannerEntity,
SourceType,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
Expand Down Expand Up @@ -94,11 +93,6 @@ def is_connected(self) -> bool:
return True
return False

@property
def source_type(self) -> SourceType:
"""Return the source type of the client."""
return SourceType.ROUTER

@property
def hostname(self) -> str:
"""Return the hostname of the client."""
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/netgear/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -81,11 +81,6 @@ def is_connected(self) -> bool:
"""Return true if the device is connected to the router."""
return self._active

@property
def source_type(self) -> SourceType:
"""Return the source type."""
return SourceType.ROUTER

@property
def ip_address(self) -> str:
"""Return the IP address."""
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/nmap_tracker/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
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.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -95,11 +95,6 @@ def hostname(self) -> str | None:
return None
return short_hostname(self._device.hostname)

@property
def source_type(self) -> SourceType:
"""Return tracker source type."""
return SourceType.ROUTER

@callback
def async_process_update(self, online: bool) -> None:
"""Update device."""
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/ping/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
CONF_CONSIDER_HOME,
DEFAULT_CONSIDER_HOME,
ScannerEntity,
SourceType,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -57,11 +56,6 @@ def unique_id(self) -> str:
"""Return a unique ID."""
return self.config_entry.entry_id

@property
def source_type(self) -> SourceType:
"""Return the source type which is router."""
return SourceType.ROUTER

@property
def is_connected(self) -> bool:
"""Return true if ping returns is_alive or considered home."""
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/ruckus_unleashed/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
Expand Down Expand Up @@ -121,8 +121,3 @@ def ip_address(self) -> str | None:
def is_connected(self) -> bool:
"""Return true if the device is connected to the network."""
return self._mac in self.coordinator.data[KEY_SYS_CLIENTS]

@property
def source_type(self) -> SourceType:
"""Return the source type."""
return SourceType.ROUTER
7 changes: 1 addition & 6 deletions homeassistant/components/tplink_omada/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -61,11 +61,6 @@ def __init__(
self._client_id = client_id
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:
self._client_details = self.coordinator.data.get(self._client_id)

Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/vodafone_station/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -91,11 +91,6 @@ def is_connected(self) -> bool:
"""Return true if the device is connected to the network."""
return self._device_info.home

@property
def source_type(self) -> SourceType:
"""Return the source type."""
return SourceType.ROUTER

@property
def hostname(self) -> str | None:
"""Return the hostname of device."""
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/zha/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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.const import Platform
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -53,11 +53,6 @@ def is_connected(self) -> bool:
"""Return true if the device is connected to the network."""
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
def battery_level(self) -> int | None:
"""Return the battery level of the device.
Expand Down

0 comments on commit b48c439

Please sign in to comment.