diff --git a/homeassistant/components/binary_sensor/bmw_connected_drive.py b/homeassistant/components/binary_sensor/bmw_connected_drive.py index e7af5af988b..0abf6eb1064 100644 --- a/homeassistant/components/binary_sensor/bmw_connected_drive.py +++ b/homeassistant/components/binary_sensor/bmw_connected_drive.py @@ -46,6 +46,7 @@ class BMWConnectedDriveSensor(BinarySensorDevice): self._vehicle = vehicle self._attribute = attribute self._name = '{} {}'.format(self._vehicle.name, self._attribute) + self._unique_id = '{}-{}'.format(self._vehicle.vin, self._attribute) self._sensor_name = sensor_name self._device_class = device_class self._state = None @@ -55,6 +56,11 @@ class BMWConnectedDriveSensor(BinarySensorDevice): """Data update is triggered from BMWConnectedDriveEntity.""" return False + @property + def unique_id(self): + """Return the unique ID of the binary sensor.""" + return self._unique_id + @property def name(self): """Return the name of the binary sensor.""" diff --git a/homeassistant/components/lock/bmw_connected_drive.py b/homeassistant/components/lock/bmw_connected_drive.py index c992bf1225a..52734b1259c 100644 --- a/homeassistant/components/lock/bmw_connected_drive.py +++ b/homeassistant/components/lock/bmw_connected_drive.py @@ -38,6 +38,7 @@ class BMWLock(LockDevice): self._vehicle = vehicle self._attribute = attribute self._name = '{} {}'.format(self._vehicle.name, self._attribute) + self._unique_id = '{}-{}'.format(self._vehicle.vin, self._attribute) self._sensor_name = sensor_name self._state = None @@ -49,6 +50,11 @@ class BMWLock(LockDevice): """ return False + @property + def unique_id(self): + """Return the unique ID of the lock.""" + return self._unique_id + @property def name(self): """Return the name of the lock.""" diff --git a/homeassistant/components/sensor/bmw_connected_drive.py b/homeassistant/components/sensor/bmw_connected_drive.py index bd582da1ef4..ed75520c179 100644 --- a/homeassistant/components/sensor/bmw_connected_drive.py +++ b/homeassistant/components/sensor/bmw_connected_drive.py @@ -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 }