Skip to content

Block: Text Compare

Type: text_compare

the Text Compare block

Compare two text values using different comparison operations. Perfect for conditional logic, filtering data, validating user input, or creating smart automation rules based on text content matching, differences, or substring detection.

What is Text Compare?

The Text Compare block evaluates two text inputs using a specified comparison operator and returns true or false. This enables you to build conditional logic based on text content, whether checking for exact matches, detecting differences, or finding substrings within larger text.

How It Works

The block performs three types of text comparison operations:

  • Equals (=) - Exact match comparison (case-sensitive)
  • Not Equals (≠) - Different text detection
  • Includes - Substring detection within text

Comparison Operators

Equals (=) - Exact Match

Returns true when both text values are exactly the same, including case sensitivity.

Case Sensitivity Alert

Text comparison is case-sensitive! "Hello" is NOT equal to "hello"

Examples:

  • "hello" = "hello" → true
  • "Hello" = "hello" → false (case-sensitive)
  • "test123" = "test123" → true
  • " test " = "test" → false (whitespace matters)

Common Uses:

  • ✅ Check device status: device_status = "online"
  • ✅ Validate user role: user_role = "admin"
  • ✅ Confirm completion: task_status = "completed"

Not Equals (≠) - Different Values

Returns true when text values are different in any way.

Examples:

  • "hello" ≠ "world" → true
  • "same" ≠ "same" → false
  • "Test" ≠ "test" → true (case-sensitive)

Common Uses:

  • ⚠️ Detect changes: current_status ≠ previous_status
  • 🚫 Block guest users: username ≠ "guest"
  • 📝 Validate required fields: input_field ≠ ""

Includes - Substring Detection

Returns true when the left text contains the right text as a substring.

Perfect for Keyword Searching

Use includes to search for keywords within longer text like error messages, logs, or user input

Examples:

  • "hello world" includes "world" → true
  • "temperature alert" includes "temp" → true
  • "test" includes "testing" → false (left must contain right)

Common Uses:

  • 🔍 Find errors: error_log includes "timeout"
  • 📧 Email filtering: email_address includes "@company.com"
  • 🎯 Command parsing: voice_command includes "lights"

Practical Examples

🏠 Smart Home Examples

Door & Security

javascript
// Check if door is locked
door_status = "locked" → Turn off porch light

// Alert if door left open
door_status ≠ "closed" → Send notification

// Security monitoring
security_log includes "breach" → Trigger alarm

Temperature & Climate

javascript
// AC control
room_temp = "hot" → Turn on air conditioning

// Sensor errors
temp_reading includes "error" → Send maintenance alert

// Room occupancy
bedroom_status ≠ "occupied" → Reduce heating
🔧 System Monitoring Examples

Error Detection

javascript
// System health
system_status ≠ "healthy" → Send alert
error_message includes "critical" → Immediate notification

// Performance monitoring
response_time includes "slow" → Log performance issue

Device Management

javascript
// Connectivity checks
device_ping ≠ "success" → Mark device offline
connection_type = "ethernet" → Use high-speed settings

// Battery monitoring
battery_level includes "low" → Send low battery warning

Common Issues & Solutions

🔤 Case Sensitivity Problems

Most Common Issue

"Online" ≠ "online" - Case matters in all comparisons!

⚠️ Whitespace Issues

Hidden spaces cause comparison failures:

What You SeeActual ValueResult
"active""active "Won't match "active"
"online"" online"Won't match "online"

Solutions:

  • Be aware extra spaces break matches
  • Check for leading/trailing spaces in your data
  • Clean data at the source when possible
🔢 Text vs Numbers

Important

This block compares TEXT, not numbers! "10" vs "9" gives unexpected results

Quick Reference

When to Use Each Operator

OperatorUse WhenExample
Equals (=)Need exact matchstatus = "online"
Not Equals (≠)Need to detect differencerole ≠ "guest"
IncludesSearch within textmessage includes "error"
  • Number Compare - For numeric comparisons (>, <, >=, <=)
  • Logic AND/OR - Combine multiple text comparisons
  • IF/Then - Use comparison results to control flow

Fields

Op

Choose how to compare the two text inputs:

  • =: Exact match: Returns true only if both inputs are identical (e.g., 'online' = 'online' is true, but 'Online' = 'online' is false due to case sensitivity).
  • : Not equal: Returns true if the inputs are different in any way (e.g., useful for 'if status is not offline' or 'if username is not empty' conditions).
  • includes: Contains: Returns true if the first input contains the second input anywhere within it (e.g., 'sensor error timeout' includes 'error' would be true).

Inputs

A

Left text value to compare

Compatible Blocks (click to expand)
the Get Variable block

Get Variable

Retrieve the value stored in a variable that was previously set using a Set Variable block.

the Multiline Text block

Multiline Text

Create formatted text content with multiple lines, paragraphs, and line breaks.

the Text block

Text

Enter any text content for use in your Actions - words, phrases, device commands, or messages.

the Text Template block

Text Template

Create dynamic, personalized messages by combining static text with live data from your IoT system.

the Join Text block

Join Text

Join two pieces of text into one combined string.

the Text Compare block

Text Compare

Compare two text values using different comparison operations.

the Weather block

Weather

Fetch the current or forecast weather conditions at the specified location.

the Air Quality block

Air Quality

Fetch current or forecast air quality conditions at the specified location using Open-Meteo Air Quality API.

the Round/Floor/Ceiling block

Round/Floor/Ceiling

Convert decimal numbers to whole numbers using different rounding strategies.

the Number block

Number

Enter any numerical value for use in your IoT Actions - whole numbers, decimals, positive, or negative.

the Map block

Map

Transform sensor readings and data values by scaling them from one number range to another.

the Constrain block

Constrain

Keep any number within specified minimum and maximum boundaries.

the Compare Numbers block

Compare Numbers

Build mathematical conditions by comparing any two numerical values in your Action logic.

the Arithmetic block

Arithmetic

Perform mathematical calculations using sensor data, feed values, or any numbers in your Actions.

the Logic Operation block

Logic Operation

Combine multiple conditions to create sophisticated decision logic in your Actions.

the Negate block

Negate

Flip any condition to its opposite - turns true into false and false into true.

the Boolean block

Boolean

A simple true or false value for building logic conditions and controlling digital outputs.

the Get Feed Value block

Get Feed Value

Resolves to the last value of this feed or component, always a String.

the JSONPath Query block

JSONPath Query

Extract specific values from JSON data using JSONPath query syntax.

B

Right text value to compare

Compatible Blocks (click to expand)
the Get Variable block

Get Variable

Retrieve the value stored in a variable that was previously set using a Set Variable block.

the Multiline Text block

Multiline Text

Create formatted text content with multiple lines, paragraphs, and line breaks.

the Text block

Text

Enter any text content for use in your Actions - words, phrases, device commands, or messages.

the Text Template block

Text Template

Create dynamic, personalized messages by combining static text with live data from your IoT system.

the Join Text block

Join Text

Join two pieces of text into one combined string.

the Text Compare block

Text Compare

Compare two text values using different comparison operations.

the Weather block

Weather

Fetch the current or forecast weather conditions at the specified location.

the Air Quality block

Air Quality

Fetch current or forecast air quality conditions at the specified location using Open-Meteo Air Quality API.

the Round/Floor/Ceiling block

Round/Floor/Ceiling

Convert decimal numbers to whole numbers using different rounding strategies.

the Number block

Number

Enter any numerical value for use in your IoT Actions - whole numbers, decimals, positive, or negative.

the Map block

Map

Transform sensor readings and data values by scaling them from one number range to another.

the Constrain block

Constrain

Keep any number within specified minimum and maximum boundaries.

the Compare Numbers block

Compare Numbers

Build mathematical conditions by comparing any two numerical values in your Action logic.

the Arithmetic block

Arithmetic

Perform mathematical calculations using sensor data, feed values, or any numbers in your Actions.

the Logic Operation block

Logic Operation

Combine multiple conditions to create sophisticated decision logic in your Actions.

the Negate block

Negate

Flip any condition to its opposite - turns true into false and false into true.

the Boolean block

Boolean

A simple true or false value for building logic conditions and controlling digital outputs.

the Get Feed Value block

Get Feed Value

Resolves to the last value of this feed or component, always a String.

the JSONPath Query block

JSONPath Query

Extract specific values from JSON data using JSONPath query syntax.