Skip to content

Commit

Permalink
fix: alarm_state replaces state and added typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
SecKatie committed Dec 8, 2024
1 parent 8f06b0c commit 634b41a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions custom_components/wyzeapi/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def __init__(self, hms_service: HMSService):
self._hms_service = hms_service
self._state = AlarmControlPanelState.DISARMED
self._server_out_of_sync = False

@property
def state(self):
def alarm_state(self) -> str:
return self._state

# NotImplemented Methods
Expand Down Expand Up @@ -151,13 +151,13 @@ async def async_update(self) -> None:
if not self._server_out_of_sync:
state = await self._hms_service.update(self._hms_service.hms_id)
if state is HMSMode.DISARMED:
self._state = "disarmed"
self._state = AlarmControlPanelState.DISARMED
elif state is HMSMode.AWAY:
self._state = "armed_away"
self._state = AlarmControlPanelState.ARMED_AWAY
elif state is HMSMode.HOME:
self._state = "armed_home"
self._state = AlarmControlPanelState.ARMED_HOME
elif state is HMSMode.CHANGING:
self._state = "disarmed"
self._state = AlarmControlPanelState.DISARMED
else:
_LOGGER.warning(f"Received {state} from server")

Expand Down
2 changes: 1 addition & 1 deletion custom_components/wyzeapi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def async_step_user(
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
)

async def async_step_2fa(self, user_input: Dict[str, Any] = None) -> Dict[str, Any]:
async def async_step_2fa(self, user_input: Optional[dict[str, Any]] = None) -> dict[str, Any]:
if user_input is None:
return self.async_show_form(step_id="2fa", data_schema=STEP_2FA_DATA_SCHEMA)

Expand Down

0 comments on commit 634b41a

Please sign in to comment.