import tools
from config import Config
-from plcapi import PLCAPI
-
+from plcapi import PLCAPI
+import random
savedargv = sys.argv[:]
def GetSlivers(plc):
data = plc.GetSlivers()
+ # net needs access to API for i2 nodes.
for module in modules:
- callback = getattr(module, 'GetSlivers')
- callback(data)
+ if module.__name__ == 'net':
+ module.GetSlivers(plc, data)
+ else:
+ callback = getattr(module, 'GetSlivers')
+ callback(data)
def run():
try:
while True:
try: GetSlivers(plc)
except: logger.log_exc()
- time.sleep(options.period)
+ time.sleep(options.period + random.randrange(0,301))
except: logger.log_exc()