Skip to content

Commit

Permalink
Add unique_id for Daikin entities (#18747)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrike authored and balloob committed Nov 27, 2018
1 parent eb2e2a1 commit 5d5c78b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions homeassistant/components/climate/daikin.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ def name(self):
"""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."""
Expand Down
5 changes: 5 additions & 0 deletions homeassistant/components/daikin.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,8 @@ def update(self, **kwargs):
_LOGGER.warning(
"Connection failed for %s", self.ip_address
)

@property
def mac(self):
"""Return mac-address of device."""
return self.device.values.get('mac')
5 changes: 5 additions & 0 deletions homeassistant/components/sensor/daikin.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def __init__(self, api, monitored_state, units: UnitSystem,
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
Expand Down

0 comments on commit 5d5c78b

Please sign in to comment.