The Easy Setup for adding sensors is intended to provide you with an intuitive and easy experience which will lead you through the setup steps in adding the sensors.
The Easy Setup contains 3 basic steps. Follow the sections in this article:
- Generate a Sensor Script
- Enable the Sensor Script on the Edge Device
- Assign the Sensor Script to the Edge Device
The generated Sensor Script is a template.
The Sensor Script prints metric values of a sensor in JSON format and each metric is described as a variable which gets a random value in between 1 and 20.
If you don’t have a ready script, you might need to search for tutorials on how to read your sensor data, find a library or script that works with your sensor and make sure that your script’s output prints the JSON formatted example as presented in the template.
Then place the ready script on the edge device and provide the full path information into the configuration page.
There are thousands of different sensors in the world. Some of them would need special libraries or custom development to get a data from. If you have trouble with the setup of sensors, contact TeamViewer.
What you will need
Make sure that you have prepared the following points:
- Your TeamViewer credentials.
- The edge device is set up with a TeamViewer IoT Agent and TeamViewer Edge Management is enabled.
- Access the Edge Device via Remote Terminal.
- File Transfer is enabled (see Enable File Transfer).
- A Sensor is connected to the device.
- The edge device is connected to the internet.
Generate a Sensor Script
- To log in to the IoT Management Console, open https://teamviewer-iot.com and use your TeamViewer account credentials.
- From the left menu select Devices.
- On the right side from the dropdown menu select Add Sensor.
- Click Easy Setup.
- From the dropdown menu select the device with the sensor you would like to add.
- Type in a unique sensor name.
- Click to add a metric. To configure the metric provide a metric name and an unique ID. The fields Value Type and Value Unit are optional. (When a metric becomes superfluous click to remove it.)
- When all metrics are configured click Download the generated Template.
The downloaded zip-file contains template examples for Python and Bash.
- On your local PC extract the zip-file.
- Pick one of the extracted files as your Sensor Script.
Keep the Management Console open and continue with Enable the Sensor Script on the Edge Device.
Enable the Sensor Script on the Edge Device
In this task you’ll need to transfer the previously downloaded Sensor Script to the Edge Device. Then you’ll give the Sensor Script fitting permissions to be executed.
- Transfer the Sensor Script to your Edge Device by using the Transfer Files feature. Remember the full path (
FULLPATH) of the Sensor Script on the Edge Device.
- Access the edge device remotely (Access the Edge Device via Remote Terminal).
- Give the Sensor Script fitting permissions. In the terminal type in the following command and press return. Replace
FULLPATHwith the full path from the previous step.
sudo chmod +x FULLPATH
Assign the Sensor Script to the Edge Device
After you enabled the Sensor Script on the Edge Device you’ll need to continue where you left off from Generate a Sensor Script.
- Type in the
FULLPATHyou remembered from Enable the Sensor Script on the Edge Device.
- Select the frequency by which the data will be sent to the TeamViewer IoT Cloud. It can be defined in seconds or minutes.
- To finish the Easy Setup click Add.