BAC0.core.functions package

Submodules

BAC0.core.functions.Discover module

Discover.py

Classes needed to make discovering functions on a BACnet network

class BAC0.core.functions.Discover.Discover[source]

Bases: object

Define BACnet WhoIs and IAm functions.

clear_notes()

Clear notes object

iam(destination=None)[source]

Build an IAm response. IAm are sent in response to a WhoIs request that; matches our device ID, whose device range includes us, or is a broadcast. Content is defined by the script (deviceId, vendor, etc…)

Returns:bool

Example:

iam()
init_routing_table(address)[source]

irt <addr>

Send an empty Initialize-Routing-Table message to an address, a router will return an acknowledgement with its routing table configuration.

log(note, *, level=10)

Add a log entry…no note

log_subtitle(subtitle, args=None, width=35)
log_title(title, args=None, width=35)
logname = 'BAC0.core.functions.Discover | Discover'
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

notes

Retrieve notes list as a Pandas Series

what_is_network_number(destination=None)[source]

winn [ <addr> ]

Send a What-Is-Network-Number message. If the address is unspecified the message is locally broadcast.

whois(*args, global_broadcast=False, destination=None)[source]

Build a WhoIs request

Parameters:args – string built as [ <addr>] [ <lolimit> <hilimit> ] optional
Returns:discoveredDevices as a defaultdict(int)

Example:

whois(global_broadcast=True) # WhoIs broadcast globally.  Every device will respond with an IAm
whois('2:5')                 # WhoIs looking for the device at (Network 2, Address 5)
whois('10 1000')             # WhoIs looking for devices in the ID range (10 - 1000)
whois_router_to_network(network=None, *, destination=None)[source]
class BAC0.core.functions.Discover.NetworkServiceElementWithRequests[source]

Bases: bacpypes.iocb.IOController, bacpypes.netservice.NetworkServiceElement

This class will add the capability to send requests at network level And capability to read responses for NPDU Deals with IOCB so the request can be deferred to task manager

clear_notes()

Clear notes object

confirmation(adapter, npdu)[source]
indication(adapter, npdu)[source]
log(note, *, level=10)

Add a log entry…no note

log_subtitle(subtitle, args=None, width=35)
log_title(title, args=None, width=35)
logname = 'BAC0.core.functions.Discover | NetworkServiceElementWithRequests'
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

notes

Retrieve notes list as a Pandas Series

process_io(iocb)[source]

Figure out how to respond to this request. This must be provided by the derived class.

request(arg)[source]
response(adapter, npdu)[source]

BAC0.core.functions.GetIPAddr module

Utility function to retrieve a functionnal IP and a correct broadcast IP address. Goal : not use 255.255.255.255 as a broadcast IP address as it is not accepted by every devices (>3.8.38.1 bacnet.jar of Tridium Jace for example)

class BAC0.core.functions.GetIPAddr.HostIP(port=47808)[source]

Bases: object

Special class to identify host IP informations

address

IP Address using bacpypes Address format

ip_address

IP Address/subnet

ip_address_subnet

IP Address/subnet

mask

Subnet mask

port

IP Port used

BAC0.core.functions.GetIPAddr.validate_ip_address(ip)[source]

BAC0.core.functions.TimeSync module

TimeSync.py - creation of time synch requests

class BAC0.core.functions.TimeSync.TimeSync[source]

Bases: object

Mixin to support Time Synchronisation from BAC0 to other devices

clear_notes()

Clear notes object

log(note, *, level=10)

Add a log entry…no note

log_subtitle(subtitle, args=None, width=35)
log_title(title, args=None, width=35)
logname = 'BAC0.core.functions.TimeSync | TimeSync'
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

notes

Retrieve notes list as a Pandas Series

time_sync(destination=None, datetime=None, UTC=False)[source]

Take local time and send it to devices. User can also provide a datetime value (constructed following bacpypes.basetypes.Datetime format).

To create a DateTime

from bacpypes.basetypes import DateTime
from bacpypes.primitivedata import Date, Time

# Create date and time
_date = Date('2019-08-05')
_time = Time('16:45')

# Create Datetime
_datetime = DateTime(date=_date.value, time=_time.value)

# Pass this to the function
bacnet.time_sync(datetime=_datetime)

BAC0.core.functions.discoverPoints module

Module contents