diff --git a/homeassistant/components/ecobee/binary_sensor.py b/homeassistant/components/ecobee/binary_sensor.py index 4286f2cf757..2a021442a63 100644 --- a/homeassistant/components/ecobee/binary_sensor.py +++ b/homeassistant/components/ecobee/binary_sensor.py @@ -46,7 +46,7 @@ class EcobeeBinarySensor(BinarySensorEntity): self.index = sensor_index @property - def unique_id(self): + def unique_id(self) -> str | None: """Return a unique identifier for this sensor.""" for sensor in self.data.ecobee.get_remote_sensors(self.index): if sensor["name"] == self.sensor_name: @@ -54,6 +54,7 @@ class EcobeeBinarySensor(BinarySensorEntity): return f"{sensor['code']}-{self.device_class}" thermostat = self.data.ecobee.get_thermostat(self.index) return f"{thermostat['identifier']}-{sensor['id']}-{self.device_class}" + return None @property def device_info(self) -> DeviceInfo | None: diff --git a/homeassistant/components/ecobee/sensor.py b/homeassistant/components/ecobee/sensor.py index 3e2e984cccb..fe0442fb885 100644 --- a/homeassistant/components/ecobee/sensor.py +++ b/homeassistant/components/ecobee/sensor.py @@ -112,7 +112,7 @@ class EcobeeSensor(SensorEntity): self._state = None @property - def unique_id(self): + def unique_id(self) -> str | None: """Return a unique identifier for this sensor.""" for sensor in self.data.ecobee.get_remote_sensors(self.index): if sensor["name"] == self.sensor_name: @@ -120,6 +120,7 @@ class EcobeeSensor(SensorEntity): return f"{sensor['code']}-{self.device_class}" thermostat = self.data.ecobee.get_thermostat(self.index) return f"{thermostat['identifier']}-{sensor['id']}-{self.device_class}" + return None @property def device_info(self) -> DeviceInfo | None: