FlowCardTriggerDevice

homey.flow_card_trigger_device

A flow card with type trigger and an argument with type device with a filter with driver_id, as defined in an app's app.json.

Ancestors

Methods

register_run_listener

def register_run_listener(self, listener: RunListener[bool]) ‑> Self

Register a listener for when this flow card is activated. Raising an exception in the listener will make the flow fail with the exception's message.

Args

NameTypeDescription
listener RunListener[bool] An async listener ran when the flow card is activated, which returns whether the flow should start. It receives the arguments of the flow card, and arguments passed when triggering the flow card.

Returns

This flow card, for chained calls.

Raises

AlreadyExists
Raised if a listener was already registered for this flow card.

trigger

async def trigger(self, device: Device, tokens: dict[str, Any] = {}, **trigger_kwargs) ‑> None

Activate the flow card, and thereby any flows it is used in.

Args

NameTypeDescription
device Device The Device to trigger the flow card for.
tokens dict[str, Any] A mapping from tokens to their values in the flow, as defined in app.json.
trigger_kwargs Arguments that will be passed to the card's run listener.

Inherited members