From: Daniel Rheinbay Date: Sun, 6 Dec 2020 13:21:19 +0000 (+0100) Subject: Add unique IDs X-Git-Tag: v0.7~10 X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=b0b967debd86a9d055bacfe39d358b33a4769e3f;p=mercedes_me_api.git Add unique IDs Add unique IDs for sensors. This allows users to rename the sensors and add icons all from within Home Assistant GUI. --- 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."""