Example #1
0
    def testScheduledRestart(self):
        self.factoryReset() # from known state
        self.doSetTime( 1, 1, 0 ) # before scheduled event
        # Create a scheduled event
        wb6.ConfigScheduled( self._wbAddress, 2, "1", 1, 2, wb6.TT_DIGITAL, 3, wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0, wb6.UDPT_GENERAL, 98 )
        time.sleep(0.5)
        sts = wb6Status.wb6Status( self._wbAddress )
        assert sts.getError() == 0, str(sts.getError())

        # reboot, let system settle and then move clock forward
        self.doReboot()
        self.doSetTime( 1, 1, 3 ) # after scheduled event
        # now see what has happened
        sts = wb6Status.wb6Status( self._wbAddress )
        assert sts.getDigOut(3), sts.getTime() + " " + str(sts.getDigOut(3))
Example #2
0
    def testAn(self, chn):
        self.setTest('test Analogue channel ' + str(chn) + ' ip address ' +
                     underTestAddress)
        # for analogue level from 0 to 100% in 10% steps.

        # We are going to stop at 80 % due to power supply problems limiting an out
        for i in range(0, 81, 20):
            # set all channels to this level.
            for j in range(0, 4):
                if j != chn:
                    wb6.AnOutPercent(underTestAddress, j, i)
                else:
                    wb6.AnOutPercent(underTestAddress, j, 0)
            time.sleep(0.4)  # let settle, possibly long Fade time
            # for channel under analogue level from 0 to 100% in 10% steps.
            for k in range(0, 81, 20):
                self.showWorking()
                wb6.AnOutPercent(underTestAddress, chn, k)
                time.sleep(0.2)  # Fade time
                sts = wb6Status(underTestAddress)
                for j in range(0, 4):
                    val = sts.getAnIn(j)
                    if j == chn:
                        # should be k
                        if (val < (k - 5)) or (val > (k + 5)):
                            self.error(
                                'test Analogue channel %i expecting %s got %s'
                                % (chn, k, val))
                    else:
                        # should be i
                        if (val < (i - 5)) or (val > (i + 5)):
                            self.error(
                                'test Analogue channel %i verify %i expecting %s got %s'
                                % (chn, j, i, val))
Example #3
0
    def doTestOneAn( self, chn ):
        self.setTest( 'test Analogue channel ' + str(chn) + ' ip address ' + TestWbConfig._wbAddress )
        # for analogue level from 0 to 100% in 10% steps.

        # We are going to stop at 80 % due to power supply problems limiting an out 
        for i in range(0,81,20):
            # set all channels to this level.
            for j in range(0, 4):
                wb6.AnOutPercent( TestWbConfig._wbAddress, j, i )
            time.sleep(0.5)
            # for channel under analogue level from 0 to 100% in 10% steps.
            for k in range(0, 81, 20):
                showWorking()
                wb6.AnOutPercent( TestWbConfig._wbAddress, chn, k )
                # could be a step of 100% which is approx 1 second. Could also 
                # get caught by the A/D timer which reads a channel every second so 4 seconds for the lot.
                time.sleep(0.5)
                sts = wb6Status(TestWbConfig._wbAddress)
                for j in range(0, 4):
                    val = sts.getAnIn(j)
                    if j == chn :
                        # should be k
                        if ( val < ( k - 5 ) ) or ( val > ( k + 5 ) ) :
                            self.error( 'test Analogue channel ' + str(chn) + ' expecting ' + str(k) + ' got ' + str(val) )
                    else:
                        # should be i
                        if ( val < ( i - 5 ) ) or ( val > ( i + 5 ) ) :
                            self.error( 'test Analogue channel ' + str(chn) +  '('+str(k)+') verify channel ' + str(j) + ' expecting ' + str(i) + ' got ' + str(val) )
Example #4
0
    def testAn( self, chn ):
        self.setTest( 'test Analogue channel ' + str(chn) + ' ip address ' + underTestAddress )
        # for analogue level from 0 to 100% in 10% steps.

        # We are going to stop at 80 % due to power supply problems limiting an out 
        for i in range(0,81,20):
            # set all channels to this level.
            for j in range(0, 4):
                if j != chn:
                    wb6.AnOutPercent( underTestAddress, j, i )
                else:
                    wb6.AnOutPercent( underTestAddress, j, 0 )
            time.sleep(0.4) # let settle, possibly long Fade time
            # for channel under analogue level from 0 to 100% in 10% steps.
            for k in range(0, 81, 20):
                self.showWorking()
                wb6.AnOutPercent( underTestAddress, chn, k )
                time.sleep(0.2) # Fade time
                sts = wb6Status(underTestAddress)
                for j in range(0, 4):
                    val = sts.getAnIn(j)
                    if j == chn :
                        # should be k
                        if ( val < ( k - 5 ) ) or ( val > ( k + 5 ) ) :
                            self.error( 'test Analogue channel %i expecting %s got %s' % (chn, k, val) )
                    else:
                        # should be i
                        if ( val < ( i - 5 ) ) or ( val > ( i + 5 ) ) :
                            self.error( 'test Analogue channel %i verify %i expecting %s got %s' % (chn, j, i, val) )
Example #5
0
    def testAnFast( self, chn ):
        self.setTest( 'test Analogue channel ' + str(chn) + ' ip address ' + underTestAddress )
        # for analogue level from 0 to 100% in 10% steps.

        # set all channels to 50 %
        wb6.AnOutPercent( underTestAddress, 0, 0 )
        for j in range(0, 4):
            if j != chn:
                wb6.AnOutPercent( underTestAddress, j, 50 )
            
        #time.sleep(0.4) # let settle, possibly long Fade time
        # for channel under analogue level from 0 to 100% in 10% steps.
        for k in range(0, 81, 20):
            self.showWorking()
            wb6.AnOutPercent( underTestAddress, chn, k )
#            time.sleep(0.2) # Fade time
            time.sleep(0.1) # Fade time
            sts = wb6Status(underTestAddress)
            for j in range(0, 4):
                val = sts.getAnIn(j)
                if j == chn :
                    # should be k
                    if ( val < ( k - 5 ) ) or ( val > ( k + 5 ) ) :
                        self.error( 'test Analogue channel %i expecting %s got %s' % (chn, k, val) )
                else:
                    # should be i
                    if ( val < ( 45 ) ) or ( val > ( 55 ) ) :
                        self.error( 'test Analogue channel %i verify %i expecting %s got %s' % (chn, j, 50, val) )
Example #6
0
 def testCheckClock(self ):
     self.setTest( 'testCheckClock' )
     for idx in range(0,40):
         showWorking()
         time.sleep(1)# allow WB to read RTC on 30 sec boundary after boot.
     now = datetime.datetime.now()
     
     # Hold off at minute boundary.
     while ( now.second < 2 ):
         showWorking()
         time.sleep(1)
         now = datetime.datetime.now()
     # verify.
     sts = wb6Status(TestWbConfig._wbAddress)
     ts = sts.getTime()
     ms = '%02u:%02u:00' % (now.hour,now.minute)
     me = '%02u:%02u:59' % (now.hour,now.minute)
     if (ms > ts) or (ts > me):
         self.error( 'checkTime ' + "wbts:" + ts + " ms:" + ms + " me:" + me )
     # webbrick counts sunday as 0, python monday as 0 (sun=6)
     day = sts.getDay()
     if ( day == 0 ):
         day = 6
     else:
         day = day - 1
     if day != now.weekday():
         self.error( 'checkTime  wbday: (%u)%u local %u' % (sts.getDay(), day, now.weekday())  )
     self.assertEqual( self.ErrorCount, 0 )
Example #7
0
    def testAnFast(self, chn):
        self.setTest('test Analogue channel ' + str(chn) + ' ip address ' +
                     underTestAddress)
        # for analogue level from 0 to 100% in 10% steps.

        # set all channels to 50 %
        wb6.AnOutPercent(underTestAddress, 0, 0)
        for j in range(0, 4):
            if j != chn:
                wb6.AnOutPercent(underTestAddress, j, 50)

        #time.sleep(0.4) # let settle, possibly long Fade time
        # for channel under analogue level from 0 to 100% in 10% steps.
        for k in range(0, 81, 20):
            self.showWorking()
            wb6.AnOutPercent(underTestAddress, chn, k)
            #            time.sleep(0.2) # Fade time
            time.sleep(0.1)  # Fade time
            sts = wb6Status(underTestAddress)
            for j in range(0, 4):
                val = sts.getAnIn(j)
                if j == chn:
                    # should be k
                    if (val < (k - 5)) or (val > (k + 5)):
                        self.error(
                            'test Analogue channel %i expecting %s got %s' %
                            (chn, k, val))
                else:
                    # should be i
                    if (val < (45)) or (val > (55)):
                        self.error(
                            'test Analogue channel %i verify %i expecting %s got %s'
                            % (chn, j, 50, val))
Example #8
0
 def testSetClock(self):
     self.doSetTime(1, 1, 1)
     sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
     self.assertEqual(sts.getError(), 0)
     ts = sts.getTime()
     #        print ts
     self.failUnless((ts >= "01:01:00") and (ts <= "01:01:59"))
     self.assertEqual(sts.getDay(), 1)
Example #9
0
    def testSetClock(self):
        self.doSetTime( 1, 1, 1 )
        sts = wb6Status.wb6Status( self._wbAddress )
        assert sts.getError() == 0
        ts = sts.getTime()
#        print ts
        assert (ts >= "01:01:00") and (ts <= "01:01:59"), ts
        assert (sts.getDay() == 1), str(sts.getDay())
Example #10
0
    def testSetClock(self):
        self.doSetTime( 1, 1, 1 )
        sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
        self.assertEqual( sts.getError(), 0 )
        ts = sts.getTime()
#        print ts
        self.failUnless( (ts >= "01:01:00") and (ts <= "01:01:59") )
        self.assertEqual( sts.getDay(), 1)
Example #11
0
    def testScheduledRestart(self):
        self.factoryReset()  # from known state
        self.doSetTime(1, 1, 0)  # before scheduled event
        # Create a scheduled event
        wb6.ConfigScheduled(self._wbAddress, 2, "1", 1, 2, wb6.TT_DIGITAL, 3,
                            wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0,
                            wb6.UDPT_GENERAL, 98)
        time.sleep(0.5)
        sts = wb6Status.wb6Status(self._wbAddress)
        assert sts.getError() == 0, str(sts.getError())

        # reboot, let system settle and then move clock forward
        self.doReboot()
        self.doSetTime(1, 1, 3)  # after scheduled event
        # now see what has happened
        sts = wb6Status.wb6Status(self._wbAddress)
        assert sts.getDigOut(3), sts.getTime() + " " + str(sts.getDigOut(3))
Example #12
0
 def testSetClock(self):
     self.doSetTime(1, 1, 1)
     sts = wb6Status.wb6Status(self._wbAddress)
     assert sts.getError() == 0
     ts = sts.getTime()
     #        print ts
     assert (ts >= "01:01:00") and (ts <= "01:01:59"), ts
     assert (sts.getDay() == 1), str(sts.getDay())
Example #13
0
 def testTemperature(self):
     # test analogue out and inputs
     sts = wb6Status(TestWbConfig._wbAddress)
     if ( sts.getOneWireBus() != 7 ):
         # let system catch up.
         for idx in range(0,21):
             showWorking()
             time.sleep(1)
             
     sts = wb6Status(TestWbConfig._wbAddress)
     if ( sts.getOneWireBus() != 7 ):
         self.error( 'invalid temp sensor count : ' + str(sts.getOneWireBus()) )
     
     for idx in range(0,5):
         tv = sts.getTemp( idx )
         if ( tv > 125.0 ) or ( tv < -55.0 ) :
             self.error( 'invalid temp reading : ' + str(tv) )
     self.assertEqual( self.ErrorCount, 0 )
Example #14
0
 def testaSceneAndTrigger(self):
     # configure a scene and verify it
     self.testaScene()
     # configure a digital input to trigger a scene.
     wb6.ConfigDigIn(self._wbAddress, 1,wb6.TT_SCENE, 1, wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0, wb6.UDPT_GENERAL, 100 )
     # Then trigger scene and verify outputs
     wb6.DigTrigger(self._wbAddress, 1)
     # let it process and update Siteplayer
     time.sleep(1.0)
     sts = wb6Status.wb6Status( self._wbAddress )
     self.verifySceneAction()
Example #15
0
 def testaSceneAndTrigger(self):
     # configure a scene and verify it
     self.testaScene()
     # configure a digital input to trigger a scene.
     wb6.ConfigDigIn(self._wbAddress, 1, wb6.TT_SCENE, 1, wb6.AT_TOGGLE,
                     wb6.SP_0, wb6.DW_0, wb6.UDPT_GENERAL, 100)
     # Then trigger scene and verify outputs
     wb6.DigTrigger(self._wbAddress, 1)
     # let it process and update Siteplayer
     time.sleep(1.0)
     sts = wb6Status.wb6Status(self._wbAddress)
     self.verifySceneAction()
Example #16
0
 def testScheduledEvent(self):
     self.doSetTime(1, 1, 1)
     # Create a scheduled event
     wb6.ConfigScheduled(self._wbAddress, 1, "1", 1, 2, wb6.TT_DIGITAL, 3,
                         wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0,
                         wb6.UDPT_GENERAL, 98)
     time.sleep(0.5)
     sts = wb6Status.wb6Status(self._wbAddress)
     assert sts.getError() == 0
     cfg = wb6Config.wb6Config(self._wbAddress)
     for idx in range(0, self._schedCount):
         if (idx == 1):
             sc = cfg.getScheduledEvent(idx)
             assert sc["days"] == 2, str(sc["days"])
             assert sc["hours"] == 1, str(sc["hours "])
             assert sc["mins"] == 2, str(sc["mins"])
             assert sc["actionNr"] == 4, str(sc["actionNr"])
             assert sc["action"] == "Toggle", sc["action"]
             assert sc["pairChn"] == 3, str(sc["pairChn"])
             assert sc["dwell"] == 0, str(sc["dwell"])
             assert sc["typeNr"] == 0, str(sc["typeNr"])
             assert sc["type"] == "Digital", sc["type"]
             assert sc["setPoint"] == 0, str(sc["setPoint"])
             assert sc["UDPRemNr"] == 1, str(sc["UDPRemNr"])
             assert sc["UDPRem"] == "General", sc["UDPRem"]
             assert sc["RemNode"] == 98, str(sc["RemNode"])
         else:
             self.verifyScheduleConfiguration(idx, cfg)
     cur = sts.getDigOut(3)
     # wait for it to run?
     while (sts.getTime() < "01:02:00"):
         time.sleep(1.0)
         showWait()
         sts = wb6Status.wb6Status(self._wbAddress)
     # ensure it has a chance to run
     time.sleep(1.0)
     sts = wb6Status.wb6Status(self._wbAddress)
     assert (cur <> sts.getDigOut(3)), str(
         sts.getDigOut(3))  # did it toggle
Example #17
0
 def testScheduledEvent(self):
     self.doSetTime(1, 1, 1)
     # Create a scheduled event
     wb6.ConfigScheduled(TestWbConfig._wbAddress, 1, "1", 1, 2,
                         wb6.TT_DIGITAL, 3, wb6.AT_TOGGLE, wb6.SP_0,
                         wb6.DW_0, wb6.UDPT_GENERAL, 98)
     time.sleep(0.5)
     sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
     self.assertEqual(sts.getError(), 0)
     cfg = wb6Config.wb6Config(TestWbConfig._wbAddress)
     for idx in range(0, TestWbConfig._schedCount):
         if (idx == 1):
             sc = cfg.getScheduledEvent(idx)
             self.assertEqual(sc["days"], 2)
             self.assertEqual(sc["hours"], 1)
             self.assertEqual(sc["mins"], 2)
             self.assertEqual(sc["actionNr"], 4)
             self.assertEqual(sc["action"], "Toggle")
             self.assertEqual(sc["pairChn"], 3)
             self.assertEqual(sc["dwell"], 0)
             self.assertEqual(sc["typeNr"], 0)
             self.assertEqual(sc["type"], "Digital")
             self.assertEqual(sc["setPoint"], 0)
             self.assertEqual(sc["UDPRemNr"], 1)
             self.assertEqual(sc["UDPRem"], "General")
             self.assertEqual(sc["RemNode"], 98)
         else:
             self.verifyScheduleConfiguration(idx, cfg)
     cur = sts.getDigOut(3)
     # wait for it to run?
     while (sts.getTime() < "01:02:00"):
         time.sleep(1.0)
         showWait()
         sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
     # ensure it has a chance to run
     time.sleep(1.0)
     sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
     self.assertNotEqual(cur, sts.getDigOut(3))
Example #18
0
    def testScheduledRestart(self):
        factoryReset(TestWbConfig._wbAddress) # from known state
        self.doSetTime( 1, 1, 0 ) # before scheduled event
        # Create a scheduled event
        wb6.ConfigScheduled( TestWbConfig._wbAddress, 2, "1", 1, 2, wb6.TT_DIGITAL, 3, wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0, wb6.UDPT_GENERAL, 98 )
        time.sleep(0.5)
        self.checkCmdStatus()

        # reboot, let system settle and then move clock forward
        doReboot(TestWbConfig._wbAddress)
        self.doSetTime( 1, 1, 3 ) # after scheduled event
        # now see what has happened
        sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
        self.assertEqual( sts.getDigOut(3), True)
Example #19
0
    def testRelays(self):
        # NOTE a digital input is active LOW, hence
        # relay on takes input high and the dig in state is false.
        #
        # test the relay contacts and digital in 8-11 (AKA Monitor inputs).
        for r in range(4,6):
            self.setTest( 'test Relays channel ' + str(r) + ' ip address ' + TestWbConfig._wbAddress )
            for idx in range(0,8):
                wb6.DigOff( TestWbConfig._wbAddress, idx )
                time.sleep(0.1)
            # should currently all be low.
            sts = wb6Status(TestWbConfig._wbAddress)
            for idx in range(8,12):
                if sts.getDigIn(idx):
                    sts = wb6Status(TestWbConfig._wbAddress)
                    if sts.getDigIn(idx):
                        self.error( 'Relay channel ' + str(r) + ' Initialise all Low ' + str(idx) + ' High' )

            wb6.DigOn( TestWbConfig._wbAddress, r )
            time.sleep(1)
            # now 2 monitors high and two low. Note relay 4 is inputs 8 and 9.
            sts = wb6Status(TestWbConfig._wbAddress)
            for idx in range(8,12):
                if (idx/2) == r :
                    if not sts.getDigIn(idx):
                        logging.debug( 'test Relay channel ' + str(idx/2) )
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if not sts.getDigIn(idx):
                            self.error( 'test Relay channel ' + str(r) + 'Monitor ' + str(idx) + ' High' )
                else:
                    if sts.getDigIn(idx):
                        logging.debug( 'test Relay channel ' + str(idx/2) )
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if sts.getDigIn(idx):
                            self.error( 'test Relay channel ' + str(r) + 'Monitor ' + str(idx) +  ' Low' )
        self.assertEqual( self.ErrorCount, 0 )
Example #20
0
 def testScheduledEvent(self):
     self.doSetTime( 1, 1, 1 )
     # Create a scheduled event
     wb6.ConfigScheduled( TestWbConfig._wbAddress, 1, "1", 1, 2, wb6.TT_DIGITAL, 3, wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0, wb6.UDPT_GENERAL, 98 )
     time.sleep(0.5)
     sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
     self.assertEqual( sts.getError(), 0 )
     cfg = wb6Config.wb6Config( TestWbConfig._wbAddress )
     for idx in range(0,TestWbConfig._schedCount):
         if ( idx == 1 ):
             sc = cfg.getScheduledEvent(idx)
             self.assertEqual( sc["days"] , 2)
             self.assertEqual( sc["hours"] , 1)
             self.assertEqual( sc["mins"] , 2)
             self.assertEqual( sc["actionNr"] , 4)
             self.assertEqual( sc["action"] , "Toggle")
             self.assertEqual( sc["pairChn"] , 3)
             self.assertEqual( sc["dwell"] , 0)
             self.assertEqual( sc["typeNr"] , 0)
             self.assertEqual( sc["type"] , "Digital")
             self.assertEqual( sc["setPoint"] , 0)
             self.assertEqual( sc["UDPRemNr"] , 1)
             self.assertEqual( sc["UDPRem"] , "General")
             self.assertEqual( sc["RemNode"] , 98)
         else:
             self.verifyScheduleConfiguration(idx, cfg)
     cur = sts.getDigOut(3);
     # wait for it to run?
     while ( sts.getTime() < "01:02:00" ):
         time.sleep(1.0)
         showWait()
         sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
     # ensure it has a chance to run
     time.sleep(1.0)
     sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
     self.assertNotEqual(cur,sts.getDigOut(3))
Example #21
0
 def testScheduledEvent(self):
     self.doSetTime( 1, 1, 1 )
     # Create a scheduled event
     wb6.ConfigScheduled( self._wbAddress, 1, "1", 1, 2, wb6.TT_DIGITAL, 3, wb6.AT_TOGGLE, wb6.SP_0, wb6.DW_0, wb6.UDPT_GENERAL, 98 )
     time.sleep(0.5)
     sts = wb6Status.wb6Status( self._wbAddress )
     assert sts.getError() == 0
     cfg = wb6Config.wb6Config( self._wbAddress )
     for idx in range(0,self._schedCount):
         if ( idx == 1 ):
             sc = cfg.getScheduledEvent(idx)
             assert sc["days"] == 2, str(sc["days"])
             assert sc["hours"] == 1, str(sc["hours "])
             assert sc["mins"] == 2, str(sc["mins"])
             assert sc["actionNr"] == 4, str(sc["actionNr"])
             assert sc["action"] == "Toggle", sc["action"]
             assert sc["pairChn"] == 3, str(sc["pairChn"])
             assert sc["dwell"] == 0, str(sc["dwell"])
             assert sc["typeNr"] == 0, str(sc["typeNr"])
             assert sc["type"] == "Digital", sc["type"]
             assert sc["setPoint"] == 0, str(sc["setPoint"])
             assert sc["UDPRemNr"] == 1, str(sc["UDPRemNr"])
             assert sc["UDPRem"] == "General", sc["UDPRem"]
             assert sc["RemNode"] == 98, str(sc["RemNode"])
         else:
             self.verifyScheduleConfiguration(idx, cfg)
     cur = sts.getDigOut(3);
     # wait for it to run?
     while ( sts.getTime() < "01:02:00" ):
         time.sleep(1.0)
         showWait()
         sts = wb6Status.wb6Status( self._wbAddress )
     # ensure it has a chance to run
     time.sleep(1.0)
     sts = wb6Status.wb6Status( self._wbAddress )
     assert (cur <> sts.getDigOut(3)),str(sts.getDigOut(3))    # did it toggle
Example #22
0
    def testScheduledRestart(self):
        factoryReset(TestWbConfig._wbAddress)  # from known state
        self.doSetTime(1, 1, 0)  # before scheduled event
        # Create a scheduled event
        wb6.ConfigScheduled(TestWbConfig._wbAddress, 2, "1", 1, 2,
                            wb6.TT_DIGITAL, 3, wb6.AT_TOGGLE, wb6.SP_0,
                            wb6.DW_0, wb6.UDPT_GENERAL, 98)
        time.sleep(0.5)
        self.checkCmdStatus()

        # reboot, let system settle and then move clock forward
        doReboot(TestWbConfig._wbAddress)
        self.doSetTime(1, 1, 3)  # after scheduled event
        # now see what has happened
        sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
        self.assertEqual(sts.getDigOut(3), True)
Example #23
0
    def verifySceneAction(self):
        time.sleep(1.0) # let analogues be read
        sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
        # verify digital output state
        self.assertEqual( sts.getDigOut(0), True )
        self.assertEqual( sts.getDigOut(1), False )
        self.assertEqual( sts.getDigOut(2), False )     # not touched

        self.assertEqual( sts.getDigOut(3), True )
        self.assertEqual( sts.getDigOut(4), False )
        self.assertEqual( sts.getDigOut(5), False )     # not touched
        self.assertEqual( sts.getDigOut(6), True )
        self.assertEqual( sts.getDigOut(7), False )

        # verify analogue output state
        self.assertEqual( sts.getAnOut(0), 14)
        self.assertEqual( sts.getAnOut(1), 0)
        self.assertEqual( sts.getAnOut(2), 28)
        self.assertEqual( sts.getAnOut(3), 0)
Example #24
0
    def verifySceneAction(self):
        time.sleep(1.0)  # let analogues be read
        sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
        # verify digital output state
        self.assertEqual(sts.getDigOut(0), True)
        self.assertEqual(sts.getDigOut(1), False)
        self.assertEqual(sts.getDigOut(2), False)  # not touched

        self.assertEqual(sts.getDigOut(3), True)
        self.assertEqual(sts.getDigOut(4), False)
        self.assertEqual(sts.getDigOut(5), False)  # not touched
        self.assertEqual(sts.getDigOut(6), True)
        self.assertEqual(sts.getDigOut(7), False)

        # verify analogue output state
        self.assertEqual(sts.getAnOut(0), 14)
        self.assertEqual(sts.getAnOut(1), 0)
        self.assertEqual(sts.getAnOut(2), 28)
        self.assertEqual(sts.getAnOut(3), 0)
Example #25
0
    def verifySceneAction(self):
        time.sleep(1.0)
        sts = wb6Status.wb6Status( self._wbAddress )
        # verify digital output state
        self.assertEqual( sts.getDigOut(0), True )
        self.assertEqual( sts.getDigOut(1), False )
        self.assertEqual( sts.getDigOut(2), False )     # not touched

        self.assertEqual( sts.getDigOut(3), True )
        self.assertEqual( sts.getDigOut(4), False )
        self.assertEqual( sts.getDigOut(5), False )     # not touched
        self.assertEqual( sts.getDigOut(6), True )
        self.assertEqual( sts.getDigOut(7), False )

        # verify analogue output state
        an = sts.getAnOut(0)
        assert  an == 14 , "Analogue 0 not at expected level " + str(an)
        an = sts.getAnOut(1)
        assert  an == 0 , "Analogue 1 not at expected level " + str(an)
        an = sts.getAnOut(2)
        assert  an == 28 , "Analogue 2 not at expected level " + str(an)
        an = sts.getAnOut(3)
        assert  an == 0 , "Analogue 3 not at expected level " + str(an)
Example #26
0
    def verifySceneAction(self):
        time.sleep(1.0)
        sts = wb6Status.wb6Status(self._wbAddress)
        # verify digital output state
        self.assertEqual(sts.getDigOut(0), True)
        self.assertEqual(sts.getDigOut(1), False)
        self.assertEqual(sts.getDigOut(2), False)  # not touched

        self.assertEqual(sts.getDigOut(3), True)
        self.assertEqual(sts.getDigOut(4), False)
        self.assertEqual(sts.getDigOut(5), False)  # not touched
        self.assertEqual(sts.getDigOut(6), True)
        self.assertEqual(sts.getDigOut(7), False)

        # verify analogue output state
        an = sts.getAnOut(0)
        assert an == 14, "Analogue 0 not at expected level " + str(an)
        an = sts.getAnOut(1)
        assert an == 0, "Analogue 1 not at expected level " + str(an)
        an = sts.getAnOut(2)
        assert an == 28, "Analogue 2 not at expected level " + str(an)
        an = sts.getAnOut(3)
        assert an == 0, "Analogue 3 not at expected level " + str(an)
Example #27
0
 def checkCmdStatus(self):
     sts = wb6Status.wb6Status(TestWbConfig._wbAddress)
     self.assertEqual(sts.getError(), 0)
Example #28
0
 def waitForTestStatus(self):
     # wait for next read of wbstatus and return it.
     # in this test harness we are going to read periodically.
     return wb6Status(underTestAddress)  # for now.
Example #29
0
 def waitForControlStatus(self):
     # wait for next read of wbstatus and return it.
     # in this test harness we are going to read periodically.
     return wb6Status(controlWbAddress)
Example #30
0
 def checkCmdStatus(self):
     sts = wb6Status.wb6Status( TestWbConfig._wbAddress )
     self.assertEqual( sts.getError(), 0 )
Example #31
0
    def testADigitalChannel(self, chn):
        # switch all off
        for idx in range(0, 8):
            if (idx == chn):
                wb6.DigOn(underTestAddress, chn)
            else:
                wb6.DigOff(underTestAddress, idx)

        self.setTest('On test Digital channel ' + str(chn) + ' ip address ' +
                     underTestAddress)

        time.sleep(0.1)
        # first read the status XMl until we get what we expect
        # both the control and under test webbrick
        repeat = 0
        while repeat < 3:
            sts = wb6Status(underTestAddress)
            sts2 = wb6Status(controlWbAddress)
            if sts2.getDigIn(chn):
                # mimic correct
                if (chn <= 3) and not sts.getDigIn(idx):
                    # OC correct
                    break
                if (chn > 3) and sts.getDigIn(idx):
                    # DigOut correct
                    break
            repeat = repeat + 1
            time.sleep(0.5)

        # verify only channel under test on
        for idx in range(0, 8):
            # if the same
            if (idx > 3):
                if (idx == chn):
                    if not sts.getDigIn(idx):
                        self.error('channel ' + str(chn) + ' Should be On')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if sts.getDigIn(idx):
                        self.error('channel ' + str(idx) + ' Should be Off')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if (idx == chn):
                    if sts.getDigIn(idx):
                        self.error('channel ' + str(chn) + ' Should be On')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if not sts.getDigIn(idx):
                        self.error('channel ' + str(idx) + ' Should be Off')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1

            if (idx == chn):
                if not sts2.getDigIn(idx):
                    self.error('channel ' + str(chn) + ' Mimic Should be On')
                    self.MimicErrorCount = self.MimicErrorCount + 1
            else:
                if sts2.getDigIn(idx):
                    self.error('channel ' + str(idx) + ' Mimic Should be Off')
                    self.MimicErrorCount = self.MimicErrorCount + 1

        # verify relays
        for idx in range(8, 12):
            if (idx / 2) == chn:
                if not sts.getDigIn(idx):
                    self.error('test Relay channel ' + str(chn) + 'Monitor ' +
                               str(idx) + ' High')
                    self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if sts.getDigIn(idx):
                    self.error('test Relay channel ' + str(chn) + 'Monitor ' +
                               str(idx) + ' Low')
                    self.DigitalErrorCount = self.DigitalErrorCount + 1

        # switch all on
        self.setTest('Off test Digital channel ' + str(chn) + ' ip address ' +
                     underTestAddress)

        for idx in range(0, 8):
            if (idx == chn):
                wb6.DigOff(underTestAddress, chn)
            else:
                wb6.DigOn(underTestAddress, idx)
        time.sleep(0.1)

        # read the status XMl until we get what we expect
        # both the control and under test webbrick
        repeat = 0
        while repeat < 3:
            sts = wb6Status(underTestAddress)
            sts2 = wb6Status(controlWbAddress)
            if not sts2.getDigIn(chn):
                # mimic correct
                if (chn <= 3) and sts.getDigIn(idx):
                    # OC correct
                    break
                if (chn > 3) and not sts.getDigIn(idx):
                    # DigOut correct
                    break
            repeat = repeat + 1
            time.sleep(0.5)

        # verify only channel under test off
        for idx in range(0, 8):
            # if the same
            if (idx > 3):
                if (idx == chn):
                    if sts.getDigIn(idx):
                        self.error('channel ' + str(chn) + ' Should be Off')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if not sts.getDigIn(idx):
                        self.error('channel ' + str(idx) + ' Should be On')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if (idx == chn):
                    if not sts.getDigIn(idx):
                        self.error('channel ' + str(chn) + ' Should be Off')
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if sts.getDigIn(idx):
                        self.error('channel ' + str(idx) + ' Should be On')
                        self.MimicErrorCount = self.DigitalErrorCount + 1
            if (idx == chn):
                if sts2.getDigIn(idx):
                    self.error('channel ' + str(chn) + ' Mimic Should be Off')
                    self.MimicErrorCount = self.MimicErrorCount + 1
            else:
                if not sts2.getDigIn(idx):
                    self.error('channel ' + str(idx) + ' Mimic Should be On')
                    self.MimicErrorCount = self.MimicErrorCount + 1

        # verify relays again
        for idx in range(8, 12):
            if (idx / 2) == chn:
                if sts.getDigIn(idx):
                    self.error('test Relay channel ' + str(chn) + 'Monitor ' +
                               str(idx) + ' High')
                    self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if not sts.getDigIn(idx):
                    self.error('test Relay channel ' + str(chn) + 'Monitor ' +
                               str(idx) + ' Low')
                    self.DigitalErrorCount = self.DigitalErrorCount + 1
Example #32
0
    def testADigitalChannel( self, chn ):
        # switch all off
        for idx in range(0,8):
            if ( idx == chn ):
                wb6.DigOn( underTestAddress, chn )
            else:
                wb6.DigOff( underTestAddress, idx )

        self.setTest( 'On test Digital channel ' + str(chn) + ' ip address ' + underTestAddress )

        time.sleep(0.1)
        # first read the status XMl until we get what we expect
        # both the control and under test webbrick
        repeat = 0
        while repeat < 3:
            sts = wb6Status(underTestAddress)
            sts2 = wb6Status(controlWbAddress)
            if sts2.getDigIn(chn):
                # mimic correct
                if ( chn <= 3 ) and not sts.getDigIn(idx):
                    # OC correct
                    break
                if ( chn > 3 ) and sts.getDigIn(idx):
                    # DigOut correct
                    break
            repeat = repeat + 1
            time.sleep(0.5)

        # verify only channel under test on
        for idx in range(0,8):
            # if the same
            if ( idx > 3 ):
                if ( idx == chn ):
                    if not sts.getDigIn(idx):
                        self.error( 'channel ' + str(chn) + ' Should be On' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if sts.getDigIn(idx):
                        self.error( 'channel ' + str(idx) + ' Should be Off' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if ( idx == chn ):
                    if sts.getDigIn(idx):
                        self.error( 'channel ' + str(chn) + ' Should be On' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if not sts.getDigIn(idx):
                        self.error( 'channel ' + str(idx) + ' Should be Off' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1

            if ( idx == chn ):
                if not sts2.getDigIn(idx):
                    self.error( 'channel ' + str(chn) + ' Mimic Should be On' )
                    self.MimicErrorCount = self.MimicErrorCount + 1
            else:
                if sts2.getDigIn(idx):
                    self.error( 'channel ' + str(idx) + ' Mimic Should be Off' )
                    self.MimicErrorCount = self.MimicErrorCount + 1

        # verify relays
        for idx in range(8,12):
            if (idx/2) == chn :
                if not sts.getDigIn(idx):
                    self.error( 'test Relay channel ' + str(chn) + 'Monitor ' + str(idx) + ' High' )
                    self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if sts.getDigIn(idx):
                    self.error( 'test Relay channel ' + str(chn) + 'Monitor ' + str(idx) +  ' Low' )
                    self.DigitalErrorCount = self.DigitalErrorCount + 1

        # switch all on
        self.setTest( 'Off test Digital channel ' + str(chn) + ' ip address ' + underTestAddress )

        for idx in range(0,8):
            if ( idx == chn ):
                wb6.DigOff( underTestAddress, chn )
            else:
                wb6.DigOn( underTestAddress, idx )
        time.sleep(0.1)

        # read the status XMl until we get what we expect
        # both the control and under test webbrick
        repeat = 0
        while repeat < 3:
            sts = wb6Status(underTestAddress)
            sts2 = wb6Status(controlWbAddress)
            if not sts2.getDigIn(chn):
                # mimic correct
                if ( chn <= 3 ) and sts.getDigIn(idx):
                    # OC correct
                    break
                if ( chn > 3 ) and not sts.getDigIn(idx):
                    # DigOut correct
                    break
            repeat = repeat + 1
            time.sleep(0.5)

        # verify only channel under test off
        for idx in range(0,8):
            # if the same
            if ( idx > 3 ):
                if ( idx == chn ):
                    if sts.getDigIn(idx):
                        self.error( 'channel ' + str(chn) +' Should be Off' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if not sts.getDigIn(idx):
                        self.error( 'channel ' + str(idx) + ' Should be On' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if ( idx == chn ):
                    if not sts.getDigIn(idx):
                        self.error( 'channel ' + str(chn) +' Should be Off' )
                        self.DigitalErrorCount = self.DigitalErrorCount + 1
                else:
                    if sts.getDigIn(idx):
                        self.error( 'channel ' + str(idx) + ' Should be On' )
                        self.MimicErrorCount = self.DigitalErrorCount + 1
            if ( idx == chn ):
                if sts2.getDigIn(idx):
                    self.error( 'channel ' + str(chn) + ' Mimic Should be Off' )
                    self.MimicErrorCount = self.MimicErrorCount + 1
            else:
                if not sts2.getDigIn(idx):
                    self.error( 'channel ' + str(idx) + ' Mimic Should be On' )
                    self.MimicErrorCount = self.MimicErrorCount + 1

        # verify relays again
        for idx in range(8,12):
            if (idx/2) == chn :
                if sts.getDigIn(idx):
                    self.error( 'test Relay channel ' + str(chn) + 'Monitor ' + str(idx) + ' High' )
                    self.DigitalErrorCount = self.DigitalErrorCount + 1
            else:
                if not sts.getDigIn(idx):
                    self.error( 'test Relay channel ' + str(chn) + 'Monitor ' + str(idx) +  ' Low' )
                    self.DigitalErrorCount = self.DigitalErrorCount + 1
Example #33
0
    def doTestOneDin( self, chn ):
        # switch all off
        isMixed = 2
        isOc = False

        while ( isMixed > 0 ):
            for idx in range(0,8):
                wb6.DigOff( TestWbConfig._wbAddress, idx )
                time.sleep(1.0)
            
            # See whether connected to OC outputs which invert.
            sts = wb6Status(TestWbConfig._wbAddress)

            if (sts.getDigIn(0) or sts.getDigIn(1) or sts.getDigIn(2) or sts.getDigIn(3)):
                # Some high
                isOc = True
                logging.debug( "Testing OC outputs" )
                if (sts.getDigIn(0) and sts.getDigIn(1) and sts.getDigIn(2) and sts.getDigIn(3)):
                    isMixed = 0
                else:
                    self.error( 'test Digital channel ' + str(chn) + ' D0-D3 mixed results' )
                    isMixed = isMixed - 1
            else:
                logging.debug( "Testing MIMICS" )
                isMixed = 0
            # print sts.getDigIn(0), sts.getDigIn(1), sts.getDigIn(2), sts.getDigIn(3), isOc
         
        self.setTest( 'On test Digital channel ' + str(chn) + ' ip address ' + TestWbConfig._wbAddress )
        # switch on under test channel
        wb6.DigOn( TestWbConfig._wbAddress, chn )
        time.sleep(1.0)
        sts = wb6Status(TestWbConfig._wbAddress)
        # verify only channel under test on
        for idx in range(0,8):
            # if the same
            if ( idx > 3 ) or not isOc:
                if ( idx == chn ):
                    if not sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if not sts.getDigIn(idx):
                            self.error( 'channel ' + str(chn) + ' stuck low' )
                else:
                    if sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if sts.getDigIn(idx):
                            self.error( 'channel ' + str(idx) + ' unexpectedly high' )
            else:
                if ( idx == chn ):
                    if sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if sts.getDigIn(idx):
                            self.error( 'channel ' + str(chn) + ' stuck high' )
                else:
                    if not sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if not sts.getDigIn(idx):
                            self.error( 'channel ' + str(idx) + ' unexpectedly low' )

        # switch all on
        self.setTest( 'Off test Digital channel ' + str(chn) + ' ip address ' + TestWbConfig._wbAddress )
        for idx in range(0,8):
            wb6.DigOn( TestWbConfig._wbAddress, idx )
            time.sleep(1)
        # switch off under test channel
        wb6.DigOff( TestWbConfig._wbAddress, chn )
        time.sleep(1)
        sts = wb6Status(TestWbConfig._wbAddress)
        # verify only channel under test off
        for idx in range(0,8):
            # if the same
            if ( idx > 3 ) or not isOc:
                if ( idx == chn ):
                    if sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if sts.getDigIn(idx):
                            self.error( 'channel ' + str(chn) +' stuck high' )
                else:
                    if not sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if not sts.getDigIn(idx):
                            self.error( 'channel ' + str(idx) + ' unexpectedly low' )
            else:
                if ( idx == chn ):
                    if not sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if not sts.getDigIn(idx):
                            self.error( 'channel ' + str(chn) +' stuck low' )
                else:
                    if sts.getDigIn(idx):
                        sts = wb6Status(TestWbConfig._wbAddress)
                        if sts.getDigIn(idx):
                            self.error( 'channel ' + str(idx) + ' unexpectedly high' )
Example #34
0
 def loadWbStatus( self, addr ):
     sts = wb6Status(addr)
     # check site player not reset
     self.assertNotEqual( sts.getOpState(), 255 )
     return sts
Example #35
0
import sys
sys.path.append('../API')

import wb6Status

test_ip = "10.100.100.100";

wb6Sts = wb6Status.wb6Status( test_ip );

print "Version = " + wb6Sts.getVersion()
print "OWBus = " + wb6Sts.getOneWireBus()

print "Temp 0 = " + str(wb6Sts.getTemp( 0))
print "Temp 1 = " + str(wb6Sts.getTemp( 1))
print "Temp 2 = " + str(wb6Sts.getTemp( 2))
print "Temp 3 = " + str(wb6Sts.getTemp( 3))
print "Temp 4 = " + str(wb6Sts.getTemp( 4))

print "An Out 0 = " + str(wb6Sts.getAnOut( 0))
print "An Out 1 = " + str(wb6Sts.getAnOut( 1))
print "An Out 2 = " + str(wb6Sts.getAnOut( 2))
print "An Out 3 = " + str(wb6Sts.getAnOut( 3))

print "An In 0 = " + str(wb6Sts.getAnIn( 0))
print "An In 1 = " + str(wb6Sts.getAnIn( 1))
print "An In 2 = " + str(wb6Sts.getAnIn( 2))
print "An In 3 = " + str(wb6Sts.getAnIn( 3))

print "Dig In 0 = " + str(wb6Sts.getDigIn( 0))
print "Dig In 1 = " + str(wb6Sts.getDigIn( 1))
print "Dig In 2 = " + str(wb6Sts.getDigIn( 2))
Example #36
0
 def waitForTestStatus(self):
     # wait for next read of wbstatus and return it.
     # in this test harness we are going to read periodically.
     return wb6Status(underTestAddress)  # for now.
Example #37
0
import sys

sys.path.append('../API')

import wb6Status

test_ip = "10.100.100.100"

wb6Sts = wb6Status.wb6Status(test_ip)

print "Version = " + wb6Sts.getVersion()
print "OWBus = " + wb6Sts.getOneWireBus()

print "Temp 0 = " + str(wb6Sts.getTemp(0))
print "Temp 1 = " + str(wb6Sts.getTemp(1))
print "Temp 2 = " + str(wb6Sts.getTemp(2))
print "Temp 3 = " + str(wb6Sts.getTemp(3))
print "Temp 4 = " + str(wb6Sts.getTemp(4))

print "An Out 0 = " + str(wb6Sts.getAnOut(0))
print "An Out 1 = " + str(wb6Sts.getAnOut(1))
print "An Out 2 = " + str(wb6Sts.getAnOut(2))
print "An Out 3 = " + str(wb6Sts.getAnOut(3))

print "An In 0 = " + str(wb6Sts.getAnIn(0))
print "An In 1 = " + str(wb6Sts.getAnIn(1))
print "An In 2 = " + str(wb6Sts.getAnIn(2))
print "An In 3 = " + str(wb6Sts.getAnIn(3))

print "Dig In 0 = " + str(wb6Sts.getDigIn(0))
print "Dig In 1 = " + str(wb6Sts.getDigIn(1))
Example #38
0
 def waitForControlStatus(self):
     # wait for next read of wbstatus and return it.
     # in this test harness we are going to read periodically.
     return wb6Status(controlWbAddress)