camacq.plugins.automations package

Handle automations.

class camacq.plugins.automations.ActionSequence(center: Center, actions: Generator[TemplateAction, None, None] | list[TemplateAction])[source]

Bases: object

Represent a sequence of actions.

delay(seconds: float, variables: dict[str, Any], waiting: deque[TemplateAction]) None[source]

Delay action sequence.

Parameters:
  • seconds (float) – A time interval to delay the pending action sequence.

  • variables (dict) – A dict of template variables.

class camacq.plugins.automations.Automation(center: Center, name: str, attach_triggers: Callable[[Callable[[dict[str, Any]], Any]], Callable[[], None] | None], cond_func: Callable[[dict[str, Any]], str | bool], action_sequence: ActionSequence, enabled: bool = True)[source]

Bases: object

Automation class.

disable() None[source]

Disable automation.

enable() None[source]

Enable automation.

async trigger(variables: dict[str, Any]) None[source]

Run actions of this automation.

class camacq.plugins.automations.TemplateAction(center: Center, action_conf: dict[str, Any])[source]

Bases: object

Representation of an action with template data.

render(variables: dict[str, Any] | None) dict[str, Any][source]

Render the template with the kwargs for the action.

camacq.plugins.automations.make_checker(condition_type: str, checks: list[Callable[[dict[str, Any]], str | bool]]) Callable[[dict[str, Any]], bool][source]

Return a function to check condition.

async camacq.plugins.automations.setup_module(center: Center, config: dict[str, Any]) None[source]

Set up automations package.

Parameters:
  • center (Center instance) – The Center instance.

  • config (dict) – The config dict.

camacq.plugins.automations.template_check(value: str | bool) bool[source]

Check if a rendered template string equals true.

If value is not a string, return value as is.

Submodules

camacq.plugins.automations.event module

Handle event trigger in automations.

camacq.plugins.automations.event.handle_trigger(center: Center, config: dict[str, Any], trigger_func: Callable[[dict[str, Any]], Awaitable[None]]) Callable[[], None][source]

Listen for events.