Bosch IoT Asset Communication

Reflect device connectivity status in thing

The device connectivity status is derived from the Bosch IoT Hub headers.

Activate the feature

At the Things dashboard > Connections/Integrations tab you get an overview of the connections configured for your service instance so far.

If you want to reflect the device connectivity status - which can be derived from header information of devices connected via Bosch IoT Hub - in your things, proceed as follows:

  • Select your connection - Devices via Bosch IoT Hub

  • Click Edit

  • At section Reflect device connectivity status in thing, check the box to Enable persisting the connection status of the device reported by Bosch IoT Hub at the thing

  • Click Save to close the dialog

images/confluence/download/attachments/1303498604/device-connectivity-status.png

By activating this checkbox, the Things service will create and update a new feature for all things using this connection.

The feature is named by default ConnectionStatus.

Property name

Type

Description

readySince

string

Timestamp when the device or the connectivity endpoint signals that the device is connected
and stays connected at least for some time, and is ready for receiving information

readyUntil

string

Timestamp until when device or the connectivity endpoint signals that it stays ready for receiving information;
if it signals that it stays connected and is ready until further notice,
then this timestamp is symbolically set to a timestamp that is at least 1 year ahead of now.

The device connectivity status is derived from the Bosch IoT Hub headers creation-time - for readySince - and ttd (time ‘til disconnect) - for readyUntil.

When activated, a feature named ConnectionStatus will be automatically created and updated.
The device connectivity status is updated whenever the device signals its readiness to receive information.
Note: it is not sufficient to send telemetry or events from a device to update the connectivity status, instead the device must actively register a subscriber.

Examples:

Display the values in a dashboard

You can display such values in your business application, by offering the properties of the ConnectionStatus feature in a human readable format.

This example shows how the Developer Console offers the date of a device which is connected.

images/confluence/download/attachments/1303498604/connection-status.png

Get notified about short connection periods

If your device is capable of receiving commands only for a short period (e.g. when communicating with the Bosch IoT Hub via HTTP), the readySince and readyUntil values will probably be very close together.

In case you need to send a command to the device during that short time interval, you should subscribe to events e.g. defining a filter which matches changes to the ConnectionStatus: exists(features/ConnectionStatus)
Whenever your application gets notified about such a change, it can determine whether a device is now connected and able to receive commands.

Long connection periods

In case your device communicates via MQTT and gives the signal to be ready for retrieving messages, the readySince value is set to the current time, when the Things service received the event or telemetry, and the readyUntil value is set to a distant future date: 9999-12-31T23:59:59Z.

Disconnected device

Once such a device disconnects or loses its connection, the readyUntil value will be set to the date when the disconnection happened. So, you will be able to see when the device was last connected.

The Developer Console would display such a device like in the next screenshot.

images/confluence/download/attachments/1303498604/device-connectivity-lost.png