1
0
mirror of https://github.com/thingsboard/thingsboard-gateway synced 2025-10-26 22:31:42 +08:00
This commit is contained in:
Samuel Ružek
2021-06-08 16:42:24 +02:00
parent 556297cb32
commit b1eeaa1094
23 changed files with 108 additions and 86 deletions

View File

@@ -3,6 +3,6 @@ Version: 2.6
Section: base
Priority: optional
Depends: mosquitto,python3-pip
Architecture: arm64
Architecture: all
Maintainer: Samuel Ružek
Description: Thingsboard IoT Gateway modified to fit the needs of project myEnergyplan

View File

@@ -22,10 +22,8 @@ fi
if which pypy3compile >/dev/null 2>&1; then
pypy3compile -p python3-thingsboard-gateway || true
fi
MERVIS_LIBS=/etc/mervis
# End automatically added section
sudo apt-get update
echo "Installing jsonschema"
sudo rm -rf /usr/lib/python3/dist-packages/jsonschema
CURRENT_USER=$USER
@@ -45,11 +43,24 @@ sudo sed -i 's/\.\/logs/\/var\/log\/thingsboard-gateway/g' /etc/thingsboard-gate
echo "Installing Mosquitto config"
#sudo cp -a -r /etc/mosquitto/mosquitto.conf /etc/mosquitto/mosquitto.conf
echo "Installation completed, Starting network setup..."
tee network-config.sh <<EOF
#!/bin/bash
export IP_ADDRESS=192.168.
export SUBNET_MASK
export GATEWAY_IP
read -e -p "Input desired ip address of this device: " -i "192.168.1.101" IP_ADDRESS
read -e -p "Input desired subnet mask: " -i "255.255.255.0" SUBNET_MASK
read -e -p "Input desired gateway ip address: " -i "192.168.1.1" GATEWAY_IP
ls /etc/mervis/ > /dev/null || echo "\nMervis libs not found"
sudo $MERVIS_LIBS/configure-enet default "change card eth0 address $IP_ADDRESS mask $SUBNET_MASK gateway $GATEWAY_IP nameserver $GATEWAY_IP" && sudo $MERVIS_LIBS/configure-enet default commit
sudo /etc/mervis/configure-enet default 'change card eth0 address $IP_ADDRESS mask $SUBNET_MASK gateway $GATEWAY_IP nameserver $GATEWAY_IP'
sudo /etc/mervis/configure-enet default commit
EOF
sudo chmod +x ./network-config.sh
sudo chown root:root ./network-config.sh
sudo ./network-config.sh
echo "Enabling daemons..."
sudo pidof systemd && sudo systemctl enable thingsboard-gateway || echo "Systemctl not found"
sudo pidof systemd && sudo systemctl enable mosquitto || echo

View File

@@ -315,3 +315,4 @@
]
}
}

View File

@@ -65,3 +65,4 @@
}
]
}

View File

@@ -1,8 +1,10 @@
thingsboard:
host: demo.thingsboard.io
host: thingsboard.cloud
port: 1883
remoteShell: false
remoteConfiguration: false
statsSendPeriodInSeconds: 3600
checkConnectorsConfigurationInSeconds: 60
security:
accessToken: PUT_YOUR_GW_ACCESS_TOKEN_HERE
qos: 1

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -1,14 +1,14 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -128,3 +128,4 @@ class ShellyConverter(MqttUplinkConverter):
except Exception as e:
log.exception('Error in converter, for config: \n%s\n and message: \n%s\n', dumps(self.__config), body)
log.exception(e)

View File

@@ -91,3 +91,4 @@ class ZbTasmotaConverter(MqttUplinkConverter):
except Exception as e:
log.exception('Error in converter, for config: \n%s\n and message: \n%s\n', dumps(self.__config), body)
log.exception(e)

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -1,14 +1,14 @@
# Copyright 2020. ThingsBoard
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View File

@@ -1,16 +1,16 @@
# Copyright 2020. ThingsBoard
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import struct

View File

@@ -1,14 +1,14 @@
# Copyright 2021. ThingsBoard
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View File

@@ -1,14 +1,14 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ from string import ascii_lowercase
import serial
from thingsboard_gateway.connectors.connector import Connector, log # Import base class for connector and logger
from thingsboard_gateway.tb_utility.tb_loader import TBModuleLoader
from thingsboard_gateway.tb_utility.tb_utility import TBUtility
@@ -94,7 +95,7 @@ class CustomSerialConnector(Thread, Connector): # Define a connector class, i
if devices_config is not None:
for device_config in devices_config:
if device_config.get('converter') is not None:
converter = TBUtility.check_and_import(connector_type, device_config['converter'])
converter = TBModuleLoader.import_module(connector_type, device_config['converter'])
self.__devices[device_config['name']] = {'converter': converter(device_config),
'device_config': device_config}
else:

View File

@@ -1,4 +1,4 @@
# Copyright 2020. ThingsBoard
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -1,15 +1,15 @@
# Copyright 2020. ThingsBoard
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2021. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

0
generate_deb_package.sh Normal file → Executable file
View File

4
test.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
export TEST='lol'