Add unique_id for Daikin entities (#18747)

pull/18748/head
Fredrik Erlandsson 2018-11-27 15:36:55 +01:00 committed by Paulus Schoutsen
parent eb2e2a116e
commit 5d5c78b374
3 changed files with 15 additions and 0 deletions

View File

@ -192,6 +192,11 @@ class DaikinClimate(ClimateDevice):
"""Return the name of the thermostat, if any."""
return self._api.name
@property
def unique_id(self):
"""Return a unique ID."""
return self._api.mac
@property
def temperature_unit(self):
"""Return the unit of measurement which this thermostat uses."""

View File

@ -132,3 +132,8 @@ class DaikinApi:
_LOGGER.warning(
"Connection failed for %s", self.ip_address
)
@property
def mac(self):
"""Return mac-address of device."""
return self.device.values.get('mac')

View File

@ -71,6 +71,11 @@ class DaikinClimateSensor(Entity):
if self._sensor[CONF_TYPE] == SENSOR_TYPE_TEMPERATURE:
self._unit_of_measurement = units.temperature_unit
@property
def unique_id(self):
"""Return a unique ID."""
return "{}-{}".format(self._api.mac, self._device_attribute)
def get(self, key):
"""Retrieve device settings from API library cache."""
value = None