ADD Functional Keyword
Feature | Since Version | Notes |
---|---|---|
ADD |
>v1.4.4 | Used in Models and Routes |
ADD in DEFINE ROUTE |
??? | Define topic mappings |
Overview
- Description:
The
ADD
keyword is used withinDEFINE MODEL
andDEFINE ROUTE
blocks to add specific components: properties to a Model, or configuration sections/mappings to a Route.
Signature
- Syntax (in Models):
- Syntax (in Routes):
Parameters
- In Models:
Usage Examples
Basic Example (Model Property)
Adding properties to calculate Fahrenheit from Celsius and determine status.
DEFINE MODEL TemperatureProcessor WITH TOPIC "processed/temp"
ADD "celsius" WITH TOPIC "raw/temp" AS TRIGGER
ADD "fahrenheit" WITH (celsius * 9/5 + 32)
ADD "status" WITH IF celsius > 30 THEN "High" ELSE "Normal"
ADD "lastUpdated" WITH TIMESTAMP "ISO"
Example in Routes
Adding source/destination configurations and a topic mapping for an MQTT bridge.
DEFINE ROUTE LocalToCloudBridge WITH TYPE MQTT_BRIDGE
ADD SOURCE_CONFIG
WITH BROKER SELF
WITH CLIENT_ID "local_bridge"
ADD DESTINATION_CONFIG
WITH BROKER_ADDRESS "cloud.mqtt.example.com"
WITH BROKER_PORT 8883
WITH USE_TLS true
WITH USERNAME "bridge_user"
WITH PASSWORD "secret_pass"
ADD MAPPING SensorData
WITH SOURCE_TOPIC "local/sensors/#"
WITH DESTINATION_TOPIC "cloud/local_sensors/#"
WITH DIRECTION "out"
Notes & Additional Information
- In
DEFINE MODEL
,ADD
is the primary way to define the structure and logic of the model. ADD
is always followed by the specific element being added (e.g., a property name string,SOURCE_CONFIG
,MAPPING
).- The details of the added element are specified using the
WITH
keyword.