Add unique_id for Daikin entities (#18747)
parent
eb2e2a116e
commit
5d5c78b374
|
@ -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."""
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue