From: Daniel Rheinbay Date: Sun, 6 Dec 2020 13:21:19 +0000 (+0100) Subject: Add unique IDs X-Git-Tag: v0.5~2^2 X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=2521cff7277889cd294d15717e10b8532d5631fb;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 a6fbece..6c43872 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."""