You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you explain how the API could be used, after creating an HttpCam instance?
The methods implement asyncio, how should one proceed? I tried this guide, but to no avail.
Either I get cannot 'yield from' a coroutine object in a non-coroutine generator or <_GatheringFuture pending>. When calling the method itself, I get a <coroutine object Wansview.async_get_night_mode at ...> but I fail to be able to close it and display the message I should get from the called method.
I wrote the library to connect some cameras I have to home-assistant. There, the library integrates quite nicely. E.g. I can override the async_camera_image method of the core Camera class and hand the call through to the libhttpcam as follows (self._cam holds a reference to the HttpCam instance):
async def async_camera_image(self):
"""Return bytes of camera image."""
(code, result) = await self._cam.async_snap_picture()
return result
Of course, home-assistant handles the async part here, so that doesn't quite address your question on how to deal with the async errors.
I use the async/await patterns quite regularly in ECMAScript; unfortunately I don't have a deep familiarity with the equivalent Python mechanisms. Judging from the error you get, could it be that you expect a message back, where the async method is in fact returning a Future (or Promise in ECMAScript)?
Could you explain how the API could be used, after creating an HttpCam instance?
The methods implement asyncio, how should one proceed? I tried this guide, but to no avail.
Either I get
cannot 'yield from' a coroutine object in a non-coroutine generator
or<_GatheringFuture pending>
. When calling the method itself, I get a<coroutine object Wansview.async_get_night_mode at ...>
but I fail to be able to close it and display the message I should get from the called method.Would this work?
How does one call these methods correctly, I've never used asyncio before and can't figure it out how to use it in this case. Thank you.
The text was updated successfully, but these errors were encountered: