From efafe827994857500eddb2c1dd471c7ba8b0383f Mon Sep 17 00:00:00 2001 From: Fuzzy Date: Tue, 7 Sep 2021 23:01:58 -0400 Subject: [PATCH] Remove Trackr integration (API removed) (#55917) * Delete Trackr component directory * Update .coverage.rc to remove Trackr * Update requirements_all.txt --- .coveragerc | 1 - homeassistant/components/trackr/__init__.py | 1 - .../components/trackr/device_tracker.py | 73 ------------------- homeassistant/components/trackr/manifest.json | 8 -- requirements_all.txt | 3 - 5 files changed, 86 deletions(-) delete mode 100644 homeassistant/components/trackr/__init__.py delete mode 100644 homeassistant/components/trackr/device_tracker.py delete mode 100644 homeassistant/components/trackr/manifest.json diff --git a/.coveragerc b/.coveragerc index bc6486283c4..684322359b5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1095,7 +1095,6 @@ omit = homeassistant/components/tplink_lte/* homeassistant/components/traccar/device_tracker.py homeassistant/components/traccar/const.py - homeassistant/components/trackr/device_tracker.py homeassistant/components/tractive/__init__.py homeassistant/components/tractive/device_tracker.py homeassistant/components/tractive/entity.py diff --git a/homeassistant/components/trackr/__init__.py b/homeassistant/components/trackr/__init__.py deleted file mode 100644 index b78eb8078a2..00000000000 --- a/homeassistant/components/trackr/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The trackr component.""" diff --git a/homeassistant/components/trackr/device_tracker.py b/homeassistant/components/trackr/device_tracker.py deleted file mode 100644 index c08a990ea16..00000000000 --- a/homeassistant/components/trackr/device_tracker.py +++ /dev/null @@ -1,73 +0,0 @@ -"""Support for the TrackR platform.""" -import logging - -from pytrackr.api import trackrApiInterface -import voluptuous as vol - -from homeassistant.components.device_tracker import ( - PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA, -) -from homeassistant.const import CONF_PASSWORD, CONF_USERNAME -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.event import track_utc_time_change -from homeassistant.util import slugify - -_LOGGER = logging.getLogger(__name__) - -PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend( - {vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string} -) - - -def setup_scanner(hass, config: dict, see, discovery_info=None): - """Validate the configuration and return a TrackR scanner.""" - TrackRDeviceScanner(hass, config, see) - return True - - -class TrackRDeviceScanner: - """A class representing a TrackR device.""" - - def __init__(self, hass, config: dict, see) -> None: - """Initialize the TrackR device scanner.""" - - self.hass = hass - self.api = trackrApiInterface( - config.get(CONF_USERNAME), config.get(CONF_PASSWORD) - ) - self.see = see - self.devices = self.api.get_trackrs() - self._update_info() - - track_utc_time_change(self.hass, self._update_info, second=range(0, 60, 30)) - - def _update_info(self, now=None) -> None: - """Update the device info.""" - _LOGGER.debug("Updating devices %s", now) - - # Update self.devices to collect new devices added - # to the users account. - self.devices = self.api.get_trackrs() - - for trackr in self.devices: - trackr.update_state() - trackr_id = trackr.tracker_id() - trackr_device_id = trackr.id() - lost = trackr.lost() - dev_id = slugify(trackr.name()) - if dev_id is None: - dev_id = trackr_id - location = trackr.last_known_location() - lat = location["latitude"] - lon = location["longitude"] - - attrs = { - "last_updated": trackr.last_updated(), - "last_seen": trackr.last_time_seen(), - "trackr_id": trackr_id, - "id": trackr_device_id, - "lost": lost, - "battery_level": trackr.battery_level(), - } - - self.see(dev_id=dev_id, gps=(lat, lon), attributes=attrs) diff --git a/homeassistant/components/trackr/manifest.json b/homeassistant/components/trackr/manifest.json deleted file mode 100644 index 04a629d49c6..00000000000 --- a/homeassistant/components/trackr/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "domain": "trackr", - "name": "TrackR", - "documentation": "https://www.home-assistant.io/integrations/trackr", - "requirements": ["pytrackr==0.0.5"], - "codeowners": [], - "iot_class": "cloud_polling" -} diff --git a/requirements_all.txt b/requirements_all.txt index d6b076cd778..bbbbe45b0d2 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1954,9 +1954,6 @@ pytouchline==0.7 # homeassistant.components.traccar pytraccar==0.9.0 -# homeassistant.components.trackr -pytrackr==0.0.5 - # homeassistant.components.tradfri pytradfri[async]==7.0.6