Example #1
0
    def __init__(self,
                 object_id,
                 instance_id,
                 default_value=0,
                 type=DatastoreType.STATIC):
        #
        # 各識別子の定義
        #
        self.key = None
        self.type = type
        self.object_id = object_id
        self.instance_id = instance_id
        self.property_id = 85
        self.identifier = 'presentValue'

        #
        # スーパクラスのコンストラクタ呼び出し
        #
        Property.__init__(self,
                          self.identifier,
                          Real,
                          default=0.0,
                          optional=True,
                          mutable=False)

        #
        # 初期値のセットアップ
        #
        self.setType(type, default_value)
Example #2
0
    def __init__(self, object_id, instance_id, default_value=0.0):
        #
        # 各識別子の定義
        #
        self.object_id = object_id
        self.instance_id = instance_id
        self.property_id = 85
        self.identifier = 'presentValue'

        #
        # スーパクラスのコンストラクタ呼び出し
        #
        Property.__init__(self,
                          self.identifier,
                          Real,
                          default=0.0,
                          optional=True,
                          mutable=False)

        #
        # 初期値のセットアップ
        #
        datastore = SingleBACnetd().getDatastore()
        datastore.set(self.object_id, self.instance_id, self.property_id,
                      default_value)
Example #3
0
 def __init__(self, identifier):
     Property.__init__(self,
                       identifier,
                       Boolean,
                       default=0.0,
                       optional=False,
                       mutable=False)
Example #4
0
 def __init__(self):
     if _debug: ChannelValueProperty._debug("__init__")
     Property.__init__(self,
                       'presentValue',
                       ChannelValue,
                       default=None,
                       optional=False,
                       mutable=True)
Example #5
0
 def __init__(self, identifier):
     if _debug: RandomValueProperty._debug("__init__ %r", identifier)
     Property.__init__(self,
                       identifier,
                       Real,
                       default=None,
                       optional=True,
                       mutable=False)
Example #6
0
 def __init__(self, identifier):
     if _debug:
         BIPresentValue._debug("__init__ %r", identifier)
     Property.__init__(self,
                       identifier,
                       BinaryPV,
                       default=False,
                       optional=False,
                       mutable=False)
Example #7
0
 def __init__(self, identifier):
     if _debug: ModbusValueProperty._debug("__init__ %r", identifier)
     self.register_reader = None
     Property.__init__(self,
                       identifier,
                       Real,
                       default=None,
                       optional=True,
                       mutable=False)
Example #8
0
    def __init__(self, identifier):
        if _debug: RandomValueProperty._debug("__init__ %r", identifier)
        Property.__init__(self,
                          identifier,
                          Real,
                          default=None,
                          optional=True,
                          mutable=False)

        # writing to this property changes the multiplier
        self.multiplier = 100.0
Example #9
0
        def wrapper(*args, **kwargs):
            if callable(func):
                obj = func(*args, **kwargs)
            else:
                obj = func
            allowed_prop = _allowed_prop(obj)

            for property_name, value in properties.items():
                if property_name == "units":
                    new_prop = EngineeringUnits.enumerations[value]
                    obj.units = new_prop
                else:
                    try:
                        mutable = _mutable(property_name)
                        new_prop = Property(
                            property_name,
                            allowed_prop[property_name],
                            default=value,
                            mutable=mutable,
                        )
                    except KeyError:
                        raise ValueError(
                            "Invalid property ({}) for object".format(
                                property_name))
                    obj.add_property(new_prop)
            return obj
class RandomAnalogValueObject(AnalogValueObject):

    properties = [
        RandomValueProperty('presentValue'),
        Property('eventMessageTexts', ArrayOf(CharacterString), mutable=True),
    ]

    def __init__(self, **kwargs):
        if _debug: RandomAnalogValueObject._debug("__init__ %r", kwargs)
        AnalogValueObject.__init__(self, **kwargs)
Example #11
0
class TECSupOnline(BinaryValueObject):
    """
    This class will provide to a BAC0 device referring to a Johnson Controls TEC3000
    thermostats the Supervisor Online variable. This will allow testing of remote
    occupancy schedules.
    """

    objectType = "device"
    vendor_id = 5

    properties = [Property(3653, Boolean, mutable=True)]

    def __init__(self, **kwargs):
        BinaryValueObject.__init__(self, **kwargs)
Example #12
0
def create_proprietary_object(params):
    try:
        _validate_params(params)
    except:
        raise
    props = [
        Property(v["obj_id"], v["primitive"], mutable=v["mutable"])
        for k, v in params["properties"].items()
    ]

    new_class = type(
        params["name"],
        (params["bacpypes_type"],),
        {"objectType": params["objectType"], "properties": props},
    )
    register_object_type(new_class, vendor_id=params["vendor_id"])
Example #13
0
 def __init__(self, identifier):
     Property.__init__(
         self, identifier, SequenceOf(COVSubscription),
         default=None, optional=True, mutable=False,
         )
 def __init__(
     self, identifier, datatype, default=None, optional=True, mutable=False
 ):
     Property.__init__(self, identifier, datatype, default, optional, mutable)
Example #15
0
 def __init__(self, identifier):
     if _debug:
         DOPresentValue._debug("__init__ %r", identifier)
     Property.__init__(
         self, identifier, BinaryPV, default=BinaryPV("inactive"), optional=False, mutable=True
     )
 def __init__(self, identifier):
     if _debug: RandomValueProperty._debug("__init__ %r", identifier)
     Property.__init__(self, identifier, Real, default=None, optional=True, mutable=False)
 def __init__(self, identifier):
     if _debug: CurrentDateTimeProperty._debug("__init__ %r", identifier)
     Property.__init__(self, identifier, DateTime, default=None, optional=True, mutable=False)
Example #18
0
    def __init__(self, identifier):
        if _debug: RandomValueProperty._debug("__init__ %r", identifier)
        Property.__init__(self, identifier, Real, default=None, optional=True, mutable=False)

        # writing to this property changes the multiplier
        self.multiplier = 100.0
Example #19
0
 def __init__(self, identifier):
     if _debug: CurrentDateTimeProperty._debug("__init__ %r", identifier)
     Property.__init__(self, identifier, DateTime, default=None, optional=True, mutable=False)