Feature
Support nested AND / OR / NOT condition groups. Current Automation.conditions: List<RuleCondition> has flat AND semantics, so it cannot express: Wi-Fi = Home AND (time = night OR battery < 20%).
Proposed model
- Replace or version the flat list with a serializable condition expression tree:
AllOf, AnyOf, Not, and leaf RuleCondition.
- Preserve existing rules by migrating each non-empty flat list to
AllOf(leaves).
- Put expression evaluation in a pure engine component with short-circuit semantics and unit tests.
- Build a bounded Compose editor supporting grouping, reorder, delete, and visible nesting. Avoid arbitrary complexity if depth must be capped; document cap.
- Export/import must preserve the expression tree and retain current encrypted-backup validation-before-mutation guarantees.
Acceptance criteria
- Existing rules preserve exact behavior after migration.
- User can create
Wi-Fi = Home AND (night OR battery below 20%) and a NOT group.
- Invalid empty groups cannot be saved.
- History/rule detail show a human-readable expression without sensitive values.
Verification
- Migration fixtures for old JSON, current export/import, malformed groups, and nested evaluation.
- Test repeated event, cooldown, permission-denial, and no-match paths on Xiaomi 15T Pro / HyperOS 3.
Feature
Support nested AND / OR / NOT condition groups. Current
Automation.conditions: List<RuleCondition>has flat AND semantics, so it cannot express:Wi-Fi = Home AND (time = night OR battery < 20%).Proposed model
AllOf,AnyOf,Not, and leafRuleCondition.AllOf(leaves).Acceptance criteria
Wi-Fi = Home AND (night OR battery below 20%)and a NOT group.Verification