# FLASK Modbus Gateway

> Tested Flask + pymodbus 3.12 gateway template that turns a PLC register map into a web HMI and REST API, with a PLC-simulating smoke test and field-tested fixes.

FLASK Modbus Gateway is a paid AI agent skill on Agensi by Carlano Technology Solutions, in Workflow Automation. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $10 (one-time purchase)
- Creator: [Carlano Technology Solutions](https://www.agensi.io/creators/carlano-technology-solutions)
- Category: [Workflow Automation](https://www.agensi.io/skills/workflow-automation)
- Version: 1.0
- Last updated: 2026-11-25
- Security: scan passed (2026-11-25); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/flask-modbus-gateway
- Tags: automation, api, web-design, modbus, plc, flask, pymodbus, hmi

## About this skill

Industrial automation often fails when browser-based HMIs and PLCs try to talk. This skill provides a hardened Flask and pymodbus 3.12 gateway template to bridge web interfaces with PLC hardware via Modbus TCP.

### What it does
- **PLC-to-Web Bridge** builds a Python Modbus server that allows a PLC client to exchange data with a browser GUI.
- **REST API Generation** creates endpoints automatically from your signal list for external data access.
- **Automated Smoke Testing** validates the entire stack including table addresses and unit ID logic without needing hardware.
- **Signal Management** centralizes all Modbus registers in a single configuration file to prevent mapping drift.
- **HMI Scaffolding** delivers a frontend with built-in connection status monitoring for both the web and PLC links.

### How it works
1. **Define signals** in `points.py` by specifying names, data types, and whether the PLC or GUI owns the value.
2. **Deploy the template** to a project folder, which includes the Flask app, pymodbus server, and static assets.
3. **Run the validator** using a CLI command to ensure the Modbus register map is internally consistent.
4. **Execute the smoke test** to simulate a PLC client and verify all 26 internal checks pass.
5. **Launch the gateway** and configure your PLC client using the provided IP and port settings.

### Frameworks & tools
The template uses Python 3.12 or 3.13, Flask for the web layer, and is pinned strictly to `pymodbus==3.12.0`. It is designed for Linux or macOS environments requiring standard Modbus TCP port 502 access.

### Why this beats prompting it yourself
Writing Modbus code from scratch often leads to off-by-one errors in `ModbusSequentialDataBlock` and silent failures in the pymodbus 3.x API. This skill enforces 10 specific rules, such as bit-array reading and strict JSON type checking, that prevent common industrial communication crashes.

### Use cases
- Creating a tablet-based operator panel for a Beckhoff TwinCAT system.
- Bridging Modbus TCP data to a RESTful monitoring service.
- Debugging PLC client communication before shipping hardware to the site.
- Building a lightweight HMI for 16-bit register and coil monitoring.

### Known limitations
Does not support serial RTU, 32-bit floats, or multiple PLC clients. There is no built-in authentication or data logging, and it is intended for use on trusted local networks only.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the FLASK Modbus Gateway skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific industrial automation problem does this gateway solve?

This skill provides a pre-configured Flask and pymodbus 3.12 template that eliminates common 'off-by-one' register errors and communication crashes, allowing you to bridge PLC hardware to web-based HMIs instantly.

### What are the system requirements and compatible AI agents for this skill?

The template is designed for any Python-capable AI agent and requires a Linux or macOS environment running Python 3.12 or 3.13 with access to Modbus TCP port 502.

### What exactly is included in the 'flask modbus gateway' package?

You receive the complete Flask application structure, the pymodbus server configuration, a CLI validator for register mapping, and a suite of 26 automated smoke tests to verify your setup without physical hardware.

### Are there any limitations regarding data types or communication protocols?

While the gateway is optimized for 16-bit registers and coils, it does not currently support 32-bit floats, serial RTU connections, or multiple simultaneous PLC clients.

### How difficult is it to set up the mapping between my PLC and the web interface?

Setup is a 5-step process: define your signals in a central config file, deploy the template, run the internal validator, execute the smoke tests, and launch the gateway.

### Is this gateway secure for use on public-facing networks?

This skill is intended for use on trusted local networks, as it does not include built-in authentication or data logging, prioritizing low-latency communication between the PLC and the HMI.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
