Connecting MQTT Devices

This section describes how to integrate your Device via MQTT with KPN Things.

As a prerequisite to use MQTT with KPN Things, you need either a Device with a KPN Things SIM card which is configured to use the kpnthings2.m2m APN or a configured Internet device.

Integrating your device using MQTT is easy as it relies on standard publish and subscription methods. After ingestion, data will be processed and delivered using the KPN Things flow mechanism. Downlinks towards a device can be specified using the Portal or available API's.

This page deals with sending data into the Things processing engine. Read more about how to use MQTT to send data out of Things here.

Portal configuration

How to enable MQTT for a device

Login to the Things Portal:

  1. Find an M2M enabled Device (e.g. a type "Own M2M") in your Devices list. Open the Device details page by clicking on the Device.

  2. On the Device details page you will see a link in the top-right corner: "Activate MQTT service". Click the link.

  3. You should see a message "MQTT Service was successfully activated." and the MQTT tab will appear, showing the MQTT details.

  4. This is the only time you will be able to read (and copy) the generated password, so make sure you note it down. If you need to, you can edit the MQTT configuration to set a different (generated) password.

  5. Use the credentials to configure your Device and you are good to go!

Connecting your MQTT device to KPN Things

KPN Things provides an MQTT connector that can be used to publish uplinks from your MQTT device to the KPN Things platform and receive downlinks from the KPN Things platform. Note that the KPN Things MQTT connector is not a full MQTT broker. It can only be used to send uplinks to and receive downlinks from the KPN Things platform. Uplinks published by your device will not be visible to other devices that connect to the MQTT connector. Likewise, downlinks sent to your device will only be visible to your device.

The KPN Things MQTT connector supports MQTT 3.1, MQTT 3.1.1 and MQTT 5.0.

Connecting to the KPN Things MQTT connector

For M2M devices that use a KPN Things SIM card (using APN kpnthings2.m2m), the MQTT connector can be accessed using the MQTT protocol on 10.151.236.154 port 1883. Note that even though the MQTT protocol is unencrypted, your connection to KPN Things is secure because your device has a direct encrypted connection to KPN Things through the mobile network.

If your device does not use a KPN Things SIM card and you have configured it as an Internet device in KPN Things Portal, you can only access the MQTT connector using MQTTS on connect.mqtt.kpnthings.com port 8883.

For MQTTS to work correctly, many devices and/or MQTTS clients must be configured to trust KPN Things MQTT connector's server certificate (or rather the CA root certificate). Whether your device needs this extra configuration depends on the device or MQTT client used. Should you need it, you can download the CA root certificate from our certificate provider Sectigo (from the Root Certificates section). For convenience, you can also find the root certificate here.

When connecting to the MQTT connector, you must provide the username and password that were displayed in Things Portal when you activated MQTT for your device. The MQTT connector currently does not support authentication using client certificates.

To recap:

Device typeConnector addressProtocol

M2M using a KPN Things SIM card

10.151.236.154, port 1883

MQTT

Internet device

connect.mqtt.kpnthings.com, port 8883

MQTTS

KPN Things MQTT connector will ingest uplinks on any topic, so you're free to choose. The expected message format depends on the decoder you have configured for your device. The decoder for the "Own M2M" and "Own Internet" device types supports SenML, the internal format of the Things Platform. If you're using the decoder › Decoded ThingsML and raw SenML data, your message payload should be a valid SenML pack. For more information see the SenML documentation.

Things Manager

You can send a downlink to your MQTT device using the "Send instruction" tab on the device detail page in Things Portal.

API

Or you can use the Actuator API to send downlinks automagically.

The downlink will be published to the downlink topic and will be delivered to the MQTT device the next time the device connects and subscribes to the topic.

Last updated