8000 How to resolve "Detected protocol reuse between different event loop" warning? · Issue #238 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

How to resolve "Detected protocol reuse between different event loop" warning? #238

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

Closed
CardboardTurkey opened this issue Oct 18, 2021 · 4 comments

Comments

@CardboardTurkey
Copy link

I'm trying to use the kasa API as part of my pytest setup but when making multiple calls to functions in the API I get:

WARNING kasa.protocol:protocol.py:47 Detected protocol reuse between different event loop

Can I get some advice on how to resolve this warning?

@jimboca
Copy link
Contributor
jimboca commented Oct 25, 2021

I'm trying to upgrade my https://github.com/jimboca/udi-poly-kasa from using pyhton-kasa pre release and having this issue as well.

@CardboardTurkey
Copy link
Author

It's due to multiple calls of asycio.run. I was able to resolve it by embedding my kasa work in an async function and then only calling asyncio.run once to run that function.

@jimboca
Copy link
Contributor
jimboca commented Oct 25, 2021

Thanks, yes, it's more difficult in my case but should be possible somehow.

@rytilahti
Copy link
Member

#333 improved the documentation on how to use the library when making multiple requests, so I think this can be closed. If you are still having issues, please feel free to reopen with more context (i.e., adding a minimal code example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0