Skip to content

Commit

Permalink
Add VIN to device, attach sensors to device
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed May 10, 2020
1 parent c5989a3 commit e84e3d4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions custom_components/bmw_connected_drive/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def device_info(self) -> dict:
"""Return info for device registry."""
return {
"identifiers": {(BMW_DOMAIN, self._vehicle.vin)},
"sw_version": self._vehicle.vin,
"name": f'{self._vehicle.attributes.get("brand")} {self._vehicle.name}',
"model": self._vehicle.name,
"manufacturer": self._vehicle.attributes.get("brand"),
Expand Down
1 change: 1 addition & 0 deletions custom_components/bmw_connected_drive/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def device_info(self) -> dict:
"""Return info for device registry."""
return {
"identifiers": {(BMW_DOMAIN, self._vehicle.vin)},
"sw_version": self._vehicle.vin,
"name": f'{self._vehicle.attributes.get("brand")} {self._vehicle.name}',
"model": self._vehicle.name,
"manufacturer": self._vehicle.attributes.get("brand"),
Expand Down
1 change: 1 addition & 0 deletions custom_components/bmw_connected_drive/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def device_info(self) -> dict:
"""Return info for device registry."""
return {
"identifiers": {(BMW_DOMAIN, self._vehicle.vin)},
"sw_version": self._vehicle.vin,
"name": f'{self._vehicle.attributes.get("brand")} {self._vehicle.name}',
"model": self._vehicle.name,
"manufacturer": self._vehicle.attributes.get("brand"),
Expand Down
11 changes: 11 additions & 0 deletions custom_components/bmw_connected_drive/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ def __init__(self, account, vehicle, attribute: str, attribute_info):
self._unique_id = f"{self._vehicle.vin}-{self._attribute}"
self._attribute_info = attribute_info

@property
def device_info(self) -> dict:
"""Return info for device registry."""
return {
"identifiers": {(BMW_DOMAIN, self._vehicle.vin)},
"sw_version": self._vehicle.vin,
"name": f'{self._vehicle.attributes.get("brand")} {self._vehicle.name}',
"model": self._vehicle.name,
"manufacturer": self._vehicle.attributes.get("brand"),
}

@property
def should_poll(self) -> bool:
"""Return False.
Expand Down

0 comments on commit e84e3d4

Please sign in to comment.