Beispiel #1
0
 def test_light_photocell_intial(self):
     motion = Motion()
     motion.still()
     photo = Photocell(address="asdf")
     photo.dark()
     light = Light(address="e3", devices=(photo, motion), initial_state=photo)
     self.assertEqual(light.state, State.ON)
Beispiel #2
0
 def test_light_photocell_delay(self):
     # Delay off should not trigger when photocell tells us to go dark.
     # Do it immediately
     photo = Photocell()
     photo.dark()
     light = Light(address="e3", devices=photo, delay_off=3)
     self.assertEqual(light.state, State.ON)
     photo.light()
     self.assertEqual(light.state, State.OFF)
Beispiel #3
0
 def test_light_photocell_intial(self):
     motion = Motion()
     motion.still()
     photo = Photocell(address='asdf')
     photo.dark()
     light = Light(
         address='e3',
         devices=(photo, motion),
         initial=photo,
     )
     self.assertEqual(light.state, State.ON)
Beispiel #4
0
 def test_light_restricted(self):
     photo = Photocell("D1", initial_state=State.LIGHT)
     motion = Motion("D1", initial_state=State.STILL)
     light = Light("D2", (motion, photo))
     self.assertEqual(light.state, State.OFF)
     motion.motion()
     self.assertEqual(light.state, State.OFF)
     photo.dark()
     self.assertEqual(light.state, State.ON)
     light.off()
     self.assertEqual(light.state, State.OFF)
     motion.motion()
     self.assertEqual(light.state, State.ON)
Beispiel #5
0
 def test_light_restricted(self):
     photo = Photocell('D1', initial=State.LIGHT)
     self.assertEqual(photo.state, State.LIGHT)
     motion = Motion('D1', initial=State.STILL)
     light = Light('D2', devices=(motion, photo), initial=photo)
     self.assertEqual(light.state, State.OFF)
     motion.motion()
     self.assertEqual(light.state, State.OFF)
     photo.dark()
     self.assertEqual(light.state, State.ON)
     light.off()
     self.assertEqual(light.state, State.OFF)
     motion.motion()
     self.assertEqual(light.state, State.ON)
 def test_light_restricted(self):
     photo = Photocell('D1', initial=State.LIGHT)
     self.assertEqual(photo.state, State.LIGHT)
     motion = Motion('D1', initial=State.STILL)
     light = Light('D2', devices=(motion, photo),
                    initial=photo)
     self.assertEqual(light.state, State.OFF)
     motion.motion()
     self.assertEqual(light.state, State.OFF)
     photo.dark()
     self.assertEqual(light.state, State.ON)
     light.off()
     self.assertEqual(light.state, State.OFF)
     motion.motion()
     self.assertEqual(light.state, State.ON)
Beispiel #7
0
 def test_light_restriction_idle(self):
     ph = Photocell()
     m = Motion()
     ph.dark()
     l = Light(devices=(ph, m),
               idle={
                   Attribute.MAPPED: (Command.LEVEL, 30),
                   Attribute.SECS: 2,
               })
     m.motion()
     self.assertEqual(l.state, State.ON)
     ph.light()
     self.assertEqual(l.state, State.OFF)
     m.motion()
     self.assertEqual(l.state, State.OFF)
     time.sleep(3)
     self.assertEqual(l.state, State.OFF)
 def test_light_restriction_idle(self):
     ph = Photocell()
     m = Motion()
     ph.dark()
     l = Light(
               devices=(ph, m),
               idle={Attribute.MAPPED: (Command.LEVEL, 30),
                     Attribute.SECS: 2,
                     }
               )
     m.motion()
     self.assertEqual(l.state, State.ON)
     ph.light()
     self.assertEqual(l.state, State.OFF)
     m.motion()
     self.assertEqual(l.state, State.OFF)
     time.sleep(3)
     self.assertEqual(l.state, State.OFF)
 def test_photocell_triggered(self):
     photo = Photocell('D1', initial=State.LIGHT)
     light = Light('D1', devices=photo)
     self.assertEquals(light.state, State.OFF)
     photo.dark()
     self.assertEquals(light.state, State.ON)
Beispiel #10
0
 def test_photocell_triggered(self):
     photo = Photocell("D1", initial_state=State.LIGHT)
     light = Light("D1", photo)
     self.assertEquals(light.state, State.OFF)
     photo.dark()
     self.assertEquals(light.state, State.ON)
Beispiel #11
0
 def test_photocell_triggered(self):
     photo = Photocell('D1', initial=State.LIGHT)
     light = Light('D1', devices=photo)
     self.assertEquals(light.state, State.OFF)
     photo.dark()
     self.assertEquals(light.state, State.ON)