mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add unique_id for BMW ConnectedDrive (#13888)
* Add unique_id for BMW ConnectedDrive * Changed some comments
This commit is contained in:
parent
1c4da0c4a6
commit
9014e26845
@ -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."""
|
||||
|
@ -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."""
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user