Add lock typing in freedompro (#73544)

pull/72884/head
epenet 2022-06-16 10:40:55 +02:00 committed by GitHub
parent 521d52a8b9
commit 7731cfd978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,6 @@
"""Support for Freedompro lock.""" """Support for Freedompro lock."""
import json import json
from typing import Any
from pyfreedompro import put_state from pyfreedompro import put_state
@ -75,10 +76,10 @@ class Device(CoordinatorEntity, LockEntity):
await super().async_added_to_hass() await super().async_added_to_hass()
self._handle_coordinator_update() self._handle_coordinator_update()
async def async_lock(self, **kwargs): async def async_lock(self, **kwargs: Any) -> None:
"""Async function to lock the lock.""" """Async function to lock the lock."""
payload = {"lock": 1} payload_dict = {"lock": 1}
payload = json.dumps(payload) payload = json.dumps(payload_dict)
await put_state( await put_state(
self._session, self._session,
self._api_key, self._api_key,
@ -87,10 +88,10 @@ class Device(CoordinatorEntity, LockEntity):
) )
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
async def async_unlock(self, **kwargs): async def async_unlock(self, **kwargs: Any) -> None:
"""Async function to unlock the lock.""" """Async function to unlock the lock."""
payload = {"lock": 0} payload_dict = {"lock": 0}
payload = json.dumps(payload) payload = json.dumps(payload_dict)
await put_state( await put_state(
self._session, self._session,
self._api_key, self._api_key,