Log debug message when state changes to error

This commit is contained in:
Luke Bonaccorsi 2023-09-07 17:14:49 +01:00
parent 8d8428a359
commit 7f5cc8c30f
1 changed files with 2 additions and 1 deletions

View File

@ -191,10 +191,11 @@ class RoboVacEntity(StateVacuumEntity):
def state(self) -> str | None:
if self.tuya_state is None:
return STATE_UNAVAILABLE
elif type(self.error_code) is not None and self.error_code not in [
elif type(self.error_code) is not None and self.error_code and self.error_code not in [
0,
"no_error",
]:
_LOGGER.debug("State changed to error. Error message: {}".format(getErrorMessage(self.error_code)))
return STATE_ERROR
elif self.tuya_state == "Charging" or self.tuya_state == "completed":
return STATE_DOCKED