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.72k stars 829 forks source link

OSError: [Errno 99] Cannot assign requested address : BACnet connector #608

Closed santobedi closed 2 years ago

santobedi commented 2 years ago

Describe the issue I'm trying to use BACnet connector in the Thingsboard gateway. The default configuration file (bacnet.json) seems confusing (I think the nomenclature does not match with the real-world BACnet protocol) and also it has not been updated for two years as seen here.

I simulated BACnet server in a Raspberry Pi and checked the device and objects in my PC. It's working properly fine. I attempted to edit the bacnet.json file according to BACnet simulator (IP, port number, device id, etc) as follows:

{
  "general": {
    "objectName": "BACnet Test",
    "address": "192.168.8.113:47808",
    "objectIdentifier": 4561, 
    "maxApduLengthAccepted": 1476,
    "segmentationSupported": "no-segmentation",
    "vendorIdentifier": 260
  },
  "devices": [
    {
      "deviceName": "Analog value 3",
      "deviceType": "default",
      "address": "192.168.8.113:47808",
      "pollPeriod": 10000,
      "attributes": [
        {
          "key": "temperature",
          "type": "string",
          "objectId": "analogOutput:1",
          "propertyId": "presentValue"
        }
      ],
      "timeseries": [
        {
          "key": "state",
          "type": "bool",
          "objectId": "analogOutput: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"
        }
      ]
    }
  ]
}

Here, I've assumed objectIdentifier as device id. While using the above configuration file, I get the following error.

Capture

How can I solve this error?

Thank you.

Connector name (If you need help with some connector/converter): [BACNET Connector]

Error traceback (If it was raised): OSError: [Errno 99] Cannot assign requested address

Versions (please complete the following information):

imbeacon commented 2 years ago

Hi @santobedi ,

It looks like you have some misconfiguration in general section of the connector: The general section is relate to gateway settings for bacnet (the gateway also registers in the BACnet network as a device). The gateway cannot register in the network with this address, because it looks like it is already bind. Also you provided the same address to the device configuration and the gateway will be unable to read data from it. In order to become familiar with BACnetconnector configuration, you may check this article.

imbeacon commented 2 years ago

Solved in #601. (Just replace the address in general section to 0.0.0.0:47808)