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/starline/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""StarLine device tracker."""
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.const import SourceType
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -56,9 +56,9 @@ def longitude(self):
return self._device.position["y"]

@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

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

from homeassistant.components.device_tracker import AsyncSeeCallback
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.const import SourceType
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -122,9 +122,9 @@ def longitude(self) -> float | None:
return self._tile.longitude

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

@callback
def _handle_coordinator_update(self) -> None:
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/traccar/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from homeassistant.components.device_tracker import (
CONF_SCAN_INTERVAL,
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
SOURCE_TYPE_GPS,
AsyncSeeCallback,
SourceType,
)
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -407,9 +407,9 @@ def device_info(self):
return {"name": self._name, "identifiers": {(DOMAIN, self._unique_id)}}

@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
11 changes: 4 additions & 7 deletions homeassistant/components/tractive/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

from typing import Any

from homeassistant.components.device_tracker import (
SOURCE_TYPE_BLUETOOTH,
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, callback
Expand Down Expand Up @@ -56,11 +53,11 @@ def __init__(self, user_id: str, item: Trackables) -> None:
self._attr_unique_id = item.trackable["_id"]

@property
def source_type(self) -> str:
def source_type(self) -> SourceType:
"""Return the source type, eg gps or router, of the device."""
if self._source_type == "PHONE":
return SOURCE_TYPE_BLUETOOTH
return SOURCE_TYPE_GPS
return SourceType.BLUETOOTH
return SourceType.GPS

@property
def latitude(self) -> float:
Expand Down
10 changes: 5 additions & 5 deletions homeassistant/components/unifi/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from homeassistant.components.device_tracker import DOMAIN
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER
from homeassistant.components.device_tracker.const import SourceType
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
Expand Down Expand Up @@ -276,9 +276,9 @@ def is_connected(self):
return self._is_connected

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

@property
def unique_id(self) -> str:
Expand Down Expand Up @@ -406,9 +406,9 @@ def is_connected(self):
return self._is_connected

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

@property
def name(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/volvooncall/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for tracking a Volvo."""
from __future__ import annotations

from homeassistant.components.device_tracker import SOURCE_TYPE_GPS, AsyncSeeCallback
from homeassistant.components.device_tracker import AsyncSeeCallback, SourceType
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
Expand Down Expand Up @@ -31,7 +31,7 @@ async def see_vehicle() -> None:
await async_see(
dev_id=dev_id,
host_name=host_name,
source_type=SOURCE_TYPE_GPS,
source_type=SourceType.GPS,
gps=instrument.state,
icon="mdi:car",
)
Expand Down
6 changes: 3 additions & 3 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
import time

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.const import Platform
Expand Down Expand Up @@ -85,9 +85,9 @@ def is_connected(self):
return self._connected

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

@callback
def async_battery_percentage_remaining_updated(self, attr_id, attr_name, value):
Expand Down