Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated asyncio.wait use with coroutines and deprecated dependencies #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions custom_components/uvfive/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"documentation": "https://github.com/vaughan-zeng/uvfive_miot",
"issue_tracker": "https://github.com/vaughan-zeng/uvfive_miot/issues",
"requirements": [
"construct",
"python-miio>=0.5.3"
"construct==2.10.70",
"python-miio>=0.5.12"
],
"dependencies": [],
"codeowners": [
"@von"
],
"version": "v0.1"
"version": "v0.1.2"
}
12 changes: 7 additions & 5 deletions custom_components/uvfive/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
"Loading Five MIoT device via platform setup is deprecated; Please remove it from your configuration"
)
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_IMPORT},
data=config,
asyncio.create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_IMPORT},
data=config,
)
)
)

Expand Down Expand Up @@ -209,7 +211,7 @@ async def async_service_handler(service):
if not hasattr(device, method["method"]):
continue
await getattr(device, method["method"])(**params)
update_tasks.append(device.async_update_ha_state(True))
update_tasks.append(asyncio.create_task(device.async_update_ha_state(True)))

if update_tasks:
await asyncio.wait(update_tasks)
Expand Down