def __init__(self, **kwargs):
        if _debug: ModbusAnalogInputObject._debug("__init__ %r", kwargs)
        Object.__init__(self, **kwargs)

        # set unassigned properties to default values
        for propid, prop in self._properties.items():
            if prop.ReadProperty(
                    self) is None and propid in modbus_ai_obj_def_vals:
                if _debug:
                    ModbusAnalogInputObject._debug(
                        '%s %s was not set, default is %s', self.objectName,
                        propid, modbus_ai_obj_def_vals[propid])

                prop.WriteProperty(self,
                                   modbus_ai_obj_def_vals[propid],
                                   direct=True)
    def ReadProperty(self, propid, arrayIndex=None):
        # if _debug: ModbusAnalogInputObject._debug('BACnet REQUEST for (%s, %s)  at %s: %s %s',_strftime(decimal_places=3), propid,
        #                                           getattr(self, propid))  # might need self._values[propid]

        # if _debug: ModbusAnalogInputObject._debug('BACnet REQUEST for (%s, %s), (%s, %s): %s at %s',
        #                                           self._app._values['objectName'],
        #                                           self._app._values['objectIdentifier'], self._values['objectName'],
        #                                           self._values['objectIdentifier'], propid, _strftime(decimal_places=3))
        value = Object.ReadProperty(self, propid, arrayIndex=arrayIndex)
        # if _debug: ModbusAnalogInputObject._debug('BACnet REQUEST for (%s, %s), (%s, %s), %s= %s at %s',
        #                                           self._app.localDevice._values['objectName'],
        #                                           self._app.localDevice._values['objectIdentifier'][1],
        #                                           self._values['objectName'], self._values['objectIdentifier'][1],
        #                                           propid, value, _strftime(decimal_places=3))
        if _debug:
            ModbusAnalogInputObject._debug(
                'BACnet REQUEST for (%s, %s), (%s, %s), %s= %s at %s',
                self._app.localDevice.objectName,
                self._app.localDevice.objectIdentifier[1], self.objectName,
                self.objectIdentifier[1], propid, value,
                _strftime(decimal_places=3))
        return value
Esempio n. 3
0
 def __init__(self, **kwargs):
     if _debug: SampleWritableLocation._debug("__init__ %r", kwargs)
     Object.__init__(self, **kwargs)
Esempio n. 4
0
    def test_basic(self):
        """Test basic configuration of a network."""
        if _debug: TestBasic._debug("test_basic")

        # create an object, no properties
        obj = Object()