EMPTY Entity
Feature | Since Version | Notes |
---|---|---|
EMPTY or "" |
1.0 | Represents a null or empty value |
The EMPTY
entity signifies the absence of a value. It is most commonly used for checking if a topic currently holds any data.
LOT treats EMPTY
and an empty string literal (""
) as equivalent in comparisons.
Usage
Primarily used in IF
conditions to check if a GET TOPIC
result is empty.
Syntax
Alternatively, an empty string can be used for comparison:
Examples
1. Initializing a Topic Value:
DEFINE ACTION InitializeCounter
ON TOPIC "system/start" DO
IF GET TOPIC "persistent/counter" == EMPTY THEN
PUBLISH TOPIC "persistent/counter" WITH 0
ENDIF
2. Checking for Configuration:
DEFINE ACTION CheckConfig
ON EVERY 1 MINUTE DO
IF GET TOPIC "config/device_id" = "" THEN
PUBLISH TOPIC "log/error" WITH "Device ID not configured!"
ELSE
// Proceed with normal operation
ENDIF
Related Documentation
- Entities Index
- Functional Keywords (See
IF
,GET TOPIC
) - Operators & Expressions (See Comparison Operators)