Skip to content

Using API #1

@chrisoutwright

Description

@chrisoutwright

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?

loop = asyncio.get_event_loop()
tasks = [asyncio.ensure_future(cam.async_set_night_mode("auto"))]
loop.run_until_complete(asyncio.wait(tasks))

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions