From 68f936b2ff7c06a60c1bc7a45809ad0c5eb6dc3a Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Wed, 30 Sep 2020 18:05:44 -0600 Subject: [PATCH] Keep existing system state when cloud fails to return a state (#186) --- simplipy/system/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/simplipy/system/__init__.py b/simplipy/system/__init__.py index 95c381bc..ca02031c 100644 --- a/simplipy/system/__init__.py +++ b/simplipy/system/__init__.py @@ -258,12 +258,13 @@ def version(self) -> int: """ return self._location_info["system"]["version"] - @staticmethod - def _coerce_state_from_raw_value(value: Union[str, None]) -> SystemStates: + def _coerce_state_from_raw_value(self, value: Union[str, None]) -> SystemStates: """Return a proper state from a string input.""" if not value: - _LOGGER.warning("SimpliSafe didn't return current system state") - return SystemStates.unknown + _LOGGER.debug( + "SimpliSafe didn't return system state; retaining current state" + ) + return self.state try: return SystemStates[convert_to_underscore(value)]