This guide covers initial IoT Gateway installation and configuration. We will connect IoT Gateway to ThingsBoard server and visualize some basic gateway statistics: the amount of devices connected and messages processed. We will also configure MQTT and OPC-UA extension in order to subscribe to device data feed from external devices or applications.
If you don’t have access to a running ThingsBoard instance, use either Live Demo or Installation Guide to fix this.
In order to connect your IoT gateway to ThingsBoard server, you need to provision gateway credentials first. We will use access token credentials as the most simple one. See device authentication options for more details.
Login as tenant administrator. Use default credentials in case of local ThingsBoard server. Open Devices and click on big red “+” button in the bottom right corner.
Populate your gateway name and select “Is gateway” checkbox.
NOTE: Gateway and device names should be unique in the scope of a tenant.
Open your new device card and click on “Copy Access Token” button. Paste the token to a safe place. We will use it for ThingsBoard configuration in the next steps.
Browse available gateway installation options and choose the most suitable installation guide. Follow steps in chosen gateway installation guide. The Gateway configuration steps are covered below.
Navigate to the gateway configuration folder and edit tb-gateway.yaml file.
/etc/thingsboard-gateway/config/tb_gateway.yaml
Change host and port properties in the section “thingsboard” to your ThingsBoard host.
Change accessToken property in the section “security” to your access token that was copied during step 3.
You gateway configuration should look similar to this file:
thingsboard:
host: demo.thingsboard.io
port: 1883
security:
accessToken: FUH2Fonov6eajSHi0Zyw
storage:
type: memory
read_records_count: 10
max_records_count: 1000
connectors:
-
name: MQTT Broker Connector
type: mqtt
configuration: mqtt.json
You can read more in this article about configuration files and their properties.
This step depends on chosen type of installation. If you install thingsboard-gateway as daemon - you should use following command:
systemctl restart thingsboard-gateway.service
In other case, if you have installed the gateway as python module - you should just rerun gateway process.
Open the web UI of your ThingsBoard server and review statistics that is uploaded from your thingsboard gateway.
Login as Tenant Administrator and open Devices page. Click on the gateway device card.
Open “Latest Telemetry” tab and review following statistics: “SummaryReceived”, “SummarySent” and parameters that provide information about every connector.
All values should be set to “0”.
For connection to some devices we use connectors, they are connect to different devices and servers to collect data.
To provide for gateway information about connectors that you need - you should write a configuration to section “connectors” in tb_gateway.yaml (At least one connector needed for correct work).
For correct configuration please use this article.
After successful installation you should configure the connectors to connect to different devices, please use one (or more) following articles to configure connector files: