mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 05:05:09 +02:00
Add entity registry support to ecobee integration (#27088)
* Add unique id to platforms Add unique id for binary sensor, climate, and sensor. * Add unique id to weather platform * Simplify unique_id for weather platform * Fix lint for unique_id in sensor * Fix lint for unique_id in binary sensor
This commit is contained in:
committed by
Paulus Schoutsen
parent
e033c46c91
commit
ee45431d0e
@@ -43,6 +43,15 @@ class EcobeeBinarySensor(BinarySensorDevice):
|
|||||||
"""Return the name of the Ecobee sensor."""
|
"""Return the name of the Ecobee sensor."""
|
||||||
return self._name.rstrip()
|
return self._name.rstrip()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return a unique identifier for this sensor."""
|
||||||
|
for sensor in self.data.ecobee.get_remote_sensors(self.index):
|
||||||
|
if sensor["name"] == self.sensor_name:
|
||||||
|
if "code" in sensor:
|
||||||
|
return f"{sensor['code']}-{self.device_class}"
|
||||||
|
return f"{sensor['id']}-{self.device_class}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return the status of the sensor."""
|
"""Return the status of the sensor."""
|
||||||
|
@@ -305,6 +305,11 @@ class Thermostat(ClimateDevice):
|
|||||||
"""Return the name of the Ecobee Thermostat."""
|
"""Return the name of the Ecobee Thermostat."""
|
||||||
return self.thermostat["name"]
|
return self.thermostat["name"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return a unique identifier for this ecobee thermostat."""
|
||||||
|
return self.thermostat["identifier"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temperature_unit(self):
|
def temperature_unit(self):
|
||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
|
@@ -54,6 +54,15 @@ class EcobeeSensor(Entity):
|
|||||||
"""Return the name of the Ecobee sensor."""
|
"""Return the name of the Ecobee sensor."""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return a unique identifier for this sensor."""
|
||||||
|
for sensor in self.data.ecobee.get_remote_sensors(self.index):
|
||||||
|
if sensor["name"] == self.sensor_name:
|
||||||
|
if "code" in sensor:
|
||||||
|
return f"{sensor['code']}-{self.device_class}"
|
||||||
|
return f"{sensor['id']}-{self.device_class}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the device class of the sensor."""
|
"""Return the device class of the sensor."""
|
||||||
|
@@ -61,6 +61,11 @@ class EcobeeWeather(WeatherEntity):
|
|||||||
"""Return the name of the sensor."""
|
"""Return the name of the sensor."""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return a unique identifier for the weather platform."""
|
||||||
|
return self.data.ecobee.get_thermostat(self._index)["identifier"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def condition(self):
|
def condition(self):
|
||||||
"""Return the current condition."""
|
"""Return the current condition."""
|
||||||
|
Reference in New Issue
Block a user