Coder Social home page Coder Social logo

bacnet-adapter's Introduction

BACnet Adapter

This adapter is written with python, and provides a simple interface between BACnet devices and MQTT messaging via the ClearBlade platform. It asks all BACnet devices on the network to identify themselves, and then gets all objects and properties for each device, and finally sends that data to the ClearBlade platform via MQTT. All messages are sent to the topic bacnet/in.

Dependencies

  • Python 2.7
  • ClearBlade Python SDK v1.0 (instructions here)
  • Eclipse Paho Python SDK (instructions here)
  • BACpypes BACnet Python SDK (instructions here)

Usage

Before starting the adapter you will need to add an entry to the device table of the system you want to use. When creating the device make sure it is enabled, and allow key authorization. Finally be sure to set a value for the active_key column after creation. You will need this, and th device name when starting the adapter.

To start the adapter you simply need to run python main.py with the following command line flags:

Name Description
--systemKey (required) The ClearBlade Platform system key you would like to have MQTT messages published to
--systemSecret (required) The system secret for the system above
--deviceName (required) The device name that you set for the adapter
--activeKey (required) The active key that you set for the adapter
--ipAddress (required) The IP address of the device you are running the adapter on
--platformUrl (optional) The URL for the ClearBlade Platform instance you want to use. If not provided, defaults to https://platform.clearblade.com
--whoisInterval (optional) Set the length of time (in seconds) between who is messages. Defaults to 120.

MQTT Message Format

Here is an example MQTT message sent from the BACnet adapter to the platform.

{
  "device": {
    "source": "20:0x7a0100000000",
    "id": [
      "device",
      378
    ]
  },
  "object": [
    "analogInput",
    0
  ],
  "properties": {
    "notificationClass": 0,
    "reliability": "noFaultDetected",
    "eventTimeStamps": [
      "<bacpypes.basetypes.TimeStamp object at 0x108f2b110>",
      "<bacpypes.basetypes.TimeStamp object at 0x108f2b3d0>",
      "<bacpypes.basetypes.TimeStamp object at 0x108f2ba50>"
    ],
    "covIncrement": 0.10000000149011612,
    "timeDelay": 10,
    "deadband": 1,
    "ackedTransitions": [
      1,
      1,
      1
    ],
    "notifyType": "event",
    "deviceType": "",
    "units": "degreesFahrenheit",
    "presentValue": 153,
    "objectType": "analogInput",
    "statusFlags": [
      1,
      0,
      0,
      0
    ],
    "description": "",
    "objectName": "TempSensor1",
    "highLimit": 250,
    "limitEnable": [
      1,
      1
    ],
    "lowLimit": 0,
    "objectIdentifier": [
      "analogInput",
      0
    ],
    "profileName": "123-AI",
    "updateInterval": 100,
    "outOfService": false,
    "maxPresValue": 250,
    "minPresValue": 0,
    "propertyList": [
      "presentValue",
      "objectName",
      "description",
      1008,
      "updateInterval",
      "minPresValue",
      "maxPresValue",
      "covIncrement",
      "objectType",
      "objectIdentifier",
      "deviceType",
      "statusFlags",
      "eventState",
      "reliability",
      "outOfService",
      1007,
      "units",
      "resolution",
      "timeDelay",
      "notificationClass",
      "highLimit",
      "lowLimit",
      "deadband",
      "limitEnable",
      "eventEnable",
      "ackedTransitions",
      "notifyType",
      "eventTimeStamps",
      "profileName",
      1001,
      1006,
      "propertyList"
    ],
    "eventState": "highLimit",
    "eventEnable": [
      0,
      0,
      0
    ],
    "resolution": 0.10000000149011612
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.