# sparkplug-emulator **Repository Path**: jerrycell/sparkplug-emulator ## Basic Information - **Project Name**: sparkplug-emulator - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-25 - **Last Updated**: 2025-04-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Simple Sparkplug EoN node emulator This emulator was designed for demonstration purposes to connect sample clients to [Thingsboard](https://thingsboard.io) via [MQTT Sparkplug API](https://thingsboard.io/docs/reference/mqtt-sparkplug-api/). ## Running the emulator as docker container ```bash docker run -e SPARKPLUG_SERVER_URL='tcp://thingsboard.cloud:1883' -e SPARKPLUG_CLIENT_MQTT_USERNAME='YOUR_THINGSBOARD_DEVICE_TOKEN' thingsboard/tb-sparkplug-emulator:latest ``` See all available environment variables below: * SPARKPLUG_SERVER_URL - MQTT broker URL. Default value is tcp://demo.thingsboard.io:1883; * SPARKPLUG_CLIENT_GROUP_ID - Sparkplug Group ID. Default value is Sparkplug Group 1; * SPARKPLUG_CLIENT_NODE_ID - Sparkplug Node ID. Default value is Sparkplug Node 1; * SPARKPLUG_CLIENT_MQTT_CLIENT_ID - Sparkplug MQTT Client ID. Default value is Sparkplug Node 1; * SPARKPLUG_CLIENT_MQTT_USERNAME - Sparkplug MQTT Client username. See [authentication options](https://thingsboard.io/docs/user-guide/device-credentials/); * SPARKPLUG_CLIENT_MQTT_PASSWORD - Sparkplug MQTT Client password. See [MQTT basic credentials](https://thingsboard.io/docs/user-guide/basic-mqtt/); * SPARKPLUG_PUBLISH_INTERVAL - Interval for publishing of the metrics, in milliseconds. Default value is 10000; * SPARKPLUG_CLIENT_CONFIG_FILE_PATH - alternative path for the configuration file. No default value. Ignored if no value set; * SPARKPLUG_CLIENT_METRICS_FILE_PATH - alternative path for the metrics descriptor file. No default value. Ignored if no value set; You can find more information about this **SparkplugEmulation application** with **Thingsboard** [here](https://thingsboard.io/docs/reference/mqtt-sparkplug-api/) ### Metrics Default Sparkplug metrics descriptor is located [here](https://github.com/thingsboard/sparkplug-emulator/blob/main/src/main/resources/Metrics.json). You may notice simple JSON structure that describes device id and a list of metrics. Special node flag in the first JSON object defines metrics for the EoN Node itself. You may supply your own metrics file using environment variable SPARKPLUG_CLIENT_METRICS_FILE_PATH ### Building from sources ```shell mvn clean install ``` ### Running as plain java application ```shell java -jar sparkplug-1.17-jar-with-dependencies.jar ```