JoelBender / bacpypes

BACpypes provides a BACnet application layer and network layer written in Python for daemons, scripting, and graphical interfaces.
MIT License
302 stars 129 forks source link

DeviceId of BIPSimpleApplication #430

Closed mayeranalytics closed 3 years ago

mayeranalytics commented 3 years ago

Apparently BACnet device has a DeviceId. So, presumably, a BIPSimpleApplication must have a DeviceId, is that correct? If yes, how can I find it or set it?

JoelBender commented 3 years ago

Correct. The "device identifier" is a common shortcut for saying "the 22-bit unsigned instance number of the Object Identifier of the Device Object in the device that speaks BACnet." Starting with the ReadProperty.py sample application, an instance of the stack is passed a reference to a LocalDeviceObject and an address:

    # make a simple application
    this_application = BIPSimpleApplication(this_device, args.ini.address)

A little earlier in that same code is building the object:

    # make a device object
    this_device = LocalDeviceObject(ini=args.ini)
    if _debug:
        _log.debug("    - this_device: %r", this_device)

And the ini parameter says "please get the properties of this object from the INI file", which defaults to BACpypes.ini and can be redirected using the --ini command line argument.

When you cloned the project you get a sample BACpypes~.ini which you can duplicate and edit to fit your BACnet environment. The objectIdentifier: line contains the device identifier (which in this case is just the instance number because it is always a device object). Note that the INI file also contains the BACnet address of your workstation/server in CIDR notation.

mayeranalytics commented 3 years ago

Thanks for the very detailed answer! (The word "DeviceId" puzzled me - that was Honeywell talking, by the way...)