BAC0 is a script module based on bacpypes ( to automate task using Bacnet/IP protocole. It's mainly targetted as a tool to test sequences on DDC controlelrs using bacnet.

Using the simplciity of python, the power of pandas, it's easy to test and keep a trace of the history of each points.

How to use

First you must install the 2 modules pip install bacpypes

Note : All tests have been done in Windows 7 using Anaconda3 (

Import module

In [1]:
import BAC0
import pandas as pd
%matplotlib inline
# Define network and connect to it
bacnet = BAC0.connect()

/home/pi/miniconda3/lib/python3.4/importlib/ FutureWarning: The pandas.lib module is deprecated and will be removed in a future version. These are private functions and can be accessed from pandas._libs.lib instead
  return f(*args, **kwds)
xlwings not installed. If using Windows or OSX, install to get more features.
Using ip :
Click here to open Live Trending Web Page
Failed running bokeh serve
Bokeh server already running

In [ ]:

In [ ]:
# Define the controller using : controller = BAC0.device(address, device_id, network)
fx = BAC0.device('2:5',5,bacnet)

In [ ]:
# Access points list

In [ ]:
# Create a table with multiple points

lst = ['nvoAI1', 'nvoAI2', 'nvoDI1']


In [ ]:
# Create a trend with multiple points using the DataFrame

lst = ['nvoAI1', 'nvoAI2']

fx.df(lst).resample('1min').plot(title='My title')

In [ ]:
fx.chart(lst, title='My title')

In [ ]:
fx.notes = 'New note to remember'

In [ ]:

Finding devices on a network

In [ ]:
bacnet.whois() # Note that this function is called automatically in ReadWriteScript

# The result takes a few milliseconds to be processed... it can be used in the same cell.

Using the bacnet object to read or write objects from devices

Accessing the list of object of a device can be done using the objectList property

In [ ]:
# Let's print the first 10 objects...'2:5 device 5 objectList')[:10]

In [ ]:
bacnet.readMultiple('2:5 analogInput 1 objectName description presentValue units')

In [ ]:
import time
obj = '2:5 analogValue 41 presentValue'
old_value =
print('Old Value is : %s' % old_value)
new_value = 120

bacnet.write('%s %s' % (obj,new_value))
print('New value is %s' %

Stopping the app

In [ ]: