Basic
Kelvin MQTT Connector
This application demonstrates how to use the Kelvin SDK to detect events above a pre-defined threshold in streaming data and emit a Control Change or Recommendation.
This example also leverages Dynamic/Runtime Asset Parameters.
Code
The full code is hosted in the Kelvin App Samples repository on GitHub here.
Repository contents
- README.md (present, short): contains a short description, requirements, and two usage lines.
- main.py: the application entrypoint and core logic (event detection loop, integration with Kelvin SDK, emission of actions).
- requirements.txt: Python dependencies.
- Dockerfile: used to build a Docker image for deployment.
- .dockerignore: used to exclude files from Docker builds.
- app.yaml: application manifest/config for deploying to a Kelvin Instance (or similar).
- csv/ (directory):
- CSV data for testing the locally Application.
- CSV data for adding the Assets and Data Streams using the bulk create feature in the Kelvin UI
- CSV data for the Connection Data using the CSV Publisher Connection
- ui_schemas/ (directory): Definition file for the parameters to be displayed in the Kelvin UI.
Basic Code Explanation
The Application subscribes to streaming data from a Connection (or other course), applies a threshold-based detection rule on incoming samples, and when an event is detected it emits a Control Change embedded in a Recommendation using the Kelvin SDK.