Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions homeassistant/components/asuswrt/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for ASUSWRT routers."""
from __future__ import annotations

from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER
from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -69,9 +69,9 @@ def is_connected(self) -> bool:
return self._device.is_connected

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

@property
def hostname(self) -> str | None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from homeassistant.components.device_tracker.const import (
CONF_TRACK_NEW,
SCAN_INTERVAL,
SOURCE_TYPE_BLUETOOTH_LE,
SourceType,
)
from homeassistant.components.device_tracker.legacy import (
YAML_DEVICES,
Expand Down Expand Up @@ -106,7 +106,7 @@ async def async_see_device(address, name, new_device=False, battery=None):
await async_see(
mac=BLE_PREFIX + address,
host_name=name,
source_type=SOURCE_TYPE_BLUETOOTH_LE,
source_type=SourceType.BLUETOOTH_LE,
battery=battery,
)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/bluetooth_tracker/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
CONF_TRACK_NEW,
DEFAULT_TRACK_NEW,
SCAN_INTERVAL,
SOURCE_TYPE_BLUETOOTH,
SourceType,
)
from homeassistant.components.device_tracker.legacy import (
YAML_DEVICES,
Expand Down Expand Up @@ -93,7 +93,7 @@ async def see_device(
mac=f"{BT_PREFIX}{mac}",
host_name=device_name,
attributes=attributes,
source_type=SOURCE_TYPE_BLUETOOTH,
source_type=SourceType.BLUETOOTH,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
from __future__ import annotations

import logging
from typing import Literal

from bimmer_connected.vehicle import MyBMWVehicle

from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -80,6 +79,6 @@ def longitude(self) -> float | None:
)

@property
def source_type(self) -> Literal["gps"]:
def source_type(self) -> SourceType:
"""Return the source type, eg gps or router, of the device."""
return SOURCE_TYPE_GPS
return SourceType.GPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from homeassistant.components.device_tracker import (
DOMAIN as DEVICE_TRACKER_DOMAIN,
SOURCE_TYPE_ROUTER,
SourceType,
)
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -149,9 +149,9 @@ def mac_address(self) -> str:
return self._mac

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

@property
def unique_id(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/dhcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ATTR_SOURCE_TYPE,
CONNECTED_DEVICE_REGISTERED,
DOMAIN as DEVICE_TRACKER_DOMAIN,
SOURCE_TYPE_ROUTER,
SourceType,
)
from homeassistant.const import (
EVENT_HOMEASSISTANT_STARTED,
Expand Down Expand Up @@ -318,7 +318,7 @@ def _async_process_device_state(self, state: State) -> None:

attributes = state.attributes

if attributes.get(ATTR_SOURCE_TYPE) != SOURCE_TYPE_ROUTER:
if attributes.get(ATTR_SOURCE_TYPE) != SourceType.ROUTER:
return

ip_address = attributes.get(ATTR_IP)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/freebox/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime
from typing import Any

from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER
from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -98,9 +98,9 @@ def is_connected(self):
return self._active

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

@property
def icon(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/fritz/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import datetime
import logging

from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER
from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -118,6 +118,6 @@ def extra_state_attributes(self) -> dict[str, str]:
return attrs

@property
def source_type(self) -> str:
def source_type(self) -> SourceType:
"""Return tracker source type."""
return SOURCE_TYPE_ROUTER
return SourceType.ROUTER
6 changes: 3 additions & 3 deletions homeassistant/components/geofency/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Support for the Geofency device tracker platform."""
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
Expand Down Expand Up @@ -96,9 +96,9 @@ def device_info(self) -> DeviceInfo:
return DeviceInfo(identifiers={(GF_DOMAIN, self._unique_id)}, name=self._name)

@property
def source_type(self):
def source_type(self) -> SourceType:
"""Return the source type, eg gps or router, of the device."""
return SOURCE_TYPE_GPS
return SourceType.GPS

async def async_added_to_hass(self):
"""Register state update callback."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/google_maps/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from homeassistant.components.device_tracker import (
PLATFORM_SCHEMA as PLATFORM_SCHEMA_BASE,
SOURCE_TYPE_GPS,
SeeCallback,
SourceType,
)
from homeassistant.const import (
ATTR_BATTERY_CHARGING,
Expand Down Expand Up @@ -129,7 +129,7 @@ def _update_info(self, now=None):
dev_id=dev_id,
gps=(person.latitude, person.longitude),
picture=person.picture_url,
source_type=SOURCE_TYPE_GPS,
source_type=SourceType.GPS,
gps_accuracy=person.accuracy,
attributes=attrs,
)
6 changes: 3 additions & 3 deletions homeassistant/components/gpslogger/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Support for the GPSLogger device tracking."""
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
Expand Down Expand Up @@ -118,9 +118,9 @@ def device_info(self) -> DeviceInfo:
return DeviceInfo(identifiers={(GPL_DOMAIN, self._unique_id)}, name=self._name)

@property
def source_type(self):
def source_type(self) -> SourceType:
"""Return the source type, eg gps or router, of the device."""
return SOURCE_TYPE_GPS
return SourceType.GPS

async def async_added_to_hass(self):
"""Register state update callback."""
Expand Down