Senseforce 2.0 Manual
  • Welcome to Senseforce 2.0
  • SF MQTT API
  • SF Edge
    • Edge Package Overview
    • Edge Installation
      • Using the SF Edge Service installer in command shell
      • Headless SF Edge Servie execution
    • Edge Configuration
      • Which Plugins to load (appsettings.xml)
      • Edge Data Routing (EventDefinition.xml)
      • OTA configuration (otasettings.xml)
      • Edge Logging
      • Input plugins
        • SQL Plugin
        • SQLite Plugin
        • OPC UA Plugin
          • OPC UA server browser
        • SIEMENS S7/SINUMERIK Plugin
          • Creating connection definition file
        • S7 Plugin
        • REST Plugin
        • TCP Listener Plugin
        • XML File Parsing Plugin
        • Heidenhain Plugin
      • Output Plugins
        • MQTT Plugin
        • SQLite Plugin
    • Edge Compute plugins
      • Creating compute plugins
      • Using compute plugins
  • SF Edge Asset Management
    • Edge version repository
  • SF Platform
    • Navigation
      • Overview Screen
    • Dataset Builder
      • Filters, Aggregations and Groupings
      • Functions of the Formula Editor
      • Additional Settings
      • Special Events
      • FAQ and Troubleshooting
    • Script Editor
      • Details of the Script Editor
      • Installed Packages
      • Working with Timestamps
        • Working with Timestamps in Python
        • Working with Timestamps in R
      • FAQ and Troubleshooting
    • Widgets
      • Text
      • Headline
      • Image
      • Progress Bar & Gauge Chart
      • Table
      • Map
      • Line, Bar, Scatter and Area Chart
      • Pie Chart
      • Gantt Chart
      • Histogram
      • Overview
      • Log
      • Default colors and color conditions
      • FAQ and Troubleshooting
    • Dashboards
      • Dashboard Filters
      • Favorites
      • Data Drilldown & Widget Interaction
      • Editing multiple dashboard widgets
      • Time Zones
      • Synchronized Zooming
      • Sharable Dashboard URL
      • Multi-chart layout options
      • Default sort for table widgets
      • Releases
      • Reporting
      • FAQ and Troubleshooting
      • Applying zoom to global timestamp filter
      • Optimise the layout for different devices
    • Machine Master Data
      • Dimensions
      • Instances
      • Things
      • Use Case
      • FAQ and Troubleshooting
    • Automation
      • Trigger
      • Scheduling overview
      • Actions
      • Test your Automation
      • Zapier integration (necessary internal steps)
      • Zapier integration
      • Subscriptions
      • FAQ and Troubleshooting
    • Event Schema Management
      • Importing a Event Schema
      • FAQ and Troubleshooting
    • Virtual Events
      • Creating a Virtual Event
      • Scheduling Overview
      • Permissions and Data Access
      • FAQ and Troubleshooting
    • Details modal for elements
    • Copy / Duplicate elements
    • Whitelabeling
    • Edge Device Management
    • Element History
    • Public API
      • Get your access token
      • Endpoints
      • Debugging scripts
      • FAQ and Troubleshooting
    • User & Group Management
      • FAQ and Troubleshooting
    • Active Directory & SSO Setup
Powered by GitBook
On this page
  • API Endpoint Structure
  • 1. Topic
  • 2. Payload
  • MQTT client
  • Example of sending data
  • Frequently encountered problems

Was this helpful?

SF MQTT API

Sometimes you need to send data without going through the SF Edge. This thing is possible by using the SF MQTT API Endpoint.

API Endpoint Structure

1. Topic

You can set different information at this level like 'tenant', 'thing' or 'compression-type' (separated by the '/').

Example: senseforce/crane1/lz4 senseforce=Tenant crane=Thing lz4 = Compression-Type

2. Payload

The payload is JSON-type data where you can set the events you want to be stored in the database. Example of a payload:

{
	"events": [
		{
			"id": "8a4c6063-91ce-441e-a41a-eff33f6f5d66",
			"timestamp": 1656597003349, //timestamp in miliseconds
			"type": "mqttfx_example",
			"data": {
				"temperature": "35"
			}
		}
	]
}

'events' - the array of the events [ { 'id' - id of the event 'timestamp' - timestamp of the event --> milliseconds 'type' - schema key created in the platform 'data' - contains the non-metadata columns from the event, the custom-created ones {'temperature' - custom attribute/column of the event schema} }, {...}, {...} ]

As a recommendation is better to "combine" several messages into one "events", rather than sending individual messages very often.

MQTT client

In order to be able to use the API, you have to set up a Message Queuing Telemetry Transport (MQTT) client. This client will connect to the SF MQTT Broker and then you can send data to the platform.

Once the connection is established you can send data to the platform.

Example of sending data

Before sending data to the platform, you need to have an event schema set up so the data can be stored. We will consider for this example the following event schema(published):

Using MQTTfx tool we can send data to the platform as described above:

Then you can check in the platform in the dataset editor if the data for your schema was inserted:

Frequently encountered problems

Timestamp format

The timestamp should be converted in UNIX time in milliseconds

Wrong usage of the Data property

The custom-created attributes at the event schema level will be set under the 'Data' property of the event item.

Connect an MQTT client without a certificate

This would be possible only if the certificate validation is disabled on the customer side. Synchronize with the Senseforce team.

PreviousWelcome to Senseforce 2.0NextSF Edge

Last updated 1 year ago

Was this helpful?

An example of such a tool is 'MQTTfx' which we will use in our example but of course, you can use any client you want. After following the installation steps from the client website (), you need to make sure you have the proper connection information set like: - Broker Address and Port - User Credentials - Certificate File (please contact Senseforce team related to this)

https://mqttfx.jensd.de/