PairSession

homey.pair_session

A pairing session, prompting users for information to add new devices.

This class must not be initialized by the developer, but is passed to Driver.on_pair().

Methods

done

async def done(self) ‑> None

Close the pairing session.

emit

async def emit(self, event: str, data: Any | None = None) ‑> Any

Emits an event with the given name, along with any data, to the pairing view.

Returns

Any data returned by the handler in the pairing session.

show_view

async def show_view(self, id: str) ‑> None

Show the view with the given id in the pairing flow, as defined in app.json.

next_view

async def next_view(self) ‑> None

Go to the next pairing step.

prev_view

async def prev_view(self) ‑> None

Go to the previous pairing step.

set_handler

def set_handler(self, event: str, listener: Callable[..., Coroutine[Any, Any, Any]]) ‑> Self

Register a listener for events of the given name emitted by the pairing view. Any data returned will be sent back to the view.

Args

NameTypeDescription
listener Callable[..., Coroutine[Any, Any, Any]] An async listener that receives any data that is passed along with the event.

Returns

This pairing session, for chained calls.