Skip to content

Commit

Permalink
fix: test connection without init
Browse files Browse the repository at this point in the history
  • Loading branch information
fuatakgun committed Dec 27, 2022
1 parent c560a68 commit a9a9e69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/eufy_security/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def _show_config_form(self, user_input): # pylint: disable=unused-argumen
async def _test_credentials(self, host, port): # pylint: disable=unused-argument
try:
api_client: ApiClient = ApiClient(host, port, aiohttp_client.async_get_clientsession(self.hass))
await api_client.connect()
await api_client.ws_connect()
await api_client.disconnect()
return True
except Exception as ex: # pylint: disable=broad-except
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ def __init__(self, host: str, port: int, session: aiohttp.ClientSession) -> None
self.captcha_future: asyncio.Future[dict] = self.get_new_future()
self.mfa_future: asyncio.Future[dict] = self.get_new_future()

async def ws_connect(self):
await self.client.connect()

async def connect(self):
"""Set up web socket connection and set products"""
await self.client.connect()
await self.ws_connect()
await self._set_schema(SCHEMA_VERSION)
await self._set_products()

Expand Down
2 changes: 1 addition & 1 deletion custom_components/eufy_security/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Eufy Security",
"documentation": "https://github.com/fuatakgun/eufy_security",
"issue_tracker": "https://github.com/fuatakgun/eufy_security/issues",
"dependencies": ["ffmpeg", "http"],
"dependencies": ["ffmpeg", "stream"],
"config_flow": true,
"version": "5.0.2",
"codeowners": ["@fuatakgun"],
Expand Down

0 comments on commit a9a9e69

Please sign in to comment.