Actions

Typed operations that can be executed on ObjectInstances. Each Action has parameters, preconditions (evaluated before execution), and audit hooks (fired before/after/on failure).

Builder Example

Rust
let set_temp = Action::builder("set_temperature")
    .description("Set HVAC target temperature")
    .target_type(hvac_type_id)
    .parameter(PropertyDef::new("value", PropertyType::F64)
        .with_unit("°C")
        .with_constraint(PropertyConstraint::Range { min: 16.0, max: 30.0 })
        .required())
    .precondition(Precondition::PropertyEquals {
        property: "mode".into(),
        value: PropertyValue::String("cool".into()),
    })
    .audit_hook(AuditHook::all_fields(AuditEvent::AfterExecution))
    .build();

let id = action_registry.register(set_temp)?;

Preconditions

VariantDescription
PropertyAboveProperty must exceed threshold
PropertyBelowProperty must be below threshold
PropertyEqualsProperty must equal a specific value
TimeWindowMust be within time range (start_min..end_min)
HasInterfaceTarget must implement an interface
And / Or / NotComposable boolean logic

Audit Hooks

EventWhen
BeforeExecutionBefore the action runs (capture pre-state)
AfterExecutionAfter successful execution (capture post-state)
OnFailureOn execution failure (capture error context)

Server-Side Functions

FunctionDef defines typed server-side functions with parameters (Scalar, ObjectSet, Instance, PropertyMap, List) and returns (Scalar, ObjectSet, PropertyMap, Void). Registered in FunctionRegistry and callable via Expr::Call.

Questions?

Reach out for help with integration, deployment, or custom domain codecs.