-
Notifications
You must be signed in to change notification settings - Fork 7
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
Properties that do I/O don't do well with asyncio #3
Comments
I've tried (in my own fork using the git dependency method) changing any What else causes I/O inside the event loop apart from the above? Is it the _get function for example as it does a call to the lyric API? How do we resolve this? Line in question is a call to locations |
Ideally also the getters need to be removed because they are also doing I/O, like I think that the best approach is to remove all caching and helper functions like Let the lib be responsible for interacting with the API, a caching layer can be build on top by the consumer. |
Hey, Im using the timmo001 fork from here: Appreciate all the work Timmo. Its to bad there are so many non-working versions of the lyric thermostat. its such a popular unit.. hope to see a working version sometime in the future... doing I/O at custom_components/lyric/climate.py, line 223: self.device.temperatureSetpoint = temp doing I/O at custom_components/lyric/climate.py, line 241: self._humidity = self.device.indoorHumidity hope it helps. |
So is it worth stripping out and making a separate helpers.py file in this lib, or remove completely and have it be defined in custom_component/integration? |
We should use the |
@bramkragten Okay, reading that, in my limited understanding at this point- for my lyric custom_component, I should import New at this and learning! |
This lib does I/O when a property is set.
This makes it difficult to use in asyncio, because now all code will need to be wrapped in synchronous functions. It also makes it risky that if a developer does not pay attention, they end up doing I/O inside the event loop.
Using functions is preferred
The text was updated successfully, but these errors were encountered: