BAC0.scripts package

Submodules

BAC0.scripts.Base module

Doc here

class BAC0.scripts.Base.Base(localIPAddr: ~bacpypes3.pdu.Address = <IPv4Address 127.0.0.1>, networkNumber: int | None = None, localObjName: str = 'BAC0', deviceId: int | None = None, firmwareRevision: str = '3.12.10 (main, May  6 2025, 10:49:23) [GCC 11.4.0]', maxAPDULengthAccepted: str = '1024', maxSegmentsAccepted: str = '1024', segmentationSupported: str = 'segmentedBoth', bbmdAddress: str | None = None, bbmdTTL: int | None = 0, bdtable: list | None = None, modelName: str = 'BAC0 Scripting Tool', vendorId: int = 842, vendorName: str = 'SERVISYS inc.', description: str = 'http://christiantremblay.github.io/BAC0/', location: str = 'Bromont, Québec', timezone: str = 'America/Montreal', json_file: str | None = None)[source]

Bases: object

Build a running BACnet/IP device that accepts WhoIs and IAm requests Initialization requires some minimial information about the local device.

Parameters:
  • localIPAddr='127.0.0.1'

  • localObjName='BAC0'

  • deviceId=None

  • maxAPDULengthAccepted='1024'

  • maxSegmentsAccepted='1024'

  • segmentationSupported='segmentedBoth'

clear_notes()

Clear notes object

disconnect() Task[source]
classmethod extract_value_from_primitive_data(value)[source]
log(note, *, level: str | int = 10)

Add a log entry…no note

log_subtitle(subtitle, args=None, width=35)
log_title(title, args=None, width=35)
logname = 'BAC0.scripts.Base | Base'
note(note, *, level=20, log=True)

Add note to the object. By default, the note will also be logged :param note: (str) The note itself :param level: (logging.level) :param log: (boolean) Enable or disable logging of note

property notes

Retrieve notes list as a Pandas Series

register_foreign_device(addr=None, ttl=0)[source]
property routing_table

Routing Table will give all the details about routers and how they connect BACnet networks together.

It’s a decoded presentation of what bacpypes.router_info_cache contains.

Returns a dict with the address of routers as key.

startApp()[source]

Define the local device, including services supported. Once defined, start the BACnet stack in its own thread.

unregister_foreign_device()[source]
class BAC0.scripts.Base.DiscoveredDevice[source]

Bases: TypedDict

address: Address
network_number: Set[int]
object_instance: ObjectIdentifier
vendor_id: int
vendor_name: str
class BAC0.scripts.Base.LocalObjects(device)[source]

Bases: object

clear_notes()

Clear notes object

log(note, *, level: str | int = 10)

Add a log entry…no note

log_subtitle(subtitle, args=None, width=35)
log_title(title, args=None, width=35)
logname = 'BAC0.scripts.Base | LocalObjects'
note(note, *, level=20, log=True)

Add note to the object. By default, the note will also be logged :param note: (str) The note itself :param level: (logging.level) :param log: (boolean) Enable or disable logging of note

property notes

Retrieve notes list as a Pandas Series

BAC0.scripts.Base.charstring(val)[source]

BAC0.scripts.Lite module

Lite is the base class to create a BACnet network It uses provided args to register itself as a device in the network and allow communication with other devices.

class BAC0.scripts.Lite.Lite(ip: str | None = None, port: int | None = None, mask: int | None = None, bbmdAddress=None, bbmdTTL: int = 0, bdtable=None, ping: bool = True, ping_delay: int = 300, db_params: Dict[str, Any] | None = None, **params)[source]

Bases: Base, Discover, Alias, EventEnrollment, ReadProperty, WriteProperty, Simulation, TimeSync, Reinitialize, COVSubscription, Schedule, TextMixin

Build a BACnet application to accept read and write requests. [Basic Whois/IAm functions are implemented in parent BasicScript class.] Once created, execute a whois() to build a list of available controllers. Initialization requires information on the local device.

Parameters:

ip='127.0.0.1' – Address must be in the same subnet as the BACnet network [BBMD and Foreign Device - not supported]

add_trend(point_to_trend: Point | _TrendLog | VirtualPoint) None[source]

Add point to the list of histories that will be handled by Bokeh

Argument provided must be of type Point or TrendLog ex. bacnet.add_trend(controller[‘point_name’])

cancel_cov(task_id: int)[source]
clear_notes()

Clear notes object

cov(address: str, objectID: Tuple[str, int], lifetime: int = 900, confirmed: bool = False, callback: Callable[[str, Any], None] | Awaitable[None] | None = None)[source]

Subscribe to COV notification for a given address and objectID If callback is provided, it will be called with the value of the COV notification So the function must be built to accept two arguments : property_identifier and property_value

property cov_tasks
create_save_to_influxdb_task(delay: int = 60) None[source]
property devices
disconnect() Task[source]
get_device_by_id(id)[source]
i_am()[source]
log(note, *, level: str | int = 10)

Add a log entry…no note

log_subtitle(subtitle, args=None, width=35)
log_title(title, args=None, width=35)
logname = 'BAC0.scripts.Lite | Lite'
note(note, *, level=20, log=True)

Add note to the object. By default, the note will also be logged :param note: (str) The note itself :param level: (logging.level) :param log: (boolean) Enable or disable logging of note

property notes

Retrieve notes list as a Pandas Series

async ping_registered_devices() None[source]

Registered device on a network (self) are kept in a list (registered_devices). This function will allow pinging thoses device regularly to monitor them. In case of disconnected devices, we will disconnect the device (which will save it). Then we’ll ping again until reconnection, where the device will be bring back online.

To permanently disconnect a device, an explicit device.disconnect(unregister=True [default value]) will be needed. This way, the device won’t be in the registered_devices list and BAC0 won’t try to ping it.

register_device(device: RPDeviceConnected | RPMDeviceConnected) None[source]
property registered_devices

Devices that have been created using BAC0.device(args)

remove_trend(point_to_remove: Point | _TrendLog | VirtualPoint) None[source]

Remove point from the list of histories that will be handled by Bokeh

Argument provided must be of type Point or TrendLog ex. bacnet.remove_trend(controller[‘point_name’])

async save_registered_devices_to_db(delay: int = 60) None[source]
property tasks: List[Task]

This will present a list of all registered tasks

property trends: List[Any]

This will present a list of all registered trends used by Bokeh Server

unregister_device(device)[source]

Remove from the registered list

Module contents