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,
listener: SettingAutocompleteListener) ‑> Self
Register an autocomplete listener for the setting with the given id.
Args
| Name | Type | Description |
|---|---|---|
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) ‑> WidgetSettingGet the setting with the given id.
Raises
NotFound- Raised if a setting with the given id is not found.:
Inherited members
SettingAutocompleteResult
Ancestors
- builtins.dict
Instance variables
name
var name : strThe autocomplete value that will be shown to the user and used in the widget.
description
var description : strA short description of the result that will be shown below the name.
icon
var icon : strA path to an .svg file to show as icon for the result.
image
var image : strA path to an image that is not an .svg file to show as icon for the result.
data
var data : AnyAny additional data you wild like to pass to the widget for this autocomplete value.
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
| Name | Type | Description |
|---|---|---|
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. |