Beispiel #1
0
def testMethod():
    ser = initSerial()
    lightid = 11430977
    lightOff = LightBusCommand(False, lightid)
    ser.write(lightOff.getMessage())
    time.sleep(2)
    lightOn = LightBusCommand(True, lightid)
    ser.write(lightOn.getMessage())
    time.sleep(2)
    ser.write(lightOff.getMessage())
#    ser.write("*1*0*#11430977##")
    ser.close()
Beispiel #2
0
 def do_POST(self):
     if(self.headers.getheader('Content-type') == "application/switchLight"):
         id = self.headers.getheader('LightId')
         on = self.headers.getheader('On')
         print "allumer la lumiere " + str(id)  + " " + str(on)
         cmd = LightBusCommand(1 if on == "1" else 0, id)
         try:
             serialCom.write(cmd.getMessage())
         except BaseException,e:
             print "error= " + str(e)
Beispiel #3
0
 def __switchLights(self, on):
     cmd = LightBusCommand(on, self.light.getId())
     self.serialCom.write(cmd.getMessage())