What you will learn
This tutorial will help you connect a virtual demo device to the Bosch IoT Suite.
The VirtualDemoDevice device comes with several features:
- a compass and a switch which help you understand how we ingest data from a device;
optionally you can also use the geolocation coordinates,
- an LED and a display which help you understand how you can communicate to the device,
- and software update simulation.
Once your device is registered with our cloud service, you can access its values at the Bosch IoT Suite Console as well as via API.
What you need to prepare
- This tutorial was explicitly designed in a way that it does not need a physical device.
- However, if you have a smartphone you can run the virtual demo device in a browser on the smart phone
- We recommend using the Mozilla Firefox browser for this tutorial.
- All services will run in the Bosch IoT Suite cloud environment. Thus, at this point we assume you have already a valid subscription.
Otherwise please proceed at How to subscribe to a Bosch IoT Suite service, and come back here to meet the demo device later.
- In case you try out the software update scenario, you will be asked to prepare a software distribution on your local machine. However this does not need to be an executable file. An empty text file in zip archive would suffice for the demo.
In this example, you will use the Bosch IoT Suite infrastructure and learn how to register a device, and access its values over the API.
Demo device > HTTP > Bosch IoT Hub > AMQP > Bosch IoT Things > HTTP > Bosch IoT Suite Console
For software updates, the data flow is directed to the device:
Demo device < HTTP < Bosch IoT Hub < AMQP < Bosch IoT Things < Bosch IoT Manager < Bosch IoT Rollouts
Tasks to complete
Register your demo device with the cloud service
Use the developer console to provision the device.
- Click Provisioning in the left sidebar.The Settings view will guide you with the required input for provisioning:
- From the first drop-down, choose Use Vorto information model.
- In the new view you will see all Vorto models available.
Select the row of the model VirtualDemoDevice (version 2.0.0).
- In the new view you will see details for the demo device.
Click Select to confirm this is the model for your demo device.
- Set thing/device ID: First, select a namespace.
In case you have not set up a namespace yet, see Register a namespace.
- Enter a unique name.
The full identifier that our Hub and Things service will register is “your.namespace:your-device-name”.
- Provide credentials for your device authentication.
Username and password are pre-selected.
- Enter a password in plain text.
- Confirm with Next.
As you might need other options when you will later provision a different type of device, keep in mind that each info (i) icon on the user interface will provide further help instructions to guide you into the right direction.
- The preview will indicate green markers if all entry values are valid.
- In case something went wrong, you can inspect the Request body.
- Proceed with Send request.
- The Connect device view will indicate your successful request:
- Further it presents useful links for setting up the device;
- Remember the password or store it safely, as you will never see it again in plain text in the console;
- The Go to thing button will open the thing details in the Things section.
Connect the demo device
Open the demo device in a new browser or on your cell phone.
The demo device is pre-configured with all the information a real device would need to present, in order to successfully connect to the Bosch IoT Suite.
The sensor values are reported to your cloud infrastructure in intervals of 5 seconds. In case you want to change the configuration feel free to do so.
Enter the password and click connect.
The geolocation feature is not active by default, as the idea is that you mobile send us its real location which will be stored in our service.
To increase awareness, as an “owner” of the device you need
- to actively express your consent – check the respective checkbox before connecting
- and also to “Allow Location Access” for the browser used.
In case you want to simulate more devices, don’t try to connect the same device via multiple browser windows simultaneously, but provision as many devices as needed instead.
Rotate your cell phone (or use the slider in the browser version) and check whether the changed feature was updated in its thing view.
Toggle the switch and check whether the changed feature was processed in its thing view.
Use the Bosch IoT Suite Console to send a message to the LED of the demo device and check the changed color.
E.g. setColor to red:
Use the Bosch IoT Suite Console to send a message to the Display of the demo device and check the displayed text.
E.g. setText to:
TEST the demo
Details: the subject is setText , message type is Text (select it from the drop-down), the Message payload is TEST the demo, and the feature capable to process such a message is the display.
A closer look on the Vorto model > function block would reveal the magic behind.
- setColor() operation on thing or LED feature is handled by
- setText() operation is handled by
Messages section on device
The messages section shows the latest messages for the device-to-Hub communication, which is best suited for debugging this specific part of the connection.
Once the changes are reported back to the thing, a log can be activated in the Connections UI for further tracing, e.g. info if it could be consumed and forwarded to other applications listening for changes.