Skip to content

Commit 5ba1888

Browse files
committed
Merge from develop branch
2 parents 1e1e6db + aa8757c commit 5ba1888

35 files changed

+1922
-467
lines changed

.github/ISSUE_TEMPLATE/help_wanted.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Help wanted
3+
about: If you have some issues with configuration
4+
title: "[HELP]"
5+
labels: help wanted
6+
assignees: zbeacon
7+
8+
---
9+
10+
**Describe the issue**
11+
Create description about your issue, and your actions to solve it.
12+
13+
14+
**Configuration** (Attach your configuration file)
15+
**Notate: Remove Access token from file if you wanna attach tb_gateway.yaml**
16+
17+
18+
**Connector name (If you need help with some connector/converter):**
19+
[e.g. MQTT Connector]
20+
21+
22+
**Error traceback (If it was raised):**
23+
```
24+
'deviceName'
25+
Traceback (most recent call last):
26+
File "<input>", line 2, in <module>
27+
KeyError: 'deviceName'
28+
```
29+
30+
31+
**Versions (please complete the following information):**
32+
- OS: [e.g. Ubuntu 18.04]
33+
- Thingsboard IoT Gateway version [e.g. 2.2.4]
34+
- Python version[e.g. 3.7]

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1-
# ThingsBoard IoT Gateway
1+
# ThingsBoard IoT Gateway
2+
23
The Thingsboard **IoT Gateway** is an open-source solution that allows you to integrate devices connected to legacy and third-party systems with Thingsboard.
34

45
Thingsboard is an open-source IoT platform for data collection, processing, visualization, and device management. See [**What is Thingsboard?**](https://thingsboard.io/docs/getting-started-guides/what-is-thingsboard/) if you are new platform user.
56

67
[**What is ThingsBoard IoT Gateway?**](https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/)
8+
[**Getting started with ThingsBoard IoT Gateway**](https://thingsboard.io/docs/iot-gateway/getting-started/)
79

810
![ThingsBoard IoT Gateway architecture](https://thingsboard.io/images/gw_animation.gif)
911

1012
### Gateway features
1113

1214
Thingsboard IoT Gateway provides following features:
1315

14-
- **OPC-UA** connector to collect data from devices that are connected to OPC-UA servers.
15-
- **MQTT** connector to collect data that is published to external MQTT brokers.
16-
- **Modbus** connector to collect data from Modbus servers and slaves.
17-
- **BLE** connector to collect data from BLE devices.
18-
- **Request** connector to collect data from HTTP API.
19-
- **Custom** connector to collect data from custom protocols.
16+
- [**OPC-UA** connector](https://thingsboard.io/docs/iot-gateway/config/opc-ua/) to collect data from devices that are connected to OPC-UA servers.
17+
- [**MQTT** connector](https://thingsboard.io/docs/iot-gateway/config/mqtt/) to collect data that is published to external MQTT brokers.
18+
- [**Modbus** connector](https://thingsboard.io/docs/iot-gateway/config/modbus/) to collect data from Modbus servers and slaves.
19+
- [**BLE** connector](https://thingsboard.io/docs/iot-gateway/config/ble/) to collect data from BLE devices.
20+
- [**Request** connector](https://thingsboard.io/docs/iot-gateway/config/request/) to collect data from HTTP API.
21+
- [**CAN** connector](https://thingsboard.io/docs/iot-gateway/config/can/) to collect data using CAN protocol.
22+
- [**Custom** connector](https://thingsboard.io/docs/iot-gateway/custom/) to collect data from custom protocols.
2023
- **Persistence** of collected data to guarantee data delivery in case of network and hardware failures.
2124
- **Automatic reconnect** to Thingsboard cluster.
2225
- Simple yet powerful **mapping** of incoming data and messages **to unified format**.
26+
- [Remote logging feature](https://thingsboard.io/docs/iot-gateway/guides/how-to-enable-remote-logging/) to monitor the gateway status through the ThingsBoard WEB interface.
27+
- [RPC gateway methods](https://thingsboard.io/docs/iot-gateway/guides/how-to-use-gateway-rpc-methods/) to control and get information from the gateway through ThingsBoard WEB interface.
2328

2429
### Architecture
2530

@@ -38,6 +43,8 @@ For processing data from devices you also can write custom converter, it will re
3843
- [Community chat](https://gitter.im/thingsboard/chat)
3944
- [Q&A forum](https://groups.google.com/forum/#!forum/thingsboard)
4045
- [Stackoverflow](http://stackoverflow.com/questions/tagged/thingsboard)
46+
47+
**Don't forget to star the repository to show your ❤️ and support.**
4148

4249
## Licenses
4350

for_build/DEBIAN/postinst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ sudo pip3 install --upgrade importlib
1919
sudo pip3 install --upgrade importlib-metadata
2020
sudo cp -a -r /etc/thingsboard-gateway/extensions /var/lib/thingsboard_gateway/
2121
sudo rm -r /etc/thingsboard-gateway/extensions
22+
sudo usermod -a -G dialout $CURRENT_USER
2223
sudo usermod -a -G thingsboard_gateway $CURRENT_USER
2324
sudo chown thingsboard_gateway:thingsboard_gateway /var/log/thingsboard-gateway/ -R
25+
sudo chown thingsboard_gateway:thingsboard_gateway /var/lib/thingsboard_gateway/ -R
2426
sudo chown thingsboard_gateway:thingsboard_gateway /etc/thingsboard-gateway/ -R
2527
sudo sed -i 's/\.\/logs/\/var\/log\/thingsboard-gateway/g' /etc/thingsboard-gateway/config/logs.conf >> /etc/thingsboard-gateway/config/logs.conf
2628
echo "Installation completed"

for_build/DEBIAN/preinst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#!/bin/sh
2+
set -e
3+
14
echo "Installing directory for configs..."
2-
sudo mkdir /etc/thingsboard-gateway
3-
sudo adduser --system --gecos "ThingsBoard-Gateway Service" --disabled-password --group --home /var/lib/thingsboard_gateway thingsboard_gateway
5+
sudo mkdir /etc/thingsboard-gateway || echo
6+
sudo adduser --system --gecos "ThingsBoard-Gateway Service" --disabled-password --group --home /var/lib/thingsboard_gateway thingsboard_gateway || echo "User exists"
7+
sudo mkdir /var/lib/thingsboard_gateway/extensions || echo
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"interface": "socketcan",
3+
"channel": "vcan0",
4+
"backend": {
5+
"fd": true
6+
},
7+
"reconnectPeriod": 5,
8+
"devices": [
9+
{
10+
"name": "Car",
11+
"sendDataOnlyOnChange": false,
12+
"enableUnknownRpc": true,
13+
"strictEval": false,
14+
"attributes": [
15+
{
16+
"key": "isDriverDoorOpened",
17+
"nodeId": 41,
18+
"command": "2:2:big:8717",
19+
"value": "4:1:int",
20+
"expression": "bool(value & 0b00000100)",
21+
"polling": {
22+
"type": "once",
23+
"dataInHex": "AB CD AB CD"
24+
}
25+
}
26+
],
27+
"timeseries": [
28+
{
29+
"key": "rpm",
30+
"nodeId": 3,
31+
"isExtendedId": true,
32+
"command": {
33+
"start": 2,
34+
"length": 2,
35+
"byteorder": "little",
36+
"value": 48059
37+
},
38+
"value": {
39+
"start": 4,
40+
"length": 2,
41+
"type": "int"
42+
},
43+
"expression": "value / 4",
44+
"polling": {
45+
"type": "always",
46+
"period": 5,
47+
"dataInHex": "aaaa bbbb aaaa bbbb"
48+
}
49+
},
50+
{
51+
"key": "milliage",
52+
"nodeId": 1918,
53+
"isExtendedId": true,
54+
"value": "4:2:little:int",
55+
"expression": "value * 10",
56+
"polling": {
57+
"type": "always",
58+
"period": 30,
59+
"dataInHex": "aa bb cc dd ee ff aa bb"
60+
}
61+
}
62+
],
63+
"attributeUpdates": [
64+
{
65+
"attributeOnThingsBoard": "softwareVersion",
66+
"nodeId": 64,
67+
"isExtendedId": true,
68+
"dataLength": 4,
69+
"dataExpression": "value + 5",
70+
"dataByteorder": "little"
71+
}
72+
],
73+
"serverSideRpc": [
74+
{
75+
"method": "sendSameData",
76+
"nodeId": 4,
77+
"isExtendedId": true,
78+
"isFd": true,
79+
"bitrateSwitch": true,
80+
"dataInHex": "aa bb cc dd ee ff aa bb aa bb cc d ee ff"
81+
},
82+
{
83+
"method": "setLightLevel",
84+
"nodeId": 5,
85+
"dataLength": 2,
86+
"dataByteorder": "little",
87+
"dataBefore": "00AA"
88+
},
89+
{
90+
"method": "setSpeed",
91+
"nodeId": 16,
92+
"dataAfter": "0102",
93+
"dataExpression": "userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"
94+
}
95+
]
96+
}
97+
]
98+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2020. ThingsBoard
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = thingsboard-gateway
3-
version = 2.2.3.2
3+
version = 2.2.5
44
description = Thingsboard Gateway for IoT devices.
55
long_description= file: README.md
66
license = Apache Software License (Apache Software License 2.0)

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
packages=['thingsboard_gateway', 'thingsboard_gateway.gateway', 'thingsboard_gateway.storage',
2020
'thingsboard_gateway.tb_client', 'thingsboard_gateway.connectors', 'thingsboard_gateway.connectors.ble',
2121
'thingsboard_gateway.connectors.mqtt', 'thingsboard_gateway.connectors.opcua', 'thingsboard_gateway.connectors.request',
22-
'thingsboard_gateway.connectors.modbus', 'thingsboard_gateway.tb_utility', 'thingsboard_gateway.extensions',
22+
'thingsboard_gateway.connectors.modbus', 'thingsboard_gateway.connectors.can', 'thingsboard_gateway.connectors.bacnet',
23+
'thingsboard_gateway.connectors.bacnet.bacnet_utilities', 'thingsboard_gateway.tb_utility', 'thingsboard_gateway.extensions',
2324
'thingsboard_gateway.extensions.mqtt', 'thingsboard_gateway.extensions.modbus', 'thingsboard_gateway.extensions.opcua',
24-
'thingsboard_gateway.extensions.ble', 'thingsboard_gateway.extensions.serial', 'thingsboard_gateway.extensions.request'
25+
'thingsboard_gateway.extensions.ble', 'thingsboard_gateway.extensions.serial', 'thingsboard_gateway.extensions.request',
26+
'thingsboard_gateway.extensions.can', 'thingsboard_gateway.extensions.bacnet'
2527
],
2628
install_requires=[
2729
'cffi',
@@ -39,9 +41,10 @@
3941
'simplejson',
4042
'pyrsistent',
4143
'requests',
44+
'python-can',
4245
'bacpypes>=0.18.0'
4346
],
44-
download_url='https://github.com/thingsboard/thingsboard-gateway/archive/2.2.3.2.tar.gz',
47+
download_url='https://github.com/thingsboard/thingsboard-gateway/archive/2.2.5.tar.gz',
4548
entry_points={
4649
'console_scripts': [
4750
'thingsboard-gateway = thingsboard_gateway.tb_gateway:daemon'

thingsboard-gateway.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%define name thingsboard-gateway
2-
%define version 2.2.3
3-
%define unmangled_version 2.2.3
2+
%define version 2.2.4.2
3+
%define unmangled_version 2.2.4.2
44
%define release 1
55

66
Summary: Thingsboard Gateway for IoT devices.

thingsboard_gateway/config/can.json

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"interface": "socketcan",
3+
"channel": "vcan0",
4+
"backend": {
5+
"fd": true
6+
},
7+
"reconnectPeriod": 5,
8+
"devices": [
9+
{
10+
"name": "Car",
11+
"sendDataOnlyOnChange": false,
12+
"enableUnknownRpc": true,
13+
"strictEval": false,
14+
"attributes": [
15+
{
16+
"key": "isDriverDoorOpened",
17+
"nodeId": 41,
18+
"command": "2:2:big:8717",
19+
"value": "4:1:int",
20+
"expression": "bool(value & 0b00000100)",
21+
"polling": {
22+
"type": "once",
23+
"dataInHex": "AB CD AB CD"
24+
}
25+
}
26+
],
27+
"timeseries": [
28+
{
29+
"key": "rpm",
30+
"nodeId": 1918,
31+
"isExtendedId": true,
32+
"command": "2:2:big:48059",
33+
"value": "4:2:big:int",
34+
"expression": "value / 4",
35+
"polling": {
36+
"type": "always",
37+
"period": 5,
38+
"dataInHex": "aaaa bbbb aaaa bbbb"
39+
}
40+
},
41+
{
42+
"key": "milliage",
43+
"nodeId": 1918,
44+
"isExtendedId": true,
45+
"value": "4:2:little:int",
46+
"expression": "value * 10",
47+
"polling": {
48+
"type": "always",
49+
"period": 30,
50+
"dataInHex": "aa bb cc dd ee ff aa bb"
51+
}
52+
}
53+
],
54+
"attributeUpdates": [
55+
{
56+
"attributeOnThingsBoard": "softwareVersion",
57+
"nodeId": 64,
58+
"isExtendedId": true,
59+
"dataLength": 4,
60+
"dataExpression": "value + 5",
61+
"dataByteorder": "little"
62+
}
63+
],
64+
"serverSideRpc": [
65+
{
66+
"method": "sendSameData",
67+
"nodeId": 4,
68+
"isExtendedId": true,
69+
"isFd": true,
70+
"bitrateSwitch": true,
71+
"dataInHex": "aa bb cc dd ee ff aa bb aa bb cc d ee ff"
72+
},
73+
{
74+
"method": "setLightLevel",
75+
"nodeId": 5,
76+
"dataLength": 2,
77+
"dataByteorder": "little",
78+
"dataBefore": "00AA"
79+
},
80+
{
81+
"method": "setSpeed",
82+
"nodeId": 16,
83+
"dataAfter": "0102",
84+
"dataExpression": "userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"
85+
}
86+
]
87+
}
88+
]
89+
}

0 commit comments

Comments
 (0)