|
|
@ -5,6 +5,7 @@ import logging
|
|
|
|
from typing import Any, Mapping
|
|
|
|
from typing import Any, Mapping
|
|
|
|
|
|
|
|
|
|
|
|
from homeassistant.core import callback
|
|
|
|
from homeassistant.core import callback
|
|
|
|
|
|
|
|
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
|
|
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
|
|
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
|
|
|
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT
|
|
|
|
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT
|
|
|
|
from homeassistant.helpers.update_coordinator import (
|
|
|
|
from homeassistant.helpers.update_coordinator import (
|
|
|
@ -76,6 +77,10 @@ class GeoRideBeaconBinarySensorEntity(CoordinatorEntity, BinarySensorEntity):
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('binary_sensor')}.{tracker_device.beacon.beacon_id}"# pylint: disable=C0301
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('binary_sensor')}.{tracker_device.beacon.beacon_id}"# pylint: disable=C0301
|
|
|
|
self._is_on = False
|
|
|
|
self._is_on = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def entity_category(self):
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def device_info(self):
|
|
|
|
def device_info(self):
|
|
|
|
"""Return the device info."""
|
|
|
|
"""Return the device info."""
|
|
|
@ -148,6 +153,10 @@ class GeoRideActiveSubscriptionBinarySensorEntity(GeoRideBinarySensorEntity):
|
|
|
|
super().__init__(coordinator, tracker_device)
|
|
|
|
super().__init__(coordinator, tracker_device)
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('is_active_subscription_')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('is_active_subscription_')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def entity_category(self):
|
|
|
|
|
|
|
|
return EntityCategory.DIAGNOSTIC
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def unique_id(self):
|
|
|
|
def unique_id(self):
|
|
|
|
"""Return the unique ID."""
|
|
|
|
"""Return the unique ID."""
|
|
|
@ -206,6 +215,10 @@ class GeoRideNetworkBinarySensorEntity(GeoRideBinarySensorEntity):
|
|
|
|
super().__init__(coordinator, tracker_device)
|
|
|
|
super().__init__(coordinator, tracker_device)
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('have_network')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('have_network')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def entity_category(self):
|
|
|
|
|
|
|
|
return EntityCategory.DIAGNOSTIC
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def unique_id(self):
|
|
|
|
def unique_id(self):
|
|
|
|
"""Return the unique ID."""
|
|
|
|
"""Return the unique ID."""
|
|
|
@ -259,6 +272,9 @@ class GeoRideMovingBinarySensorEntity(GeoRideBinarySensorEntity):
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideBeaconUpdatedBinarySensorEntity(GeoRideBeaconBinarySensorEntity):
|
|
|
|
class GeoRideBeaconUpdatedBinarySensorEntity(GeoRideBeaconBinarySensorEntity):
|
|
|
|
"""Represent a tracked device."""
|
|
|
|
"""Represent a tracked device."""
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def entity_category(self):
|
|
|
|
|
|
|
|
return EntityCategory.DIAGNOSTIC
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, coordinator: DataUpdateCoordinator[Mapping[str, Any]],
|
|
|
|
def __init__(self, coordinator: DataUpdateCoordinator[Mapping[str, Any]],
|
|
|
|
tracker_beacon_device: DeviceBeacon):
|
|
|
|
tracker_beacon_device: DeviceBeacon):
|
|
|
|