Esempio n. 1
0
class HW_ThermostatInterfaceTests(TestCase):
    def setUp(self):
        self.host = '192.168.13.210'
#        self.i = HTTP('http', self.host)
        self.i = Mock_Interface()
        self.interface = HW_Thermostat(self.i, self.host)

    def test_instantiation(self):
        self.assertIsInstance(self.interface, HW_Thermostat)
        
    def test_circulate(self):
        self.interface.off(self.host)
        time.sleep(2)
        self.interface.circulate(self.host)
    
    def test_setpoint(self):
        #no prior mode, then default to heat
        self.interface.level(address=self.host, level=72)
        time.sleep(2)
        self.assertIn(('tstat', '{"t_heat": 72}'), self.i.query_write_data())
        self.i.clear_write_data()
        self.interface.cool()
        time.sleep(2)
        self.assertIn(('tstat', '{"tmode": 2, "t_cool": 72}'), self.i.query_write_data())
        
    def test_cool(self):
        self.interface.cool()
        time.sleep(2)
        self.assertIn(('tstat', '{"tmode": 2}'), self.i.query_write_data())
        
Esempio n. 2
0
class HW_ThermostatInterfaceTests(TestCase):
    def setUp(self):
        self.host = '192.168.13.211'
        #        self.i = HTTP('http', self.host)
        self.i = Mock_Interface()
        self.interface = HW_Thermostat(self.i, self.host)

    def test_instantiation(self):
        self.assertIsInstance(self.interface, HW_Thermostat)

    def test_circulate(self):
        self.interface.off(self.host)
        time.sleep(2)
        #        self.interface.still(self.host)
        self.interface.circulate(self.host)
        time.sleep(2)

    def test_setpoint(self):
        #no prior mode, then default to heat
        self.interface.level(address=self.host, level=72)
        time.sleep(2)
        self.assertIn((
            'tstat',
            '{"t_heat": 72}',
        ), self.i.query_write_data())
        self.i.clear_write_data()
        self.interface.cool()
        time.sleep(2)
        self.assertIn((
            'tstat',
            '{"tmode": 2, "t_cool": 72}',
        ), self.i.query_write_data())

    def test_cool(self):
        self.interface.cool()
        time.sleep(2)
        self.assertIn((
            'tstat',
            '{"tmode": 2}',
        ), self.i.query_write_data())
Esempio n. 3
0
    def setUp(self):
        self.host = '192.168.13.210'
#        self.i = HTTP('http', self.host)
        self.i = Mock_Interface()
        self.interface = HW_Thermostat(self.i, self.host)
Esempio n. 4
0
 def setUp(self):
     self.host = '192.168.13.211'
     #        self.i = HTTP('http', self.host)
     self.i = Mock_Interface()
     self.interface = HW_Thermostat(self.i, self.host)
Esempio n. 5
0
sg.dio_invert(3)
sg.dio_invert(4)
sg.dio_invert(5)
sg.dio_invert(6)
sg.dio_invert(7)
sg.dio_invert(8)
sg.dio_invert(9)
sg.dio_invert(10)
sg.dio_invert(11)
sg.dio_invert(12)

# My camera motion software will echo a "motion" to this pipe.
pipe_front_yard_motion = StateInterface(NamedPipe('/tmp/front_yard_motion'))

thermostat_upstairs = Thermostat(
    devices=HW_Thermostat(HTTP(host='192.168.13.211'), poll=60),
    name='Thermostat Upstairs',
    automatic_delta=2,
    time=({
        Attribute.TIME: (0, 30, 5, '*', '*', (1, 2, 3, 4, 5)),
        Attribute.COMMAND: (Command.LEVEL, 72),
    }, ))

thermostat_downstairs = Thermostat(devices=HW_Thermostat(
    HTTP(host='192.168.13.210'), poll=60),
                                   name='Thermostat Downstairs',
                                   automatic_delta=2)

###################### DEVICE CONFIG #########################

#doors