|
|
|
|
@@ -31,6 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # pylint: d
|
|
|
|
|
hass.data[GEORIDE_DOMAIN]["devices"][tracker_device.tracker.tracker_id] = coordinator
|
|
|
|
|
entities.append(GeoRideOdometerSensorEntity(coordinator, tracker_device, hass))
|
|
|
|
|
entities.append(GeoRideOdometerKmSensorEntity(coordinator, tracker_device, hass))
|
|
|
|
|
entities.append(GeoRideSpeedSensorEntity(coordinator, tracker_device,hass))
|
|
|
|
|
entities.append(GeoRideFixtimeSensorEntity(coordinator, tracker_device))
|
|
|
|
|
if tracker_device.tracker.version > 2:
|
|
|
|
|
entities.append(GeoRideInternalBatterySensorEntity(coordinator, tracker_device))
|
|
|
|
|
@@ -155,6 +156,7 @@ class GeoRideSpeedSensorEntity(CoordinatorEntity, SensorEntity):
|
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('speed')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
|
self._state = 0
|
|
|
|
|
self._hass = hass
|
|
|
|
|
self._state_class = "measurement"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def unique_id(self):
|
|
|
|
|
@@ -166,6 +168,10 @@ class GeoRideSpeedSensorEntity(CoordinatorEntity, SensorEntity):
|
|
|
|
|
"""state property"""
|
|
|
|
|
return self._tracker_device.tracker.speed
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def state_class(self):
|
|
|
|
|
return self._state_class
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def unit_of_measurement(self):
|
|
|
|
|
"""unit of mesurment property"""
|
|
|
|
|
@@ -198,8 +204,17 @@ class GeoRideInternalBatterySensorEntity(CoordinatorEntity, SensorEntity):
|
|
|
|
|
self._name = tracker_device.tracker.tracker_name
|
|
|
|
|
self._unit_of_measurement = "V"
|
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('internal_battery_voltage')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
|
|
|
|
|
|
self._state = 0
|
|
|
|
|
self._state_class = "measurement"
|
|
|
|
|
self._device_class = "voltage"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def state_class(self):
|
|
|
|
|
return self._state_class
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def device_class(self):
|
|
|
|
|
return self._device_class
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def entity_category(self):
|
|
|
|
|
@@ -247,6 +262,16 @@ class GeoRideExternalBatterySensorEntity(CoordinatorEntity, SensorEntity):
|
|
|
|
|
self._unit_of_measurement = "V"
|
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('external_battery_voltage')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
|
self._state = 0
|
|
|
|
|
self._state_class = "measurement"
|
|
|
|
|
self._device_class = "voltage"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def state_class(self):
|
|
|
|
|
return self._state_class
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def device_class(self):
|
|
|
|
|
return self._device_class
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def entity_category(self):
|
|
|
|
|
@@ -292,7 +317,6 @@ class GeoRideFixtimeSensorEntity(CoordinatorEntity, SensorEntity):
|
|
|
|
|
self._tracker_device = tracker_device
|
|
|
|
|
self._name = tracker_device.tracker.tracker_name
|
|
|
|
|
self.entity_id = f"{ENTITY_ID_FORMAT.format('fixtime')}.{tracker_device.tracker.tracker_id}"# pylint: disable=C0301
|
|
|
|
|
|
|
|
|
|
self._state = 0
|
|
|
|
|
self._device_class = "timestamp"
|
|
|
|
|
|
|
|
|
|
|