diff --git a/.gitignore b/.gitignore index 6d978daaf..42612b487 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,9 @@ thingsboard_gateway/storage/data/ /.mypy_cache/ /thingsboard_gateway/storage/data_out/ *.gz +/logs/ +/python3-thingsboard-gateway.deb +/python3-thingsboard-gateway.rpm +/thingsboard_gateway.egg-info/ +/docker/python3-thingsboard-gateway.deb +/data/ diff --git a/for_build/etc/thingsboard-gateway/config/mqtt.json b/for_build/etc/thingsboard-gateway/config/mqtt.json index 5b05d1699..4522f1739 100644 --- a/for_build/etc/thingsboard-gateway/config/mqtt.json +++ b/for_build/etc/thingsboard-gateway/config/mqtt.json @@ -1,75 +1,73 @@ { "broker": { - "name":"Default Broker", - "host":"demo.thingsboard.io", + "name":"Default Local Broker", + "host":"127.0.0.1", "port":1883, "security": { "type": "basic", - "username": "GIjr0vTtbOLwpouuBxL9", - "password": "" + "username": "user", + "password": "password" } }, "mapping": [ { - "topicFilter": "v1/devices/me/attributes", + "topicFilter": "/sensor/data", "converter": { "type": "json", - "filterExpression": "", - "deviceNameJsonExpression": "${SerialNumber}", - "deviceTypeJsonExpression": "${SensorType}", + "deviceNameJsonExpression": "${serialNumber}", + "deviceTypeJsonExpression": "${sensorType}", "timeout": 60000, "attributes": [ { "type": "string", - "key": "test_key", - "value": "${SerialNumber}" + "key": "model", + "value": "${sensorModel}" + } + ], + "timeseries": [ + { + "type": "double", + "key": "temperature", + "value": "${temp}" + }, + { + "type": "double", + "key": "humidity", + "value": "${hum}" } ] } }, { - "topicFilter": "/temperature-sensors/+", + "topicFilter": "/sensor/+/data", "converter": { "type": "json", - "filterExpression": "", - "deviceNameJsonExpression": "${$.serialNumber}", - "deviceTypeJsonExpression": "${$.sensorType}", + "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/data)", + "deviceTypeTopicExpression": "Thermometer", "timeout": 60000, "attributes": [ { "type": "string", "key": "model", - "value": "${$.model}" + "value": "${sensorModel}" } ], "timeseries": [ { "type": "double", "key": "temperature", - "value": "${$.temperature}" - } - ] - } - }, - { - "topicFilter": "/temperature-sensors/+", - "converter": { - "type": "json", - "filterExpression": "", - "deviceNameJsonExpression": "${$.sensorId}", - "deviceTypeJsonExpression": "${$.sensorType}", - "timeout": 60000, - "timeseries": [ + "value": "${temp}" + }, { "type": "double", "key": "humidity", - "value": "${$.humidity}" + "value": "${hum}" } ] } }, { - "topicFilter": "/custom-sensors/+", + "topicFilter": "/custom/sensors/+", "converter": { "type": "custom", "extension": "CustomMqttUplinkConverter", @@ -83,8 +81,8 @@ ], "connectRequests": [ { - "topicFilter": "sensors/connect", - "deviceNameJsonExpression": "${$.SerialNumber}" + "topicFilter": "sensor/connect", + "deviceNameJsonExpression": "${SerialNumber}" }, { "topicFilter": "sensor/+/connect", @@ -93,8 +91,8 @@ ], "disconnectRequests": [ { - "topicFilter": "sensors/disconnect", - "deviceNameJsonExpression": "${$.SerialNumber}" + "topicFilter": "sensor/disconnect", + "deviceNameJsonExpression": "${SerialNumber}" }, { "topicFilter": "sensor/+/disconnect", diff --git a/for_build/etc/thingsboard-gateway/config/tb_gateway.yaml b/for_build/etc/thingsboard-gateway/config/tb_gateway.yaml index 8ccf00e4f..81913429c 100644 --- a/for_build/etc/thingsboard-gateway/config/tb_gateway.yaml +++ b/for_build/etc/thingsboard-gateway/config/tb_gateway.yaml @@ -1,12 +1,17 @@ thingsboard: - host: 127.0.0.1 + host: demo.thingsboard.io port: 1883 security: - accessToken: FUH2Fonov6eajSHi0Zyw + accessToken: PUT_YOUR_GW_ACCESS_TOKEN_HERE storage: type: memory - read_records_count: 10 - max_records_count: 1000 + read_records_count: 100 + max_records_count: 100000 +# type: file +# data_folder_path: ./data/ +# max_file_count: 10 +# max_read_records_count: 10 +# max_records_per_file: 10000 connectors: - @@ -25,15 +30,15 @@ connectors: # configuration: modbus_serial.json # # - -# name: BLE Connector -# type: ble -# configuration: ble.json -# -# - # name: OPC-UA Connector # type: opcua # configuration: opcua.json # +# - +# name: BLE Connector +# type: ble +# configuration: ble.json + # - # name: Custom Serial Connector # type: serial diff --git a/gateway.iml b/gateway.iml deleted file mode 100644 index 17c22cdff..000000000 --- a/gateway.iml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/make_packages.sh b/make_packages.sh index 58b499a6c..14bcd3659 100644 --- a/make_packages.sh +++ b/make_packages.sh @@ -71,7 +71,7 @@ if [ "$1" != "only_clean" ] ; then tar -zcvf extensions.tar.gz extensions/* mv configs.tar.gz ../../../ mv extensions.tar.gz /home/$CURRENT_USER/rpmbuild/SOURCES/extensions.tar.gz - cd ../ + cd ../../../ rm /home/$CURRENT_USER/rpmbuild/SOURCES/configs.tar.gz cp configs.tar.gz /home/$CURRENT_USER/rpmbuild/SOURCES/ # Bulding RPM Package diff --git a/setup.cfg b/setup.cfg index 0b98e6280..3ab1736f3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = thingsboard-gateway -version = 2.0.18 +version = 2.0 description = Thingsboard Gateway for IoT devices. long_description = The Thingsboard IoT Gateway is an open-source solution that allows you to integrate devices connected to legacy and third-party systems with Thingsboard. license = Apache Software License (Apache Software License 2.0) diff --git a/setup.py b/setup.py index 0270d2606..ae8ae3eed 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ 'simplejson', 'pyrsistent' ], - download_url='https://github.com/thingsboard/thingsboard-gateway/archive/2.0.18rc-python.tar.gz', + download_url='https://github.com/thingsboard/thingsboard-gateway/archive/2.0.tar.gz', entry_points={ 'console_scripts': [ 'thingsboard-gateway = thingsboard_gateway.tb_gateway:daemon' diff --git a/thingsboard-gateway.spec b/thingsboard-gateway.spec index 2f4aa6bf1..8194ea009 100644 --- a/thingsboard-gateway.spec +++ b/thingsboard-gateway.spec @@ -1,6 +1,6 @@ %define name thingsboard-gateway -%define version 2.0.18 -%define unmangled_version 2.0.18 +%define version 2.0 +%define unmangled_version 2.0 %define release 1 Summary: Thingsboard Gateway for IoT devices.