Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unique_id for Daikin entities #18747

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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