BAC0.core.io package¶
Submodules¶
BAC0.core.io.IOExceptions module¶
IOExceptions.py - BAC0 application level exceptions
-
exception
BAC0.core.io.IOExceptions.
ApplicationNotStarted
[source]¶ Bases:
Exception
Application not started, no communication available.
-
exception
BAC0.core.io.IOExceptions.
BokehServerCantStart
[source]¶ Bases:
Exception
Raised if Bokeh Server can’t be started automatically
-
exception
BAC0.core.io.IOExceptions.
BufferOverflow
[source]¶ Bases:
Exception
Buffer capacity of device exceeded.
-
exception
BAC0.core.io.IOExceptions.
NetworkInterfaceException
[source]¶ Bases:
Exception
This exception covers different network related exc eption (like finding IP or subnet mask…)
-
exception
BAC0.core.io.IOExceptions.
NoResponseFromController
[source]¶ Bases:
Exception
This exception is used when trying to read or write and there is not answer.
-
exception
BAC0.core.io.IOExceptions.
OutOfServiceNotSet
[source]¶ Bases:
Exception
This exception is used when trying to simulate a point and the out of service property is false.
-
exception
BAC0.core.io.IOExceptions.
OutOfServiceSet
[source]¶ Bases:
Exception
This exception is used when trying to set the out of service property to false to release the simulation…and it doesn’t work.
-
exception
BAC0.core.io.IOExceptions.
ReadPropertyException
[source]¶ Bases:
ValueError
This exception is used when trying to read a property.
-
exception
BAC0.core.io.IOExceptions.
ReadPropertyMultipleException
[source]¶ Bases:
ValueError
This exception is used when trying to read multiple properties.
-
exception
BAC0.core.io.IOExceptions.
ReadRangeException
[source]¶ Bases:
ValueError
This exception is used when trying to read a property.
-
exception
BAC0.core.io.IOExceptions.
RemovedPointException
[source]¶ Bases:
Exception
When defining a device from DB it may not be identical to the actual device.
-
exception
BAC0.core.io.IOExceptions.
UnrecognizedService
[source]¶ Bases:
Exception
This exception is used when trying to read or write and there is not answer.
-
exception
BAC0.core.io.IOExceptions.
WriteAccessDenied
[source]¶ Bases:
Exception
This exception is used when trying to write and controller refuse it.
-
exception
BAC0.core.io.IOExceptions.
WritePropertyCastError
[source]¶ Bases:
Exception
This exception is used when trying to write to a property and a cast error occurs.
BAC0.core.io.Read module¶
Read.py - creation of ReadProperty and ReadPropertyMultiple requests
Used while defining an app: Example:
class BasicScript(WhoisIAm, ReadProperty)Class:
ReadProperty() def read() def readMultiple()
-
class
BAC0.core.io.Read.
ReadProperty
[source]¶ Bases:
object
Defines BACnet Read functions: readProperty and readPropertyMultiple. Data exchange is made via a Queue object A timeout of 10 seconds allows detection of invalid device or communciation errors.
-
build_rp_request
(args: List[str], arr_index=None, vendor_id: int = 0, bacoid=None) → bacpypes.apdu.ReadPropertyRequest[source]¶
-
build_rpm_request
(args: List[str], vendor_id: int = 0) → bacpypes.apdu.ReadPropertyMultipleRequest[source]¶ Build request from args
-
build_rpm_request_from_dict
(request_dict, vendor_id)[source]¶ Read property multiple allow to read a lot of properties with only one request The existing RPM function is made using a string that must be created using bacpypes console style and is hard to automate.
This new version will be an attempt to improve that:
_rpm = {'address': '11:2', 'objects': {'analogInput:1': ['presentValue', 'description', 'unit', 'objectList@idx:0'], 'analogInput:2': ['presentValue', 'description', 'unit', 'objectList@idx:0'], }, vendor_id: 842 }
-
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.io.Read | ReadProperty'¶
-
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
-
read
(args: str, arr_index: Optional[int] = None, vendor_id: int = 0, bacoid=None, timeout: int = 10, show_property_name: bool = False) → Union[float, str, List[T], Tuple[Union[float, str, List[T]], str], None][source]¶ Build a ReadProperty request, wait for the answer and return the value
Parameters: args – String with <addr> <type> <inst> <prop> [ <indx> ] Returns: data read from device (str representing data like 10 or True) Example:
import BAC0 myIPAddr = '192.168.1.10/24' bacnet = BAC0.connect(ip = myIPAddr) bacnet.read('2:5 analogInput 1 presentValue')
Requests the controller at (Network 2, address 5) for the presentValue of its analog input 1 (AI:1).
-
readMultiple
(args: str, request_dict=None, vendor_id: int = 0, timeout: int = 10, show_property_name: bool = False) → Union[Dict[KT, VT], List[Tuple[Any, str]]][source]¶ Build a ReadPropertyMultiple request, wait for the answer and return the values
Parameters: args – String with <addr> ( <type> <inst> ( <prop> [ <indx> ] )… )… Returns: data read from device (str representing data like 10 or True) Example:
import BAC0 myIPAddr = '192.168.1.10/24' bacnet = BAC0.connect(ip = myIPAddr) bacnet.readMultiple('2:5 analogInput 1 presentValue units')
Requests the controller at (Network 2, address 5) for the (presentValue and units) of its analog input 1 (AI:1).
-
readRange
(args, range_params=None, arr_index=None, vendor_id=0, bacoid=None, timeout=10)[source]¶ Build a ReadProperty request, wait for the answer and return the value
Parameters: args – String with <addr> <type> <inst> <prop> [ <indx> ] Returns: data read from device (str representing data like 10 or True) Example:
import BAC0 myIPAddr = '192.168.1.10/24' bacnet = BAC0.connect(ip = myIPAddr) bacnet.read('2:5 analogInput 1 presentValue')
Requests the controller at (Network 2, address 5) for the presentValue of its analog input 1 (AI:1).
-
BAC0.core.io.Simulate module¶
Simulate.py - simulate the value of controller I/O values
-
class
BAC0.core.io.Simulate.
Simulation
[source]¶ Bases:
object
Global informations regarding simulation
-
out_of_service
(args)[source]¶ Set the Out_Of_Service property so the Present_Value of an I/O may be written.
Parameters: args – String with <addr> <type> <inst> <prop> <value> [ <indx> ] [ <priority> ]
-
BAC0.core.io.Write module¶
Write.py - creation of WriteProperty requests
Used while defining an app Example:
class BasicScript(WhoisIAm, WriteProperty)Class:
WriteProperty() def write()
-
class
BAC0.core.io.Write.
WriteProperty
[source]¶ Bases:
object
Defines BACnet Write functions: WriteProperty [WritePropertyMultiple not supported]
-
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.io.Write | WriteProperty'¶
-
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
-
write
(args, vendor_id=0, timeout=10)[source]¶ Build a WriteProperty request, wait for an answer, and return status [True if ok, False if not].
Parameters: args – String with <addr> <type> <inst> <prop> <value> [ <indx> ] - [ <priority> ] Returns: return status [True if ok, False if not] Example:
import BAC0 bacnet = BAC0.lite() bacnet.write('2:5 analogValue 1 presentValue 100 - 8')
Direct the controller at (Network 2, address 5) to write 100 to the presentValues of its analogValue 1 (AV:1) at priority 8
-
writeMultiple
(addr=None, args=None, vendor_id=0, timeout=10)[source]¶ Build a WritePropertyMultiple request, wait for an answer
Parameters: - addr – destination of request (ex. ‘2:3’ or ‘192.168.1.2’)
- args – list of String with <type> <inst> <prop> <value> [ <indx> ] - [ <priority> ]
- vendor_id – Mandatory for registered proprietary object and properties
- timeout – used by IOCB to discard request if timeout reached
Returns: return status [True if ok, False if not]
Example:
import BAC0 bacnet = BAC0.lite() r = ['analogValue 1 presentValue 100','analogValue 2 presentValue 100','analogValue 3 presentValue 100 - 8','@obj_142 1 @prop_1042 True'] bacnet.writeMultiple(addr='2:5',args=r,vendor_id=842) # or # bacnet.writeMultiple('2:5',r)
-