Add suport for new device beacon, siren control, eco_mode control, better device event
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""Home Assistant representation of an GeoRide Tracker device."""
|
||||
import georideapilib.objects as GeoRideTracker
|
||||
import georideapilib.objects as GeoRideTracker, GeoRideTrackerBeacon
|
||||
from .const import DOMAIN as GEORIDE_DOMAIN
|
||||
|
||||
|
||||
@@ -28,11 +28,15 @@ class Device:
|
||||
@property
|
||||
def model_name(self) -> str:
|
||||
"""Get the model name."""
|
||||
name = "GeoRide 1"
|
||||
if self._tracker.is_old_tracker:
|
||||
name = "Prototype / GeoRide 1"
|
||||
elif self._tracker.is_second_gen:
|
||||
name = "GeoRide 2 / GeoRide 3"
|
||||
name = None
|
||||
if self._tracker.version == 1:
|
||||
name = "GeoRide 1"
|
||||
elif self._tracker.version == 2:
|
||||
name = "GeoRide 2"
|
||||
elif self._tracker.version == 3:
|
||||
name = "GeoRide 3"
|
||||
else:
|
||||
name = "Prototype / Unknown"
|
||||
return name
|
||||
|
||||
@property
|
||||
@@ -54,4 +58,53 @@ class Device:
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Get string representation."""
|
||||
return f"GeoRide Device: {self.name}::{self.model_name}::self.unique_id"
|
||||
return f"GeoRide Device: {self.name}::{self.model_name}::{self.unique_id}"
|
||||
|
||||
class DeviceBeacon:
|
||||
"""Home Assistant representation of a GeoRide Tracker device."""
|
||||
|
||||
def __init__(self, beacon):
|
||||
"""Initialize GeoRideTracker device."""
|
||||
self._beacon: GeoRideTrackerBeacon = beacon
|
||||
|
||||
@property
|
||||
def beacon(self):
|
||||
"""return the tracker beacon"""
|
||||
return self._beacon
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Get the name."""
|
||||
return self._beacon.name
|
||||
|
||||
@property
|
||||
def manufacturer(self) -> str:
|
||||
"""Get the manufacturer."""
|
||||
return "GeoRide"
|
||||
|
||||
@property
|
||||
def model_name(self) -> str:
|
||||
"""Get the model name."""
|
||||
name = "GeoRide Beacon"
|
||||
return name
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Return the device info."""
|
||||
return {
|
||||
"name": self.name,
|
||||
"identifiers": {(GEORIDE_DOMAIN, self._beacon.beacon_id)},
|
||||
"manufacturer": "GeoRide",
|
||||
"model": self.model_name,
|
||||
"suggested_area": "Garage"
|
||||
}
|
||||
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Get the unique id."""
|
||||
return {(GEORIDE_DOMAIN, "beacon", self._beacon.beacon_id)}
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Get string representation."""
|
||||
return f"GeoRide Device: {self.name}::{self.model_name}::{self.unique_id}"
|
||||
Reference in New Issue
Block a user