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

[HELP] BACnet Connector Doesn't Detect BACnet Device #609

Closed AhmadMagdi closed 3 years ago

AhmadMagdi commented 3 years ago

Describe the issue I have The Thingsboard IoT Gateway up on a virtual machine, and I'm trying to get the BACnet connector to work. I have, on the same local network, another virtual machine running a BACnet device using BACnet Stack, which responds to WhoIs requests by sending an IAm request (I can verify this using BACnet Stack WhoIs). Screenshot from 2021-10-28 05-31-45 Screenshot from 2021-10-28 05-32-37

The connector logs show the gateway sending WhoIs requests, but never receiving the IAm requests sent in response.

Screenshot from 2021-10-28 05-34-14

Configuration (Attach your configuration file)

tb_gateway.yaml:

tb_gateway.yaml.txt

thingsboard:
  host: 192.168.0.133
  port: 1883
  remoteShell: false
  remoteConfiguration: false
  statsSendPeriodInSeconds: 3600
  checkConnectorsConfigurationInSeconds: 60
  security:
    accessToken: EXAMPLE_ACCESS_TOKEN
  qos: 1
storage:
  type: memory
  read_records_count: 100
  max_records_count: 100000
connectors:
  -
    name: BACnet Connector
    type: bacnet
    configuration: bacnet.json

bacnet.json

bacnet.json.txt

{
  "general": {
    "objectName": "TB_gateway",
    "address": "192.168.0.194:47808",
    "objectIdentifier": 599,
    "maxApduLengthAccepted": 1476,
    "segmentationSupported": "segmentedBoth",
    "vendorIdentifier": 15
  },
  "devices": [
    {
      "deviceName": "BACnet Device ${objectName}",
      "deviceType": "default",
      "address": "192.168.0.133:47808",
      "pollPeriod": 10000,
      "attributes": [
        {
          "key": "temperature",
          "type": "string",
          "objectId": "analogOutput:1",
          "propertyId": "presentValue"
        }
      ],
      "timeseries": [
        {
          "key": "state",
          "type": "bool",
          "objectId": "binaryValue:1",
          "propertyId": "presentValue"
        }
      ],
      "attributeUpdates": [
        {
          "key": "brightness",
          "requestType": "writeProperty",
          "objectId": "analogOutput:1",
          "propertyId": "presentValue"
        }
      ],
      "serverSideRpc": [
        {
          "method": "set_state",
          "requestType": "writeProperty",
          "requestTimeout": 10000,
          "objectId": "binaryOutput:1",
          "propertyId": "presentValue"
        },
        {
          "method": "get_state",
          "requestType": "readProperty",
          "requestTimeout": 10000,
          "objectId": "binaryOutput:1",
          "propertyId": "presentValue"
        }
      ]
    }
  ]
}

Connector name (If you need help with some connector/converter): BACnet Connector

Error traceback (If it was raised): It doesn't give an error, but here're the logs from connector.log

""2021-10-27 22:12:19" - |DEBUG| - [tb_logger.py] - tb_logger - __init__ - 37 - Added remote handler to log connector"
""2021-10-27 22:12:21" - |DEBUG| - [bacnet_connector.py] - bacnet_connector - scan_network - 195 - WhoIsRequest has been sent."
""2021-10-27 22:12:21" - |DEBUG| - [bacnet_connector.py] - bacnet_connector - run - 74 - WhoIsRequest has been sent."
""2021-10-27 22:12:21" - |DEBUG| - [bacnet_connector.py] - bacnet_connector - scan_network - 195 - WhoIsRequest has been sent."

Versions (please complete the following information):

imbeacon commented 3 years ago

Hi @AhmadMagdi ,

Please try to use 0.0.0.0:47808 as an address in general section.

AhmadMagdi commented 3 years ago

Thanks @zbeacon

This worked for me.

Is there a specific reason it should be this way, perhaps some resource I should check out?

WeiTangLau commented 3 years ago

This worked for me as well.

My guess would be as 0.0.0.0 is used to indicate all ipv4 addresses. As such, gateway will accepts and listens to all responses in the network.

However, adopting this method, I am still unable to read BACnet MSTP devices. Do you happened to have a BACnet MSTP device in your network?

AhmadMagdi commented 3 years ago

Hi @WeiTangLau

Thanks for the response!

Unfortunately, I do not have a BACnet MSTP device in your network.