Check if Tuya Vacuum (sd) is able to report status directly before using pause switch (#59888)

This commit is contained in:
cvroque 2021-11-23 19:32:03 -03:00 committed by GitHub
parent ac3dc0b090
commit 28da8c474c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,9 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
@property @property
def state(self) -> str | None: def state(self) -> str | None:
"""Return Tuya vacuum device state.""" """Return Tuya vacuum device state."""
if self.device.status.get(DPCode.PAUSE): if self.device.status.get(DPCode.PAUSE) and not (
self.device.status.get(DPCode.STATUS)
):
return STATE_PAUSED return STATE_PAUSED
if not (status := self.device.status.get(DPCode.STATUS)): if not (status := self.device.status.get(DPCode.STATUS)):
return None return None