Build IIoT Solutions Without Memorizing a Single Command
You don’t need to be a LoT (Language of Things) expert to build industrial IoT solutions with Coreflux. With an AI assistant connected to the Coreflux MCP, you describe what you want in plain English, and the AI writes the LoT code for you — correctly, following best practices, using real syntax from the official documentation. This page walks you through the entire workflow: from setting up the MCP connection to deploying a working IIoT feature, using only natural language prompts. Whether you’re monitoring factory temperatures, logging production data to a database, or bridging sensor networks to the cloud — the process is the same.When to Use This Guide
- You’re new to Coreflux and want to build something real without learning LoT syntax first
- You have an AI coding assistant (Cursor, Claude, Copilot) and want to use it effectively for IIoT
- You want a step-by-step walkthrough of the AI-assisted development workflow
- You’re exploring whether Coreflux fits your industrial automation or IoT data pipeline needs
In This Page
- Prerequisites — What you need before starting
- The AI-Assisted Workflow — The three-phase approach to building with AI
- Phase 1: Plan Your Feature — Describe what you want to build
- Phase 2: Build with AI — Guided demo building a temperature monitoring system
- Phase 3: Verify and Iterate — Test, refine, and expand
- Prompt Patterns That Work — Effective ways to communicate with AI
- Common Pitfalls — Mistakes to avoid
- Next Steps
Prerequisites
Before starting, make sure you have:| Requirement | Details |
|---|---|
| Coreflux Broker | Installed and running. See the Installation Guide |
| AI Assistant with MCP | Cursor, Claude Desktop, Claude.ai, or VS Code with Copilot — connected to the Coreflux MCP |
| MQTT Client | MQTT Explorer or any MQTT client for verifying results |
If you haven’t connected the Coreflux MCP to your AI assistant yet, follow the MCP Setup Guide first. It takes under 5 minutes.
The AI-Assisted Workflow
Every AI-assisted Coreflux project follows three phases. This isn’t a suggestion — it’s the workflow that consistently produces working results.| Phase | You Do | The AI Does |
|---|---|---|
| 1. Plan | Describe the feature in plain English | Asks clarifying questions, proposes an architecture |
| 2. Build | Review and approve the AI’s output | Writes LoT code using the MCP for accurate syntax |
| 3. Verify | Test the result in MQTT Explorer | Explains what to check and helps debug issues |
Phase 1: Plan Your Feature
The most important step happens before any code is written. A clear plan gives the AI the context it needs to produce working LoT code on the first try.Describe Your Goal, Not Your Code
Tell the AI what you want to achieve, not how to write it. Let it choose the right LoT building blocks.- Good Prompt
- Bad Prompt
A clear, goal-oriented description that gives the AI enough context to make architectural decisions:
The Planning Checklist
Before you prompt your AI assistant, gather answers to these questions. You don’t need to answer all of them — but the more you provide, the better the result.| Question | Why It Matters | Example Answer |
|---|---|---|
| What data comes in? | Defines the trigger topics and payload format | sensors/+/reading with JSON {"value": 23.5} |
| What should happen to it? | Determines which LoT building blocks to use | Transform, alert, store, forward |
| Where should results go? | Defines output topics, databases, or external systems | PostgreSQL table, alert topic, cloud broker |
| What are the thresholds or rules? | Sets up conditionals in Actions | Alert when temp > 75°C |
| How many sensors/devices? | Affects topic structure and wildcard usage | 50 sensors, each with a unique ID |
Ask the AI to Propose an Architecture
Once you’ve described your goal, ask the AI to plan before coding. This avoids wasted iteration.“For this system, I recommend:Review this before saying “go ahead.” It’s much easier to adjust a plan than to rewrite code.Topic structure:
- An Action to monitor temperatures and trigger alerts
- A Model to structure sensor readings into consistent JSON
- A Route to store readings in PostgreSQL
- A callable Action for the Celsius-to-Fahrenheit conversion (reusable)
sensors/+/reading(input),processed/+/fahrenheit(converted),alerts/temperature/+(alerts)”
Phase 2: Build with AI
Now let’s walk through a complete guided demo. We’ll build a temperature monitoring system that reads sensor data, converts units, triggers alerts, and logs to a database — all by prompting the AI.Step 1: Create the Core Logic (Actions)
Start with the Action that processes incoming data. Paste this prompt into your AI assistant:The AI uses the MCP’s
consult_documentation and consult_internal_documentation tools behind the scenes to look up correct syntax. You don’t need to tell it to use the MCP — it does this automatically when it detects a Coreflux-related question.Step 2: Add Unit Conversion (Callable Action)
Now ask the AI to add a reusable conversion utility:Step 3: Structure the Data (Model)
Ask the AI to create a Model that formats raw sensor readings into consistent JSON:Step 4: Connect to a Database (Route)
Now bring in a Route to persist the data. Ask the AI:Step 5: Deploy Everything
Ask the AI how to deploy your code:- VS Code (LoT Notebooks)
- MQTT Client
The recommended way to deploy LoT code is through the LoT Notebooks extension in VS Code or Cursor.
Create a Notebook
Create a new
.lotnb file in your project. Each cell can contain one or more LoT definitions.Add Your Code
Paste each definition into its own cell — this lets you deploy and test them individually.
Run Each Cell
Execute cells in order. The extension sends the LoT code to your connected Coreflux broker.
Phase 3: Verify and Iterate
After deploying, test the system by publishing a simulated sensor reading.Test Your System
Open MQTT Explorer (or any MQTT client) and follow these steps:Check the Results
You should see messages appear on these topics:
| Topic | Expected Value | Source |
|---|---|---|
processed/temp001 | 82.3 | ProcessTemperature Action |
processed/temp001/fahrenheit | 180.14 | ConvertToFahrenheit callable |
alerts/temperature/temp001 | HIGH TEMP: 82.3°C | Alert threshold exceeded |
When Something Doesn’t Work
If the output isn’t what you expect, describe the problem to the AI:Prompt Patterns That Work
After building dozens of IIoT features with AI, these prompt patterns consistently produce the best results.Pattern 1: Context → Goal → Constraints
Provide the situation, then state what you want, then add any constraints:Pattern 2: Ask for Explanation Before Code
When learning, ask the AI to explain its choices:Pattern 3: Incremental Building
Build complex systems one piece at a time rather than all at once:Pattern 4: Reference the MCP Explicitly
When you need maximum accuracy, tell the AI to consult the documentation:consult_documentation or consult_internal_documentation through the MCP, ensuring the answer uses real, verified syntax.
Common Pitfalls
These mistakes happen frequently when developers start using AI for LoT development. Knowing them upfront saves hours of debugging.| Pitfall | Why It Happens | How to Avoid It |
|---|---|---|
| Vague prompts | AI fills in gaps with assumptions that may not match your system | Always specify topic structure, payload format, and thresholds |
| Skipping the plan | Jumping straight to “write me an Action” without context | Ask the AI to propose an architecture before writing code |
| Not verifying output | Trusting AI code without testing it | Always deploy and test with a sample payload in MQTT Explorer |
| Prompting without MCP | The AI invents plausible-looking but incorrect LoT syntax | Ensure the Coreflux MCP is connected — check your MCP settings |
| Building everything at once | One massive prompt produces code that’s hard to debug | Build incrementally: one Action, one Model, one Route at a time |
| Ignoring type casting | Numeric operations fail silently without AS DOUBLE or AS INT | Ask the AI to always include type casts — or review the Best Practices |
Expanding Your System
Once the basic monitoring system works, you can extend it with a single prompt each. Here are natural next steps:| Feature | Example Prompt |
|---|---|
| Email alerts | ”Add a LoT email route that sends an email when alerts/temperature/+ receives a message” |
| Cloud sync | ”Create an MQTT bridge route that forwards all processed/ topics to a cloud broker at cloud.example.com” |
| Industrial protocol | ”Create a Modbus TCP route to read holding registers 0-10 from a PLC at 192.168.1.50 every 5 seconds” |
| Access control | ”Create a LoT Rule that only allows admin users to publish to config/ topics” |
| Data aggregation | ”Create an Action that calculates a 5-minute rolling average of temperature readings” |

