Skip to content

Commit

Permalink
Keep existing system state when cloud fails to return a state (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored Oct 1, 2020
1 parent 8d7891a commit 68f936b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions simplipy/system/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 68f936b

Please sign in to comment.