Fix small mistakes

This commit is contained in:
2021-04-11 17:00:33 +02:00
parent 8a44d22d41
commit 5e83ed1c68
6 changed files with 13 additions and 10 deletions

View File

@@ -120,8 +120,6 @@ async def async_unload_entry(hass, entry):
context = hass.data[DOMAIN]["context"]
context.socket.disconnect()
hass.data[DOMAIN]["unsub"]()
return True

View File

@@ -71,7 +71,7 @@ class GeoRideStolenBinarySensorEntity(GeoRideBinarySensorEntity):
@property
def is_on(self):
"""state value property"""
return self._tracker_device.is_stolen
return self._tracker_device.tracker.is_stolen
@property
def name(self):
@@ -120,7 +120,7 @@ class GeoRideActiveSubscriptionBinarySensorEntity(GeoRideBinarySensorEntity):
@property
def is_on(self):
"""state value property"""
if self._tracker.subscription_id is not None:
if self._tracker_device.tracker.subscription_id is not None:
return True
return False

View File

@@ -10,10 +10,15 @@ class Device:
"""Initialize GeoRideTracker device."""
self._tracker: GeoRideTracker = tracker
@property
def tracker(self):
"""return the tracker"""
return self._tracker
@property
def name(self) -> str:
"""Get the name."""
return self._tracker.name
return self._tracker.tracker_name
@property
def manufacturer(self) -> str:

View File

@@ -50,7 +50,7 @@ class GeoRideTrackerEntity(CoordinatorEntity, TrackerEntity):
@property
def unique_id(self):
"""Return the unique ID."""
return f"georide_tracker_{self._tracker.tracker_id}"
return f"georide_tracker_{self._tracker_device.tracker.tracker_id}"
@property
def name(self):

View File

@@ -53,7 +53,7 @@ class GeoRideOdometerSensorEntity(CoordinatorEntity, SensorEntity):
@property
def unique_id(self):
"""Return the unique ID."""
return self._tracker_device.tracker.tracker_id
return f"odometer_{self._tracker_device.tracker.tracker_id}"
@property
def state(self):
@@ -78,4 +78,4 @@ class GeoRideOdometerSensorEntity(CoordinatorEntity, SensorEntity):
@property
def device_info(self):
"""Return the device info."""
return self._tracker_device.device_info()
return self._tracker_device.device_info

View File

@@ -82,7 +82,7 @@ class GeoRideLockSwitchEntity(CoordinatorEntity, SwitchEntity):
@property
def unique_id(self):
"""Return the unique ID."""
return self._tracker.tracker_id
return f"lock_{self._tracker_device.tracker_id}"
@property
def name(self):
@@ -104,4 +104,4 @@ class GeoRideLockSwitchEntity(CoordinatorEntity, SwitchEntity):
@property
def device_info(self):
"""Return the device info."""
return self._tracker_device.device_info()
return self._tracker_device.device_info