From b0b967debd86a9d055bacfe39d358b33a4769e3f Mon Sep 17 00:00:00 2001 From: Daniel Rheinbay Date: Sun, 6 Dec 2020 14:21:19 +0100 Subject: [PATCH] Add unique IDs Add unique IDs for sensors. This allows users to rename the sensors and add icons all from within Home Assistant GUI. --- custom_components/mercedesmeapi/resources.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/custom_components/mercedesmeapi/resources.py b/custom_components/mercedesmeapi/resources.py index 8a7b629..234991d 100644 --- a/custom_components/mercedesmeapi/resources.py +++ b/custom_components/mercedesmeapi/resources.py @@ -63,6 +63,11 @@ class MercedesMeResource (Entity): self._lastupdate = datetime.fromtimestamp(self._timestamp/1000) self._valid = True + @property + def unique_id(self): + """Return the unique id of the sensor.""" + return f"{self._vin}-{self._name}" + @property def name(self): """Return the name of the sensor.""" -- 2.47.3