This emulator was designed for demonstration purposes to connect sample clients to Thingsboard via MQTT Sparkplug API.
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 istcp://demo.thingsboard.io:1883
;SPARKPLUG_CLIENT_GROUP_ID
- Sparkplug Group ID. Default value isSparkplug Group 1
;SPARKPLUG_CLIENT_NODE_ID
- Sparkplug Node ID. Default value isSparkplug Node 1
;SPARKPLUG_CLIENT_MQTT_CLIENT_ID
- Sparkplug MQTT Client ID. Default value isSparkplug Node 1
;SPARKPLUG_CLIENT_MQTT_USERNAME
- Sparkplug MQTT Client username. See authentication options;SPARKPLUG_CLIENT_MQTT_PASSWORD
- Sparkplug MQTT Client password. See MQTT basic credentials;SPARKPLUG_PUBLISH_INTERVAL
- Interval for publishing of the metrics, in milliseconds. Default value is10000
;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
Default Sparkplug metrics descriptor is located here.
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
mvn clean install
java -jar sparkplug-1.17-jar-with-dependencies.jar