Add unique id to ADS platforms (#20511)

* Add friendly_name option

* Correct hound findings

* correct hound findings 2

* add unique id

* add unique id to all ads platforms
This commit is contained in:
carstenschroeder 2019-02-12 18:42:09 +01:00 committed by Martin Hjelmare
parent d89c56829c
commit d1c8d39107
4 changed files with 24 additions and 0 deletions

View file

@ -44,6 +44,7 @@ class AdsBinarySensor(BinarySensorDevice):
def __init__(self, ads_hub, name, ads_var, device_class):
"""Initialize ADS binary sensor."""
self._name = name
self._unique_id = ads_var
self._state = False
self._device_class = device_class or 'moving'
self._ads_hub = ads_hub
@ -66,6 +67,11 @@ class AdsBinarySensor(BinarySensorDevice):
"""Return the default name of the binary sensor."""
return self._name
@property
def unique_id(self):
"""Return an unique identifier for this entity."""
return self._unique_id
@property
def device_class(self):
"""Return the device class."""