WITH Functional Keyword
Feature | Since Version | Notes |
---|---|---|
WITH |
>v1.4.6 | Specifies attributes/values |
1. Overview
- Description:
The
WITH
keyword is a versatile connector used in many LOT constructs. Its primary role is to associate a value or detail with a preceding keyword or identifier.
2. Usage Contexts
WITH
is commonly used in the following scenarios:
PUBLISH TOPIC ... WITH <value>
: Specifies the payload to be published.KEEP TOPIC ... WITH <value>
: Specifies the value to be stored internally.DEFINE MODEL <Name> WITH TOPIC "<baseTopic>"
: Specifies the base output topic for the model.DEFINE RULE <Name> WITH PRIORITY <value>
: Specifies the priority of the rule.DEFINE ROUTE <Name> WITH TYPE <type>
: Specifies the type of the route (e.g.,MQTT_BRIDGE
).ADD "<propName>" WITH <definition>
(in Models): Specifies the definition (value, expression, topic reference) of a model property.ADD ... WITH <configOption> <value>
(in Routes): Specifies configuration options for source, destination, or mappings.SET "<varName>" WITH <value>
: An alternative syntax for assigning values to temporary variables (often=
is used).
3. Syntax Examples
Refer to the documentation for the specific keywords that utilize WITH
for detailed syntax and examples:
- PUBLISH TOPIC
- KEEP TOPIC
- Defining Constructs: DEFINE MODEL
- Defining Constructs: DEFINE RULE
- Defining Constructs: DEFINE ROUTE
- ADD
- SET
General Pattern:
Specific Examples:
PUBLISH TOPIC "status" WITH "active"
DEFINE MODEL MyModel WITH TOPIC "output/base"
DEFINE RULE MyRule WITH PRIORITY 1
ADD "temperature" WITH TOPIC "sensors/temp"
ADD SOURCE_CONFIG WITH BROKER_ADDRESS "127.0.0.1"
ADD MAPPING Map1 WITH SOURCE_TOPIC "in/#"
4. Notes & Additional Information
WITH
acts as a bridge linking a keyword/identifier to its associated parameters or values.- Its exact meaning depends on the context provided by the preceding keyword (
PUBLISH
,DEFINE
,ADD
, etc.).
5. Related Documentation
- Functional Keywords Index
- (See links in Section 3 above)