Skip to content

Commit

Permalink
upgrade library
Browse files Browse the repository at this point in the history
  • Loading branch information
bj00rn committed Feb 13, 2023
1 parent d7a9f3c commit 51eb3cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
13 changes: 6 additions & 7 deletions custom_components/saleryd_hrv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
port = entry.data.get(CONF_WEBSOCKET_PORT)

session = async_get_clientsession(hass)
client = Client(url, port, session)
await client.connect()
coordinator = SalerydLokeDataUpdateCoordinator(
hass,
update_method=client.async_get_data,
update_interval=SCAN_INTERVAL,
)
async with Client(url, port, session) as client:
coordinator = SalerydLokeDataUpdateCoordinator(
hass,
update_method=client.async_get_data,
update_interval=SCAN_INTERVAL,
)

await coordinator.async_config_entry_first_refresh()

Expand Down
6 changes: 2 additions & 4 deletions custom_components/saleryd_hrv/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ async def _test_connection(self, ip, port):
"""Return true if connection is working"""

try:
session = async_create_clientsession(self.hass)
client = Client(ip, port, session)
asyncio.wait_for(client.connect(), 10)
return True
async with Client(ip, port, async_create_clientsession(self.hass)):
return True
except Exception as e: # pylint: disable=broad-except
_LOGGER.error("Could not connect", exc_info=True)
pass
Expand Down
2 changes: 1 addition & 1 deletion custom_components/saleryd_hrv/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"@bj00rn"
],
"requirements": [
"pysaleryd>=2.0.2"
"pysaleryd>=3.0.1"
]
}

0 comments on commit 51eb3cb

Please sign in to comment.