Add unique_id for BMW ConnectedDrive (#13888)

* Add unique_id for BMW ConnectedDrive

* Changed some comments
This commit is contained in:
Gerard authored and Martin Hjelmare committed 2018-04-15 05:15:52 +02:00
1 parent 1c4da0c4a6
commit 9014e26845
3 files changed
+19 -1

No files matched your search

@@ -52,6 +52,7 @@ class BMWConnectedDriveSensor(Entity):
self._state = None
self._unit_of_measurement = None
self._name = '{} {}'.format(self._vehicle.name, self._attribute)
self._unique_id = '{}-{}'.format(self._vehicle.vin, self._attribute)
self._sensor_name = sensor_name
self._icon = icon
@@ -60,6 +61,11 @@ class BMWConnectedDriveSensor(Entity):
"""Data update is triggered from BMWConnectedDriveEntity."""
return False
@property
def unique_id(self):
"""Return the unique ID of the sensor."""
return self._unique_id
@property
def name(self) -> str:
"""Return the name of the sensor."""
@@ -86,7 +92,7 @@ class BMWConnectedDriveSensor(Entity):
@property
def device_state_attributes(self):
"""Return the state attributes of the binary sensor."""
"""Return the state attributes of the sensor."""
return {
'car': self._vehicle.name
}