IoT Plugin Configuration
Overview
The IoT plugin is the bridge between the Alemca Agent and physical equipment—sensors, actuators, PLCs, gateways, and more.
It handles the following:
Function | Description | Opinion |
---|---|---|
Acquisition | Regular reading of field registers/frames | Run it at the cadence dictated by your business requirements; triggering “every second” never saved a project. |
Automation | Execution of embedded Lua scripts | Lua is the right choice: lightweight and easy to sandbox. Avoid shell scripts in this context. |
Remote control | Launch of commands pushed from the central console | Limit the number of concurrent scripts; embedded devices dislike fork bombs. |
Data publishing | Push to the platform via AMQP (RabbitMQ) | Enable caching—industrial networks fail more often than we like to admit. |
Typical Use Cases
- Continuous telemetry: collect temperature, pressure, and I/O states every 30 s and feed them almost in real-time to SCADA.
- Conditional command: trigger a relay output via Lua if the temperature > 50 °C and an operator has approved the procedure in the UI.
- Preventive maintenance: inject a remote Lua script that measures cycle times and alerts if drift > 5 %.
Configuration Details
/etc/alemca/config.yaml
iot:
enabled: true # Fully enable/disable the plugin
lua: # Embedded automation
path: "/etc/alemca/agent.lua" # Main script
trigger: 5 # Execution period in seconds
timeout: 0 # 0 = no limit
kill_on_trigger: false # true = kill previous instance if it is still running
commands: # Remote scripts pushed via the UI
max_concurrent: 1 # Maximum number of concurrent remote scripts
folder_path: "/etc/alemca/commands"
alemca: # AMQP link to the central platform
max_cache_size: 1024 # Max messages queued if the network is down
stay_connected: false # true = permanent AMQP socket (consumes a file descriptor)
destinations:
- name: "example_destination"
exchange: "example_exchange"
routing_key: "example_routing_key"
queue_not_durable: false
exchange_type: "direct"
modules:
modbus:
- name: "modbus1"
transmissionmode: "TCP"
controller: "tcp://127.0.0.1:502"
slaveid: 1
ping:
- name: "ping1"
timeout: 10
count: 5
Section Breakdown
- enabled – Toggles the IoT plugin on or off.
lua (legacy)
- path – Path to the locally executed Lua script.
- trigger – Interval (seconds) between two executions.
- timeout – Maximum runtime (0 = unlimited).
- kill_on_trigger – If
true
, interrupts the previous script when a new one starts.
lua_scripts
- name – Lua script name.
- path – Path to the script executed locally.
- trigger – Interval (seconds) between two executions.
- timeout – Maximum runtime (0 = unlimited).
- kill_on_trigger – If
true
, interrupts the previous script when a new one starts.
commands
- max_concurrent – Maximum number of remote Lua scripts that can run in parallel.
- folder_path – Folder where queued command scripts are stored.
alemca
- max_cache_size – Maximum local cache size before sending.
- stay_connected – If enabled, the connection stays open permanently.
- destinations – AMQP connection parameters (name, exchange, routing key, exchange type, etc.).
modules
This section configures the modules available from Lua. Settings are module-specific and are documented in each module’s guide.
See here for a list of available modules.