Examples Index
Find the right pattern for your use case:Basic Model Examples
Simple Sensor Reading
A straightforward model that formats raw sensor data with static metadata. This model adds context (sensor ID, unit, status) to a raw temperature value:sensors/raw/temperature, the model publishes:
Multi-Source Equipment Status
Combine data from multiple topics into a unified equipment status report. Each field pulls from a different source topic. The status topic acts as the trigger:equipment/status/formatted:
Production Record with Calculations
Automatically calculate derived values like efficiency percentages. Theefficiency_percent field is calculated inline from other topic values:
Wildcard Model Examples
Multi-Instance Sensor Model
Handle multiple sensors with a single model definition using the+ wildcard.
The + wildcard matches any single level in the topic hierarchy:
sensors/temp001/value receives data, the model publishes to sensors/temp001/formatted:
Each sensor instance (temp001, pressure002, etc.) gets its own output topic automatically. The wildcard maintains topic context through the model.
Factory Hierarchy Model
Handle multi-level topic hierarchies with multiple wildcards. Multiple+ wildcards capture different levels of the hierarchy:
factory/line1/machine1/status updates, the model publishes to factory/line1/machine1/data/formatted:
Models Published by Actions Examples
Alarm Record from JSON
Process incoming JSON payloads into structured alarm records. First, define the model schema withCOLLAPSED (no automatic trigger):
alarms/pump003/json_input, the action publishes to alarms/structured/pump003:
Production Event with Calculations
Create production records with computed metrics like efficiency. Define the schema for production events:production/line2/events with a target cycle time of 10s and an actual cycle time of 8.5s, the action publishes to production/events/structured/line2:
Quality Check with Validation
Determine pass/fail status based on measurement tolerances.Complex conditional logic (like tolerance checking) is cleaner in an action than inline in a model. The action can also route to different topics based on the result.
quality/passed/PART_A1:
Model Inheritance Examples
For complete inheritance patterns and syntax, see Model Inheritance.
Alert Model Family
Create specialized alert types from a common base model. First, define the base model with common fields:TH_042, the action publishes to alerts/temperature/TH_042 with both inherited and specialized fields:
Nested Object Examples
Sensor with Metadata
Group related configuration and context fields into nested sub-objects using theOBJECT type and indentation.
The metadata field uses OBJECT to group location details into a nested object. Fields indented under ADD OBJECT become its properties. When indentation returns to the parent level, fields belong to the top-level model again:
sensors/temp001/value receives data, the model publishes to sensors/temp001/formatted:
The indentation rule applies everywhere
OBJECT is used — in basic models, wildcard models, and COLLAPSED templates published from actions.Choosing the Right Pattern
Basic Models (WITH TOPIC + AS TRIGGER)
Basic Models (WITH TOPIC + AS TRIGGER)
Use when: Data flows continuously and formatting is straightforward.Best for: Sensor readings, status updates, simple aggregation.Trigger: Automatic when source topic updates.
Calculated Fields
Calculated Fields
Use when: You need derived metrics computed from source values.Best for: Percentages, totals, averages, unit conversions.Note: Keep calculations simple; use actions for complex logic.
Wildcard Models (+)
Wildcard Models (+)
Use when: You have multiple instances of the same data structure.Best for: Fleets of sensors, multi-line factories, device groups.Benefit: One model definition handles all instances.
Action-Published Models (COLLAPSED)
Action-Published Models (COLLAPSED)
Use when: You need control over timing, routing, or complex logic.Best for: JSON extraction, conditional publishing, pass/fail routing, complex calculations.Benefit: Full action power with structured output.
Inherited Models (FROM)
Inherited Models (FROM)
Use when: You have related data types sharing common fields.Best for: Alert families, equipment types, event categories.Benefit: DRY principle—define common fields once.
Nested Objects (OBJECT)
Nested Objects (OBJECT)
Use when: Your JSON output needs grouped or hierarchical data.Best for: Metadata grouping, configuration objects, multi-level status reports.Benefit: Clean nested JSON without external formatting. Indentation controls structure.
Next Steps
Routes Overview
Connect your broker to external systems and databases.
Actions Syntax
Master the action syntax for publishing models.

