Closed pystudy123 closed 2 years ago
modbus.json:
"server":{
"type":"tcp",
"host":"127.0.0.1",
"port":502,
"timeout":35,
"method":"socket",
"byteOrder":"BIG",
"devices":[
{
"unitId":1,
"deviceName":"testDevice",
"attributesPollPeriod":5000,
"timeseriesPollPeriod":5000,
"sendDataOnlyOnChange":false,
"attributes":[
{
"byteOrder":"BIG",
"tag":"count",
"type":"16int",
"functionCode":3,
"objectsCount":1,
"address":0
}
],
"timeseries":[
{
"byteOrder":"BIG",
"tag":"count",
"type":"16int",
"functionCode":3,
"objectsCount":1,
"address":0
}
]
},
{
"unitId":2,
"deviceName":"testDevice2",
"attributesPollPeriod":5000,
"timeseriesPollPeriod":5000,
"sendDataOnlyOnChange":false,
"attributes":[
{
"byteOrder":"BIG",
"tag":"count",
"type":"16int",
"functionCode":3,
"objectsCount":1,
"address":0
}
],
"timeseries":[
{
"byteOrder":"BIG",
"tag":"count",
"type":"16int",
"functionCode":3,
"objectsCount":1,
"address":0
}
],
"rpc":[
{
"tag":"setValue",
"type":"16int",
"functionCode":6,
"objectsCount":1,
"address":8
},
{
"tag":"getValue",
"type":"16int",
"functionCode":1,
"objectsCount":1,
"address":9
}
]
}
]
}
}`
12 08:22:37" - |WARNING| - [tb_gateway_service.py] - tb_gateway_service - _connect_with_connectors - 473 - Connector implementation not found for Modbus Connector"
""2022-02-12 08:22:37" - |INFO| - [tb_gateway_service.py] - tb_gateway_service - init - 180 - Gateway started."
""2022-02-12 10:19:19" - |WARNING| - [tb_gateway_service.py] - tb_gateway_service - _connect_with_connectors - 473 - Connector implementation not found for Modbus Connector"
""2022-02-12 10:21:20" - |WARNING| - [tb_gateway_service.py] - tb_gateway_service - _connect_with_connectors - 473 - Connector implementation not found for Modbus Connector"
""2022-02-12 10:31:23" - |WARNING| - [tb_gateway_service.py] - tb_gateway_service - _connect_with_connectors - 473 - Connector implementation not found for Modbus Connector"
""2022-02-12 10:32:24" - |WARNING| - [tb_gateway_service.py] - tb_gateway_service - _connect_with_connectors - 473 - Connector implementation not found for Modbus Connector"
But,the modbus poll is ok.
Hi @imbeacon @pystudy123,
I'm exactly in a similar situation now. How did you solve this issue?
The service log inside /home/hostname/thingsboard-gateway/logs
shows the following:
""2022-04-07 14:17:14" - |ERROR| - [tb_gateway_service.py] - tb_gateway_service - _connect_with_connectors - 495 - 'wordOrder'"
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/thingsboard_gateway-3.0.1-py3.9.egg/thingsboard_gateway/gateway/tb_gateway_service.py", line 486, in _connect_with_connectors
connector = self._implemented_connectors[connector_type](self, connector_config["config"][config], connector_type)
File "/usr/local/lib/python3.9/dist-packages/thingsboard_gateway-3.0.1-py3.9.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 114, in __init__
self.__load_slaves()
File "/usr/local/lib/python3.9/dist-packages/thingsboard_gateway-3.0.1-py3.9.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 192, in __load_slaves
self.__slaves = [
File "/usr/local/lib/python3.9/dist-packages/thingsboard_gateway-3.0.1-py3.9.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 193, in <listcomp>
Slave(**{**device, 'connector': self, 'gateway': self.__gateway, 'callback': ModbusConnector.callback}) for
File "/usr/local/lib/python3.9/dist-packages/thingsboard_gateway-3.0.1-py3.9.egg/thingsboard_gateway/connectors/modbus/slave.py", line 43, in __init__
'wordOrder': kwargs['wordOrder'],
KeyError: 'wordOrder'
In addition to the Modbus connector, I've got an MQTT connector too, and it is running fine.
UPDATE:
The Modbus config file (default) had no "wordOrder": "LITTLE",
. I added it to the modbus.json file. The KeyError still persists in the modbus_connector.py
file.
Now, I remove the thingsboard-gateway and reinstalled it from source. The last line in terminal after python3 setup.py install
says:
Using /usr/local/lib/python3.9/dist-packages
Finished processing dependencies for thingsboard-gateway==3.0.1
After running python3 ./thingsboard_gateway/tb_gateway.py
, I get:
ModuleNotFoundError: No module named 'thingsboard_gateway'
What is happening?
Describe the issue I deployed thingsboard and tb-gateway based on docker under win10. Execute under cmd: curl -v -X POST -d "{\"temperature\":1.25}" http://127.0.0.1:8080/api/v1/T2_TEST_TOKEN/telemetry --header "Content-Type:application/ json" Everything works fine and data can be received. However, I use Modbus Slave simulation, unable to receive telemetry data.
Configuration (Attach your configuration file) Notate: Remove Access token from file if you want to attach a tb_gateway.yaml tb_gateway.yaml:
thingsboard: host: 127.0.0.1 port: 1883 remoteShell: false remoteConfiguration: false security: accessToken: "" storage: type: memory read_records_count: 100 max_records_count: 100000
connectors:
name: Modbus Connector type: modbus configuration: modbus.json
ThingsBoard IoT gateway version: 3.0.1