duck.automation.triggerยถ

Module for Automation Triggers.

This module provides classes for defining and managing automation triggers. It includes a base AutomationTrigger class and a NoTrigger class for scenarios where no trigger is needed.

Module Contentsยถ

Classesยถ

AutomationTrigger

Base class for Automation Triggers.

NoTriggerBase

A trigger that always returns True.

Dataยถ

NoTrigger

APIยถ

class duck.automation.trigger.AutomationTrigger(name: str = None, description: str = None)[source]ยถ

Base class for Automation Triggers.

This class serves as a blueprint for creating automation triggers.

Initialization

Initialize the AutomationTrigger.

Parameters:
  • name โ€“ The name of the trigger.

  • description โ€“ The description of the trigger.

__repr__()[source]ยถ

Return a string representation of the AutomationTrigger.

Returns:

A string representation of the AutomationTrigger.

Return type:

str

abstractmethod check_trigger() โ†’ bool[source]ยถ

Check if the trigger is satisfied.

Returns:

True if the trigger is satisfied, otherwise False.

Return type:

bool

Raises:

NotImplementedError โ€“ This method should be implemented in a subclass.

duck.automation.trigger.NoTriggerยถ

โ€˜NoTriggerBase(โ€ฆ)โ€™

class duck.automation.trigger.NoTriggerBase(name: str = None, description: str = None)[source]ยถ

Bases: duck.automation.trigger.AutomationTrigger

A trigger that always returns True.

This trigger can be used in scenarios where no specific trigger condition is required.

Initialization

Initialize the AutomationTrigger.

Parameters:
  • name โ€“ The name of the trigger.

  • description โ€“ The description of the trigger.

check_trigger() โ†’ bool[source]ยถ

Check if the trigger is satisfied.

Returns:

Always returns True.

Return type:

bool