def __init__(self, type, token, information="empty"): ThreadContainer.__init__(self, type, token, information="empty") self.lastval = 0 self.information = information ## # Hardware Initialization ## try: #try: lib=Config.absPath+Config.get("avrBridge", "lib") #print lib self.mega=cdll.LoadLibrary(lib) self.mega.initUsbLib() self.port = 1 #print '!-!-!-!-! PLANTMONITOR sucessfully initialized' for tuple in Config.getSection("Plantmonitor"): tmpcont = Container("plugin", tuple[0], tuple[1]) tmpcont.pin = tuple[1] tmpcont.setUse(self.leafuse) self.mega.setPortPinDir(self.port,tmpcont.pin,0) self.mega.setPortPin(self.port,tmpcont.pin,1) self.addChild(tmpcont) except Exception,e: print "[PLANTMONITOR ERROR] Could not init plugin\n"+str(e)
def sched(self): d = Config.getSection("Scheduler") if not d == []: #print d while True: sleeptime = None for elem in d: rhythm = eval(elem[1].split("|")[1]) # when has the thread to wake up next time for specific value? tmp = rhythm - round(time.time()) % rhythm if not sleeptime: sleeptime = tmp if sleeptime > tmp: sleeptime = tmp time.sleep(sleeptime) execute = [] for elem in d: rhythm = eval(elem[1].split("|")[1]) if rhythm - round(time.time()) % rhythm == rhythm: execute.append(elem) for elem in execute: addr = Address(elem[1].split("|")[0]) print addr.__str__() print EventEngine.root.getByAddress(addr.__str__()).use()
def __init__(self, token, configFile): PlugIn.__init__(self) self.architecture = "all" self.override_dict ={} self.jid = Config.get("jabber","jid") global backend backend = Config.get("Defaults","backend") global scenario scenario = "default" #plugin itself self.content = Container("plugin", token, "This is a Defaults Plugin") self.content.addContainer("cmd","getBackend","getBackend", self.getBackend) for pair in Config.getSection("Defaults"): if pair[0].endswith('_plain'): title= pair[0].replace('_plain','') container = Container("cmd",title,pair[1],self.general) container.rendering = Container.PLAIN else: container = Container("cmd",pair[0],pair[1],self.general) container.setUseArgs(backend) self.content.addChild(container) #self.content.addContainer("cmd", pair[0], pair[1], use=self.general, args="test") self.content.addContainer("cmd","set","set",self.override) self.content.addContainer("cmd","setScenario","set a Scenario", self.setScenario) self.content.addContainer("cmd","getScenario", "get current Scenario", self.getScenario)
def __init__(self, token, configFile): PlugIn.__init__(self) self.architecture = "all" #plugin itself self.content = Container("plugin", token, "This is a global Status Plugin") self.content.logging = True # set add container if not Config.getSection('Global').__eq__(''): for pair in Config.getSection("Global"): container = Container("cmd", pair[0], "global cmd" ) container.setUse(self.getState,pair[1]) self.content.addChild(container)
def __init__(self, token, configFile): PlugIn.__init__(self) self.architecture = "all" #plugin itself self.content = Container("plugin", token, "Filesystem Plugin") # load all items from config for pair in Config.getSection("Filesystem"): print "+-+"+Config.absPath print pair[0], pair[1] self.loadFilesystem(pair)
def __init__(self, token, configFile): PlugIn.__init__(self) self.architecture = "all" #plugin itself, is threaded uses the its process method self.content = ThreadContainer("plugin", token, "This hopefully will be a Threaded Feedreader Plugin") #ThreadContainer self.content.setDo(self.process) self.content.setUse(self.display) for touple in Config.getSection("FeedReader"): #t = touple.split(">") tmpcont = Container("plugin", touple[0], touple[1]) #tmpcont.setUse(self.display) self.content.addChild(tmpcont) self.content.addContainer("cmd", "Random", "/FeedReader/mondayjazz", self.playRandom) self.content.start()
def __init__(self, token, configFile): PlugIn.__init__(self) self.architecture = "all" #plugin itself self.content = Container("plugin", token, "This is a Defaults Plugin") # add container, set information to standard-path from config #self.content.addContainer("cmd", "Play", Config.audioPlay, self.play) #self.content.addContainer("cmd", "Stop", Config.audioStop, self.stop) #self.content.addContainer("cmd", "SetVol", Config.setVol, self.setVol) #self.content.addContainer("cmd", "Notification", Config.setVol, self.notify) for pair in Config.getSection("Defaults"): self.content.addContainer("cmd", pair[0], pair[1], self.general)
def __init__(self, token, configFile): PlugIn.__init__(self) self.architecture = "all" self.jid = Config.get("jabber","jid") #plugin itself self.content = Container("plugin", token, "This is a Sensors Plugin") cmd="" for pair in Config.getSection("Sensors"): if '?' in pair[1]: tmp = pair[1].split('?') self.content.arg = tmp[1].replace('string=','') cmd = tmp[0] else: self.content.arg="" if pair[0].endswith('_plain'): title= pair[0].replace('_plain','') container = Container("cmd",title,pair[1],self.general) container.rendering = Container.PLAIN else: container = Container("cmd",pair[0],cmd,self.general) self.content.addChild(container)