Skip to content

Commit

Permalink
change entity_id with polestar_unique_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuen Lee committed Nov 18, 2023
1 parent c1d7d40 commit b43908f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ def __init__(self,
"""Initialize the sensor."""
super().__init__(device)
self._device = device
# get the first 8 character of the id
unique_id = device.vin[:8]
# get the last 4 character of the id
unique_id = device.vin[-4:]
self.entity_id = f"{POLESTAR_API_DOMAIN}.'polestar_'.{unique_id}_{description.key}"
self._attr_name = f"{description.name}"
self._attr_unique_id = f"{unique_id}-{description.key}"
self._attr_unique_id = f"polestar_{unique_id}-{description.key}"
self.value = None
self.description = description

Expand Down

0 comments on commit b43908f

Please sign in to comment.