Samples

The samples can be used as a jumping off point to build your own applications or to incorporate BACnet communications into your existing project.

BACpypes3 applications are built in layers with a stack consisting of some kind of link layer, a common network layer, and a customized application layer. The layers communicate with each other using a client/server design pattern, start with the console.py application to learn about this pattern.

Console Samples

These samples are designed to be run in combination from different terminal/shell windows with different combinations of initialization command line parameters or configuration files.

Command Samples

The BACpypes3 Cmd class …

VLAN Samples

BACpypes3 has a Virtual Local Area Network (VLAN) concept which is for building networks of devices within an application. For example, a BACnet-to-MODBUS gateway that is designed to present each of the other MODBUS devices as a BACnet device on a virtual network, then the application will be seen as a BACnet router to this virtual network.

It is also very handy in testing, for example different combinations of clients and servers can be collected together to see how they behave all within one application.

It is also useful for tutorials explaining how the BACnet network layer works.

Common Code

BACnet is a peer-to-peer protocol so devices can be clients (issue requests) and servers (provide responses) and are often both at the same time. The start-here.py sample application has just enough code to make itself known on the network and can be used as a starting point for predominantly client-like applications (reading data from other devices) or server-like applications (gateways). The console samples in this group show different options for configuring applications.

Client Samples

If you are building applications that browse around the BACnet network and read or write property values of objects, these are good starting points. Some of these are stand-alone application versions of the shell commands.

Browsing around the network to initialize or synchronize a local database with the BACnet network is so common that there are example applications for that.

Server Samples

Docker Samples

These samples are examples of building and running docker images, these applications and scripts are in a docker subfolder.

Miscellaneous

These samples are interesting bits and pieces.