Widget

homey.widget

A widget, as defined in app.json.

Ancestors

  • SimpleClass
  • homey.util.event_emitter.EventEmitter
  • typing.Generic

Methods

register_setting_autocomplete_listener

def register_setting_autocomplete_listener(self,
id: str,
listenerSettingAutocompleteListener)
‑> Self

Register an autocomplete listener for the setting with the given id.

Args

NameTypeDescription
listener SettingAutocompleteListener An async listener for when an autocomplete value is requested for the setting. It receives the query typed by the user, as well as any settings in the widget, as currently selected by the user.

Raises

AlreadyExists
Raised if a listener was already registered for the setting.
NotFound
Raised if no setting with the given id is found.

Returns

This widget, for chained calls.

get_setting

def get_setting(self, id: str) ‑> WidgetSetting

Get the setting with the given id.

Raises

NotFound
Raised if a setting with the given id is not found.:

Inherited members

SettingAutocompleteResult

class SettingAutocompleteResult

Ancestors

  • builtins.dict

Instance variables

name

var name : str

The autocomplete value that will be shown to the user and used in the widget.

description

var description : str

A short description of the result that will be shown below the name.

icon

var icon : str

A path to an .svg file to show as icon for the result.

image

var image : str

A path to an image that is not an .svg file to show as icon for the result.

data

var data : Any

Any additional data you wild like to pass to the widget for this autocomplete value.

SettingAutocompleteListener

class SettingAutocompleteListener

A listener for when an autocomplete value is requested in a widget. It receives the query typed by the user, as well as the values of any settings in the widget, as currently selected by the user.

Ancestors

  • typing.Protocol
  • typing.Generic

Methods

__call__

async def __call__(self,
query: str,
settings: dict[str, SettingValue | SettingAutocompleteResult])
‑> list[SettingAutocompleteResult]

Args

NameTypeDescription
query str The query typed by the user.
settings dict[str, SettingValue | SettingAutocompleteResult] The values of any settings in the widget, as currently selected by the user.