Skip to content

[Rules] Allow multiple OR triggers per automation #5

Description

@emi-ran

Feature

Allow one rule to run its same action sequence for multiple triggers, with OR semantics: App opened OR Wi-Fi connected -> set sound profile Normal.

Design constraints

  • Evolve Automation.triggerEvent and its per-trigger configuration into a versioned list of typed trigger definitions; do not add parallel nullable fields for every trigger.
  • Migrate existing single-trigger rules to a one-item list without behavior change.
  • A trigger match must identify which trigger fired for history/template context.
  • Keep each trigger's current matching data isolated (package, SSID, device address, schedule, geofence, etc.).
  • Reconcile demand-driven listeners from every enabled trigger. Registration/unregistration must remain correct when rules are edited, disabled, imported, or deleted.
  • Define dedupe/cooldown behavior explicitly: one per-rule cooldown shared across trigger sources unless product decision says otherwise.

Acceptance criteria

  • User can add/remove/reorder at least two heterogeneous triggers in Create/Edit.
  • Either trigger can execute same ordered action set once; duplicate callbacks do not cause duplicate execution.
  • Legacy rule migration, normal export, encrypted backup, encrypted restore, and share work.

Verification

  • Unit tests for migration, match union, trigger source labeling, dedupe, cooldown, and listener demand calculation.
  • Xiaomi device smoke test for app + Wi-Fi pair, including engine restart and disabled-rule paths.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions