thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.74k stars 844 forks source link

[BUG] #539

Closed PRiOTiers closed 3 years ago

PRiOTiers commented 3 years ago

If modbus.json and modbus_serial.json are used at the same time, attributeUpdates for modbus TCP are not working.

bt_gateway.yaml: ... connectors: hashtag - hashtag name: MQTT Broker Connector hashtag type: mqtt hashtag configuration: mqtt.json

- name: Modbus Connector type: modbus configuration: modbus.json

- name: Modbus Connector type: modbus configuration: modbus_serial.json hashtag hashtag - hashtag name: OPC-UA Connector hashtag type: opcua hashtag configuration: opcua.json hashtag hashtag - hashtag name: BLE Connector hashtag type: ble hashtag configuration: ble.json hashtag hashtag - hashtag name: REQUEST Connector hashtag type: request hashtag configuration: request.json hashtag hashtag - hashtag name: CAN Connector hashtag type: can hashtag configuration: can.json hashtag hashtag - hashtag name: BACnet Connector hashtag type: bacnet hashtag configuration: bacnet.json hashtag hashtag - hashtag name: ODBC Connector hashtag type: odbc hashtag configuration: odbc.json hashtag hashtag - hashtag name: REST Connector hashtag type: rest hashtag configuration: rest.json hashtag hashtag - hashtag name: SNMP Connector hashtag type: snmp hashtag configuration: snmp.json hashtag

name: Custom Serial Connector
type: serial
configuration: custom_serial.json
class: CustomSerialConnector

""2021-07-22 16:29:51" - ERROR - [modbus_connector.py] - modbus_connector - 205 - 'my_device'" Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/thingsboard_gateway-2.6-py3.9.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 192, in on_attributes_update for attribute_updates_command_config in self.__devices[content["device"]]["config"]["attributeUpdates"]:
KeyError: 'my_device

If modbus_serial.json is switched off, everything works fine

samson0v commented 3 years ago

Hi @yvo-pfenninger, it seems that your Modbus config file has some misconfiguration. Please, provide us with your config files for modbus and modbus-serial. Thanks for your interest in ThingsBoard IoT Gateway.