ManagerApi

homey.manager.api

Manages web API access and realtime events to this app, as well as communication with other apps. You can access this manager through the Homey instance as self.homey.api.

Ancestors

Methods

get

async def get(self, uri: str) ‑> Any

Perform a GET request.

Args

NameTypeDescription
uri str The path to request, relative to /api.

Returns

The response from the endpoint.

post

async def post(self, uri: str, body: Any) ‑> Any

Perform a POST request.

Args

NameTypeDescription
uri str The path to request, relative to /api.
body Any A body to send with the request.

Returns

The response from the endpoint.

put

async def put(self, uri: str, body: Any) ‑> Any

Perform a PUT request.

Args

NameTypeDescription
uri str The path to request, relative to /api.
body Any A body to send with the request.

Returns

The response from the endpoint.

delete

async def delete(self, uri: str) ‑> Any

Perform a DELETE request.

Args

NameTypeDescription
uri str The path to request, relative to /api.

Returns

The response from the endpoint.

realtime

async def realtime(self, event: str, data: Any) ‑> None

Emit a realtime event.

Args

NameTypeDescription
event str The name of the event.
data Any The data to send.

get_api

def get_api(self, uri: str) ‑> Api

Create an API instance, to receive realtime events.

Args

NameTypeDescription
uri str The URI of the endpoint, e.g. homey:manager:webserver.

Returns

An Api instance registered to the given uri.

get_api_app

def get_api_app(self, app_id: str) ‑> ApiApp

Create an app API instance, to receive realtime events.

Args

app_id:

Returns

An ApiApp instance registered to the given app.

unregister_api

def unregister_api(self, api: Api) ‑> None

Unregister an API instance.

Args

NameTypeDescription
api Api Api instance.

get_local_url

async def get_local_url(self) ‑> str

Get a url for local access.

get_owner_api_token

async def get_owner_api_token(self) ‑> str

Start a new API session on behalf of the homey owner and return the API token. The API Token expires after not being used for two weeks.

Requires the homey:manager:api permission. For more information about permissions read the Permissions tutorial.

Returns

An API token.

Inherited members