Exemplo n.º 1
0
    def testMimicVolts(self):
        # default should be five volts
        h = wb6.SendHTTP(
            underTestAddress, "SM0;63;1;0"
        )  # make sure Mimics full off or full on and fade fast & 5V
        self.assertEqual(h, True)

        h = wb6.DigOn(underTestAddress, 0)
        print "Return from DigOn is %s" % h
        self.assertEqual(h, True)

        print "----  In 30 second wait ----"
        time.sleep(30)

        self.expectMimicVolts(20, 40)

        wb6.SendHTTP(
            underTestAddress, "SM0;63;1;1"
        )  # make sure Mimics full off or full on and fade fast & 12V
        self.expectMimicVolts(
            55, 90)  # 55 in case running off 12V instead of 13.8V

        wb6.SendHTTP(
            underTestAddress, "SM0;63;1;0"
        )  # make sure Mimics full off or full on and fade fast & 5V
        wb6.DigOff(underTestAddress, 0)

        self.assertEqual(self.ErrorCount, 0)
Exemplo n.º 2
0
 def sendSerialWb(self, addr):
     time.sleep(0.5)
     for i in range( ord('a'), ord('z')+1-6, 6 ):
         wb6.SendHTTP(addr,"RD%s;%s;%s;%s;%s;%s" % (i, i+1, i+2, i+3, i+4, i+5)  )
         time.sleep(0.5)
     i = i + 6
     wb6.SendHTTP(addr,"RD%s;%s" % (i, i+1)  )
     time.sleep(0.1)
Exemplo n.º 3
0
    def testMimicVolts(self):
        # default should be five volts
        wb6.SendHTTP( underTestAddress,"SM0;63;1;0" )    # make sure Mimics full off or full on and fade fast & 5V

        wb6.DigOn( underTestAddress, 0 )
        self.expectMimicVolts(20, 40)
        
        wb6.SendHTTP( underTestAddress,"SM0;63;1;1" )    # make sure Mimics full off or full on and fade fast & 12V
        self.expectMimicVolts(55, 90)   # 55 in case running off 12V instead of 13.8V

        wb6.SendHTTP( underTestAddress,"SM0;63;1;0" )    # make sure Mimics full off or full on and fade fast & 5V
        wb6.DigOff( underTestAddress, 0 )

        self.assertEqual( self.ErrorCount, 0 )
Exemplo n.º 4
0
    def testSerial485OutOfWebBrick(self):
        wb6.DigOn( controlWbAddress, CONTROL_SERIAL_RELAY )
        wb6.SendHTTP( underTestAddress,"CR4" ) # RS485
        wb6.SendHTTP( controlWbAddress,"CR4" ) # RS485
        wb6.SendHTTP( controlWbAddress,"RI" ) # RS485 input
        wb6.SendHTTP( underTestAddress,"RO" ) # RS485 output

        self.captureEvents()

        self.verifySerial(underTestAddress, self.getSerialControlWb)

        wb6.SendHTTP( underTestAddress,"RI" ) # RS485 input
        wb6.DigOff( controlWbAddress, CONTROL_SERIAL_RELAY )

        self.assertEqual( self.ErrorCount, 0 )
Exemplo n.º 5
0
def doDmxCmd(chn, level):
    if doInvert:
        cmd = "DX%i;%i" % (chn, (255 - level))
    else:
        cmd = "DX%i;%i" % (chn, level)
    print cmd
    wb6.SendHTTP(targetIP, cmd)
Exemplo n.º 6
0
def init():
    global initDone
    if not initDone:
        wb6.Login(targetIP, "installer")
        wb6.SendHTTP(targetIP, "CR3")  # DMX
        for idx in range(1, 9, 1):
            doDmxCmd(idx, 0)
        initDone = True
Exemplo n.º 7
0
    def testSerial485InToWebBrick(self):
        # ensure relay connected for RS232
        wb6.DigOn( controlWbAddress, CONTROL_SERIAL_RELAY )
        
        wb6.SendHTTP( underTestAddress,"CR4" ) # RS485
        wb6.SendHTTP( controlWbAddress,"CR4" ) # RS485
        wb6.SendHTTP( underTestAddress,"RI" ) # RS485 input
        wb6.SendHTTP( controlWbAddress,"RO" ) # RS485 output

        self.captureEvents()

        self.verifySerial(controlWbAddress, self.getSerialUnderTestWb)

        wb6.SendHTTP( controlWbAddress,"RI" ) # RS485 output
        wb6.DigOff( controlWbAddress, CONTROL_SERIAL_RELAY )

        self.assertEqual( self.ErrorCount, 0 )
Exemplo n.º 8
0
    def setUp(self):
        # Called before every test
        self.testStartAt = time.time()
        self.ErrorCount = 0
        self.ErrorMsgs = list()
        self.MimicErrorCount = 0
        self.DigitalErrorCount = 0
        self.testName = ""
        self.newTest = False
        # flush ARP cache, this does iot every test
        os.system("arp -d %s" % underTestAddress)
        #        os.system( "arp -d *" )

        self.doLogin(underTestAddress)
        self.doLogin(controlWbAddress)
        time.sleep(0.1)
        wb6.Send(underTestAddress,
                 'SO1;1')  # disable UDP events for analigue etc
        #        wb6.Send(underTestAddress,'SO2;1')   # Read continuous on analogue inputs.
        wb6.Send(controlWbAddress,
                 'SO1;1')  # disable UDP events for analigue etc
        wb6.Send(controlWbAddress,
                 'SO2;1')  # Read continuous on analogue inputs.

        # ensure relay connected for RS232
        wb6.DigOff(controlWbAddress, CONTROL_SERIAL_RELAY)

        wb6.SendHTTP(underTestAddress, "CR2")  # RS232
        wb6.SendHTTP(controlWbAddress, "CR2")  # RS232

        # we only need to reset all actions on first test of run.
        global FirstTest
        if FirstTest:
            wb6.Send(underTestAddress, 'RT')  # rescan temp bus
            self.disableWebBrickActions(underTestAddress)
            self.disableWebBrickActions(controlWbAddress)
            FirstTest = False

        self.tgt = None
        self.udp = None
        #        print( "Test Setup %f seconds" % (time.time() - self.testStartAt) )

        return
Exemplo n.º 9
0
def serialInAndOut():
    
    port = OpenPort()
        
    for idx in range(1000):
        # address
        wb6.SendHTTP(targetIP,serCmd[idx % len(serCmd)] )
        port.write( strings[idx % len(strings)] )
#        time.sleep(0.5)
    port.close()
    port = None
Exemplo n.º 10
0
    def setConfiguration(self):
        logging.info( "setConfiguration" )
        wb6.SendHTTP( underTestAddress,"SM0;63;1;0" )    # make sure Mimics full off or full on and fade fast
        self.disableWebBrickActions(underTestAddress)

        wb6.ConfigFadeRate(underTestAddress, 1 )
        for idx in range(0,8):
            wb6.DigOff( underTestAddress, idx )
        # force a change that Wb will see.
        wb6.DigOn( underTestAddress, 1 )
        wb6.DigOff( underTestAddress, 1 )
        self.assertEqual( self.ErrorCount, 0 )
Exemplo n.º 11
0
    def testDigitals(self):
        # Combine digital and mimic tests
        # include triac tests

        # get current temps  for main lamps.
        triacMap = (1, 2, 3, 4)  # maps triac index to temp index.

        savedTemps = list()
        sts2 = self.loadWbStatus(controlWbAddress)
        owSts = sts2.getOneWireBus()
        for idx in range(0, 4):
            tidx = triacMap[idx]
            if (owSts & (0x01 << tidx)) == 0:
                self.error('Not seeing temperature Triac/Lamp: %i (%i)' %
                           (idx, tidx))
                savedTemps.append(0)
            else:
                savedTemps.append(sts2.getTemp(tidx))

        wb6.SendHTTP(
            underTestAddress,
            "SM0;63;1;0")  # make sure Mimics full off or full on and fade fast
        # tests digital in 0-7 and digital out 0-7/mimics 0-7. The later depends on the conenction to the inputs
        for idx in range(0, 8):
            self.testADigitalChannel(idx)

        # leave all on for soak test
        for idx in range(0, 8):
            wb6.DigOn(underTestAddress, idx)

        # get current temps.
        # see whether mains lamps switched on during this test run.
        # they should of generated enough of a temperature rise to be detected.
        sts2 = self.loadWbStatus(controlWbAddress)
        owSts = sts2.getOneWireBus()

        for idx in range(0, 4):
            tidx = triacMap[idx]
            if (owSts & (0x01 << tidx)) != 0:
                # check we had a sensor.
                tv = sts2.getTemp(tidx)
                if (savedTemps[idx] + 3) > tv:
                    self.error(
                        'Not seeing temperature rise for Triac/Lamp: %i Old Temp %s new Temp %s'
                        % (idx, savedTemps[idx], tv))

        self.assertEqual(self.DigitalErrorCount, 0)
        self.assertEqual(self.MimicErrorCount, 0)
        self.assertEqual(self.ErrorCount, 0)
Exemplo n.º 12
0
import sys
sys.path.append('../API')
#
# WBExercise
#
#  Andy Harris
#
#  Beat the living daylights out of a WebBrick till it gives up
#

import wb6, wbUdp, time

#targetIP = 'mail.thirtover.com:84'
targetIP = '10.100.100.100'

wb6.Login(targetIP, "password")
wb6.SendHTTP(targetIP, "ITN")
wb6.SendHTTP(targetIP, "IRN")
while 1:
    # address
    for i in range(32):
        # channel
        for j in range(64):
            wb6.SendHTTP(targetIP, "IS" + str(i) + ";" + str(j))
            time.sleep(0.1)
Exemplo n.º 13
0
 def sendControlCommand(self, cmd):
     # send a command to a webbrick
     wb6.SendHTTP(controlWbAddress, cmd)
Exemplo n.º 14
0
 def sendTestCommand(self, cmd):
     wb6.SendHTTP(underTestAddress, cmd)
Exemplo n.º 15
0
def doNumericLvl(val):
    print "Level %s" % (val)
    cmd = "AV0;%i" % val
    wb6.SendHTTP(targetIP, cmd)
Exemplo n.º 16
0
def serialOut():
    for idx in range(10):
        # address
        for s in serCmd:
            wb6.SendHTTP(targetIP,s  )
        time.sleep(1.0)
Exemplo n.º 17
0
def sendHttp( pat ):
    while 1:
        for i in range(8):
            cmd = makeCmd( pat[i] )
            wb6.SendHTTP(targetIP, cmd)
            time.sleep(0.5)
Exemplo n.º 18
0
            print s
            port.write( s )
            time.sleep(0.1)
        # address
        time.sleep(1.0)

    # close comm port
    port.close()
    port = None

# add if main here and parameter checking.
   
wb6.Login( targetIP,"installer" )
if doRs485:
    cmd = "CR4;%i"%(BaudIdx)
    wb6.SendHTTP(targetIP,cmd  ) # RS485
else:
    cmd = "CR2;%i"%(BaudIdx)
print "setup %s" % cmd    
wb6.SendHTTP(targetIP,cmd ) # RS232
    
if doRs485:
    if doSend:
        wb6.SendHTTP(targetIP,"RO" ) # RS485 output
    else:
        wb6.SendHTTP(targetIP,"RI" ) # RS485 input

    
if doTest == 0:
    serialOut()
elif doTest == 1: