立即试用 商务报价
社区版
Gas Shutoff Valve LoRaWAN “Smartico V-LR” telemetry upload

本页目录

Gas Shutoff Valve LoRaWAN “Smartico V-LR” telemetry upload

Gas Shutoff Valve LoRaWAN “Smartico V-LR” telemetry upload

Introduction

The Gas Shutoff Valve LoRaWAN “Smartico V-LR” was designed for remotely shut off the gas supply in the low pressure gas network. The shut-off valve was made with autonomous power supply. It has a special valve activation mechanism that allows safe recovery of gas supply. Places of installation of protective seals are provided to prevent unauthorized access to the power source and exclude the possibility of dismantling the valve from the connecting gas pipeline. The figure shows a dashboard with processed telemetry results.

image

Prerequisites

LoRaWAN technology is used to transfer data from the Gas Valve V-LR to the ThingsBoard platform. This is the wireless communication technology that allows small amounts of data to be exchanged over a long distance. First of all, you need to configure the LoRaWAN server and make sure that data from the device goes to the server. This guide uses ChirpStack open-source LoRaWAN Network Server. After finishing the server configuration on the Applications page, an entry with the device type should appear in the table.

image

For example, we connected a device with the serial number 0000129. With the correct configuration of the LoRaWAN server, we should see the data flow from the device on the “DEVICE DATA” page. The frequency of data transmission from the device depends on the Gas Valve settings.

image

To be able to receive data via the MQTT protocol, you need to integrate the LoRaWAN server and the Mosquitto MQTT broker.

First, you should create the Uplink Data Converter according to the device protocol. The converter will decode incoming telemetry payload data from Gas Shutoff Valve LoRaWAN “Smartico V-LR” that contains in encoded Base64 string to human readable, simplified ThingsBoard data format. Import uplink_gas_valve.json file with Uplink data converter .

image

Step 2. Integration configuration.

To integrate Gas Shutoff Valve LoRaWAN “Smartico V-LR” into ThingsBoard platform you should create a new integration as shown on the figure.

image

Also below you should add the topic filter according to LoRaWAN server configuration (in this example application/6/device/+/rx). In the Host and Port fields, enter the ip-address where the MQTT broker is installed and port for working with it.

Step 3. Verifying the receipt of data from the device.

Connect Gas Valve V-LR to transfer information. If the integration was performed without errors, after the transmission of the first telemetry, a new device with the name “0000129” will appear in the DEVICE GROUPS → All. Also you can verify the input and output data, respectively, before and after conversion in DATA CONVERTERS → Uplink Gas Valve → EVENTS.

image

Input data from Gas Valve looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
    "applicationID": "6",
    "applicationName": "Smartico_gaz_valves",
    "deviceName": "VALVE_0000129",
    "devEUI": "02aaaa0100000081",
    "rxInfo": [{
        "gatewayID": "647fdafffe00d228",
        "uplinkID": "bebb9711-3fe0-4ddd-ad16-9815af9c0f42",
        "name": "tectelic_micro_lite_TECH",
        "rssi": -72,
        "loRaSNR": 9.8,
        "location": {
            "latitude": 48.44229794818326,
            "longitude": 35.014479160308845,
            "altitude": 144
        }
    }],
    "txInfo": {
        "frequency": 868100000,
        "dr": 0
    },
    "adr": true,
    "fCnt": 12,
    "fPort": 2,
    "data": "BkABAACB"
}

The payload is contained in the “data” field and encrypted in Base64. After decoding output data will look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
    "deviceName": "0000129",
    "deviceType": "Gas Valve",
    "attributes": {
        "integrationName": "Gas Valve"
    },
    "telemetry": {
        "NAME_DEV": "Gas Shutoff Valve LoRaWAN 'Smartico V-LR'",
        "REAL_TIME": "26.08.2020 10:25:20",
        "SERIAL": "0000129",
        "VALVE_MODEL": "Gas",
        "STS_VALVE": "Close",
        "STS_VALVE_CODE": 1,
        "FLG_LOW_BAT": 0,
        "FLG_MOTION_DETECT": 0,
        "FLG_MAGNET_DETECT": 0,
        "FLG_TAMPER_DETECT": 0,
        "FLG_POWER_ON": 0,
        "FLG_POWER_BAT": 0,
        "FLG_ERR_TIME": 1,
        "FLG_CFG_DONE": 0
    }
}

The input and output data are for example purposes only and not related to the dashboard shown at the beginning of the guide. Before turning on the device, you can verify the functionality of programming code from uplink_gas_valve.json file. For this purpose, open the Test decoder function for Uplink Gas Valve in the DATA CONVERTERS and copy the input data from this guide into Payload content field. Press TEST button then in Output field should appear decoding output data as shown on the figure (the REAL_TIME field displays the current date and time).

image

Step 4. Creation Gas Valve Asset.

To be able to display data in the dashboard, you should first create an asset and add device 0000129 in the RELATIONS, as shown in the figures.

image

image

Step 5. Rule chain import and configuration.

In addition to meter readings, it is possible to monitor the status of the device. For example, you can get information about a low battery, opening the device case, exposure to a magnetic field, and others. This information is displayed in the Alarm widget. Therefore, you should set up Rule chain first. Import alarms_gas_valve.json file with alarms and save the configuration of the Rule chain in ThingsBoard.

image

Then configure Root Rule chain. You should add in Root Rule chain Alarms Gas Valve as it shown on the figure.

image

Step 6. Dashboard import and configuration.

To display data to users, you need to create a dashboard that can be imported from dashboard_gas_valve.json file.

image

When importing a dashboard, it will be necessary to create an alias, as shown in the figure.

image

If everything was done correctly, in DASHBOARD GROUPS → All you will see the new dashboard Gas Shutoff Valve LoRaWAN “Smartico V-LR” that was provided at the beginning of the guide.

See also

Browse other samples or explore guides related to main ThingsBoard features:

Your feedback

Don’t hesitate to star ThingsBoard on github to help us spread the word. If you have any questions about this sample - post it on the issues.

Next steps

  • 入门指南 - 快速学习ThingsBoard相关功能。

  • 安装指南 - 学习如何在各种操作系统上安装ThingsBoard。

  • 连接设备 - 学习如何根据你的连接方式或解决方案连接设备。

  • 可 视 化 - 学习如何配置复杂的ThingsBoard仪表板说明。

  • 数据处理 - 学习如何使用ThingsBoard规则引擎。

  • 数据分析 - 学习如何使用规则引擎执行基本的分析任务。

  • 高级功能 - 学习高级ThingsBoard功能。

  • 开发指南 - 学习ThingsBoard中的贡献和开发。