Fix motion_blinds gateway signal strength sensor (#48866)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
pull/48896/head
starkillerOG 2021-04-08 21:42:56 +02:00 committed by Paulus Schoutsen
parent 1c939fc9be
commit f791142c75
1 changed files with 7 additions and 3 deletions

View File

@ -183,10 +183,14 @@ class MotionSignalStrengthSensor(CoordinatorEntity, SensorEntity):
if self.coordinator.data is None:
return False
if not self.coordinator.data[KEY_GATEWAY][ATTR_AVAILABLE]:
return False
gateway_available = self.coordinator.data[KEY_GATEWAY][ATTR_AVAILABLE]
if self._device_type == TYPE_GATEWAY:
return gateway_available
return self.coordinator.data[self._device.mac][ATTR_AVAILABLE]
return (
gateway_available
and self.coordinator.data[self._device.mac][ATTR_AVAILABLE]
)
@property
def unit_of_measurement(self):