JoelBender / BACpypes3

BACnet communications library
33 stars 7 forks source link

How to create proprietary object with proprietary properties #35

Closed xkostrna closed 3 months ago

xkostrna commented 3 months ago

Hello dear Joel.

We were able to create proprietary object with proprietary properties using BAC0 like this:

from BAC0.core.proprietary_objects.object import create_proprietary_object
from bacpypes.object import ProgramObject
from bacpypes.primitivedata import Enumerated

proprietary_Object = {
    "name": "proprietary_Object",
    "vendor_id": 111,
    "objectType": "program",
    "bacpypes_type": ProgramObject,
    "properties": {
        "ProgramChange": {"obj_id": 22,
                          "primitive": Enumerated,
                          "mutable": True},

    },
}

create_proprietary_object(proprietary_Object)

However we would like to use your library bacpypes3 to create it but we can't figure it out from the examples you provided, even after long hours of trying to write some code we only come up with this:

from bacpypes3.object import ProgramObject
from bacpypes3.basetypes import ObjectIdentifier
from bacpypes3.primitivedata import CharacterString

class ProprietaryObject(ProgramObject):
    objectIdentifier = ObjectIdentifier("program")  # ?
    objectName = CharacterString("ProprietaryObject")  # ?

...

Can you please provide more examples or something that could help us create proprietary objects with proprietary properties ? We would be really thankful !

ChristianTremblay commented 3 months ago

You can have a look to the "async" branch of BAC0

I'm rewriting it to use bacpypes3

You will see how I dealt with this and it can help with your own implementation.