def __init__(self,parent=None, **kw): Frame.__init__(self,parent,**kw) self.lights = LightBoxes(self,text="Lights",padx=5,pady=5) self.lights.grid(row=4,column=0,columnspan=3,sticky=E+W) ip = '192.168.1.76' port = '8080' self.d = DomoticzGateway(ip,port) self.getLights()
class HomeAutomation(Frame): def __init__(self,parent=None, **kw): Frame.__init__(self,parent,**kw) self.lights = LightBoxes(self,text="Lights",padx=5,pady=5) self.lights.grid(row=4,column=0,columnspan=3,sticky=E+W) ip = '192.168.1.76' port = '8080' self.d = DomoticzGateway(ip,port) self.getLights() def getLights(self): lights = self.d.getLights() for light in self.d.lights: self.lights.addLight(light['Name']) def lightCommand(self,light,cmd): #print light, cmd index = self.d.getLightIndex(light) #print "Light: ",light, " Index:", index self.d.commandLight(index,cmd)