Crates.io | kbus_mqtt_bridge |
lib.rs | kbus_mqtt_bridge |
version | 0.1.0 |
created_at | 2025-03-31 01:14:46.253879+00 |
updated_at | 2025-03-31 01:14:46.253879+00 |
description | A bridge between WAGO PFC's K-Bus and MQTT for industrial automation systems, facilitating communication between PLC digital I/O and MQTT brokers |
homepage | |
repository | https://github.com/ldanko/kbus_mqtt_bridge |
max_upload_size | |
id | 1612924 |
size | 98,111 |
A bridge application that connects WAGO PFC200's K-Bus I/O modules with MQTT for industrial and smart home automation systems. This enables bidirectional communication between PLC digital I/O and MQTT brokers, facilitating IoT integration for both industrial control systems and smart building automation.
# Clone the repository
git clone https://github.com/ldanko/kbus_mqtt_bridge.git
cd kbus_mqtt_bridge
# Set up the development environment
export PTXPROJ_PATH=/path/to/wago/pfc-firmware-sdk-G2/ptxproj
.cargo/config.toml
[target.armv7-unknown-linux-gnueabihf]
linker = "/path/to/arm-linux-gnueabihf-gcc"
[extra-link-arg]
sysroot="/path/to/ptxproj/platform-wago-pfcXXX/sysroot-target"
cargo build --target=armv7-unknown-linux-gnueabihf --release
The application can be configured using:
The application uses a TOML configuration file. By default, it looks for:
KBUS_BRIDGE_CONFIG_FILE
environment variableconfig.toml
Example# Device name used in MQTT topics
device_name = "pfc200_controller"
# MQTT broker connection settings
[mqtt]
broker_host = "mqtt.example.com"
broker_port = 1883
keepalive = "300s" # Human-readable duration format
heartbeat_interval = "60s" # Human-readable duration format
You can override any configuration value using environment variables:
Environment Variable | Description | Default Value |
---|---|---|
KBUS_BRIDGE_DEVICE_NAME |
Device name for MQTT topics | "kbus_mqtt_bridge" |
KBUS_BRIDGE_MQTT_HOST |
MQTT broker hostname or IP address | "localhost" |
KBUS_BRIDGE_MQTT_PORT |
MQTT broker port | 1883 |
KBUS_BRIDGE_MQTT_KEEPALIVE |
Connection keepalive in seconds | 300 (5 minutes) |
KBUS_BRIDGE_MQTT_HEARTBEAT_INTERVAL |
Heartbeat interval in seconds (0 to disable) | 60 (1 minute) |
KBUS_BRIDGE_CONFIG_FILE |
Path to config file (if not provided as argument) | None |
The application validates all configuration values:
/
, +
, #
)This project is licensed under the MIT License - see the LICENSE file for details.