Closed ghost closed 3 years ago
Describe the bug Clear and concise description of what the bug is. UnicodeDecodeError during modbus bytes read.
Connector name (If bug in the some connector): [e.g. OPC-UA Connector] Modbus Connector Error traceback (If available):
'deviceName' Traceback (most recent call last): File "<input>", line 2, in <module> KeyError: 'deviceName'
PS C:\workspace\thingsboard-gateway\thingsboard-gateway> cd 'C:\workspace\thingsboard-gateway\thingsboard-gateway'; & 'C:\Python38\python.exe' 'c:\Users\n2o\.vscode\extensions\ms-python.python-2020.8.108011\pythonFiles\lib\python\debugpy\launcher' '54567' '--' 'thingsboard_gateway\tb_gateway.py' ""2020-09-16 17:52:03" - INFO - [tb_gateway_service.py] - tb_gateway_service - 72 - Gateway starting..." ""2020-09-16 17:52:03" - INFO - [tb_gateway_service.py] - tb_gateway_service - 77 - ThingsBoard IoT gateway version: 2.5.1" ""2020-09-16 17:52:03" - INFO - [tb_gateway_mqtt.py] - tb_gateway_mqtt - 176 - Subscribed to *|* with id 1" ""2020-09-16 17:52:03" - WARNING - [tb_gateway_service.py] - tb_gateway_service - 115 - Remote shell is enabled. Please be carefully with this feature." ""2020-09-16 17:52:03" - INFO - [tb_device_mqtt.py] - tb_device_mqtt - 141 - connection SUCCESS" ""2020-09-16 17:52:03" - INFO - [modbus_connector.py] - modbus_connector - 69 - Starting Modbus connector" ""2020-09-16 17:52:03" - INFO - [modbus_connector.py] - modbus_connector - 69 - Starting Modbus connector" ""2020-09-16 17:52:03" - INFO - [tb_gateway_service.py] - tb_gateway_service - 135 - Gateway started." ""2020-09-16 17:52:04" - ERROR - [modbus_connector.py] - modbus_connector - 196 - 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte" Traceback (most recent call last): File "C:\workspace\thingsboard-gateway\thingsboard-gateway\thingsboard_gateway\connectors\modbus\modbus_connector.py", line 190, in __process_devices self.__gateway.send_to_storage(self.get_name(), to_send) File ".\thingsboard_gateway\gateway\tb_gateway_service.py", line 342, in send_to_storage json_data = dumps(data) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\__init__.py", line 395, in dumps return _default_encoder.encode(obj) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 296, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 378, in iterencode return _iterencode(o, 0) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte ""2020-09-16 17:52:05" - ERROR - [modbus_connector.py] - modbus_connector - 196 - 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte" Traceback (most recent call last): File "C:\workspace\thingsboard-gateway\thingsboard-gateway\thingsboard_gateway\connectors\modbus\modbus_connector.py", line 190, in __process_devices self.__gateway.send_to_storage(self.get_name(), to_send) File ".\thingsboard_gateway\gateway\tb_gateway_service.py", line 342, in send_to_storage json_data = dumps(data) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\__init__.py", line 395, in dumps return _default_encoder.encode(obj) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 296, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 378, in iterencode return _iterencode(o, 0) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte ""2020-09-16 17:52:06" - ERROR - [modbus_connector.py] - modbus_connector - 196 - 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte" Traceback (most recent call last): File "C:\workspace\thingsboard-gateway\thingsboard-gateway\thingsboard_gateway\connectors\modbus\modbus_connector.py", line 190, in __process_devices self.__gateway.send_to_storage(self.get_name(), to_send) File ".\thingsboard_gateway\gateway\tb_gateway_service.py", line 342, in send_to_storage json_data = dumps(data) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\__init__.py", line 395, in dumps return _default_encoder.encode(obj) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 296, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 378, in iterencode return _iterencode(o, 0) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte ""2020-09-16 17:52:07" - ERROR - [modbus_connector.py] - modbus_connector - 196 - 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte" Traceback (most recent call last): File "C:\workspace\thingsboard-gateway\thingsboard-gateway\thingsboard_gateway\connectors\modbus\modbus_connector.py", line 190, in __process_devices self.__gateway.send_to_storage(self.get_name(), to_send) File ".\thingsboard_gateway\gateway\tb_gateway_service.py", line 342, in send_to_storage json_data = dumps(data) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\__init__.py", line 395, in dumps return _default_encoder.encode(obj) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 296, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Users\n2o\AppData\Roaming\Python\Python38\site-packages\simplejson\encoder.py", line 378, in iterencode return _iterencode(o, 0) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte ""2020-09-16 17:52:08" - INFO - [tb_gateway_service.py] - tb_gateway_service - 214 - Stopping..." ""2020-09-16 17:52:08" - INFO - [modbus_connector.py] - modbus_connector - 110 - Modbus Connector has been stopped." ""2020-09-16 17:52:08" - INFO - [tb_gateway_service.py] - tb_gateway_service - 216 - The gateway has been stopped."
Versions (please complete the following information):
OS: [e.g. Ubuntu 18.04]
Thingsboard IoT Gateway version [e.g. 2.0]
Python version[e.g. 3.7]
OS: [win10 64bit home edition]
Thingsboard IoT Gateway version master, latest, should be 2.5.1]
Python version 3.8.5
modbus.json
... "timeseries": [ { "tag": "raw", "type": "bytes", "functionCode": 3, "objectsCount": 64, "address": 1 } ], ...
Hi @chengdi123000 ,
The gateway supports only UTF-8 payload, at the moment, it may change when the gateway will use protobuf instead of json to send data to ThingsBoard.
Describe the bug Clear and concise description of what the bug is. UnicodeDecodeError during modbus bytes read.
Connector name (If bug in the some connector): [e.g. OPC-UA Connector] Modbus Connector Error traceback (If available):
Versions (please complete the following information):
OS: [e.g. Ubuntu 18.04]
Thingsboard IoT Gateway version [e.g. 2.0]
Python version[e.g. 3.7]
OS: [win10 64bit home edition]
Thingsboard IoT Gateway version master, latest, should be 2.5.1]
Python version 3.8.5
modbus.json