Widget Context

An instance of the WidgetContext is passed to each widget when the widget is loaded.

class dashboard.widget_context.WidgetContext(resolver=None, settings=None)[source]

Context that is passed as an argument to widgets when they are called.

The context contains methods useful for widgets.

client

A uvhttp.http.Session that can be used for making HTTP requests:

async def ip_widget(wc):
    response = await wc.client.get(b'http://httpbin.org/ip')
    return { "ip": response.json()["origin"] }
hue

The uvhue.uvhue.Hue client that can be used by widgets.

run(func, *args)[source]

Run a function in an external process if it is CPU intensive.

sonos

The dashboard.sonos.Sonos client that can be used by widgets.