mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix for unknown sensor state (#27542)
This commit is contained in:
parent
96c0ad302f
commit
6c947f58b8
@ -105,6 +105,10 @@ class EcobeeBinarySensor(BinarySensorDevice):
|
|||||||
"""Get the latest state of the sensor."""
|
"""Get the latest state of the sensor."""
|
||||||
await self.data.update()
|
await self.data.update()
|
||||||
for sensor in self.data.ecobee.get_remote_sensors(self.index):
|
for sensor in self.data.ecobee.get_remote_sensors(self.index):
|
||||||
|
if sensor["name"] != self.sensor_name:
|
||||||
|
continue
|
||||||
for item in sensor["capability"]:
|
for item in sensor["capability"]:
|
||||||
if item["type"] == "occupancy" and self.sensor_name == sensor["name"]:
|
if item["type"] != "occupancy":
|
||||||
self._state = item["value"]
|
continue
|
||||||
|
self._state = item["value"]
|
||||||
|
break
|
||||||
|
@ -112,7 +112,7 @@ class EcobeeSensor(Entity):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
if self._state in [ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN]:
|
if self._state in [ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN, "unknown"]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if self.type == "temperature":
|
if self.type == "temperature":
|
||||||
@ -129,6 +129,10 @@ class EcobeeSensor(Entity):
|
|||||||
"""Get the latest state of the sensor."""
|
"""Get the latest state of the sensor."""
|
||||||
await self.data.update()
|
await self.data.update()
|
||||||
for sensor in self.data.ecobee.get_remote_sensors(self.index):
|
for sensor in self.data.ecobee.get_remote_sensors(self.index):
|
||||||
|
if sensor["name"] != self.sensor_name:
|
||||||
|
continue
|
||||||
for item in sensor["capability"]:
|
for item in sensor["capability"]:
|
||||||
if item["type"] == self.type and self.sensor_name == sensor["name"]:
|
if item["type"] != self.type:
|
||||||
self._state = item["value"]
|
continue
|
||||||
|
self._state = item["value"]
|
||||||
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user