Skip to content

thingsboard/sparkplug-emulator

Repository files navigation

Simple Sparkplug EoN node emulator

This emulator was designed for demonstration purposes to connect sample clients to Thingsboard via MQTT Sparkplug API.

Running the emulator as docker container

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;
  • 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 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

Metrics

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

Building from sources

mvn clean install

Running as plain java application

java -jar sparkplug-1.17-jar-with-dependencies.jar

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published