Ejemplo n.º 1
0
    def test_away_mode(self):
        self.device = Thermostat(
                       address='a',
                       devices=self.interface,
                       automatic_delta=2,
                       away_delta=10,
                       )
        self.interface.automatic = None
        self.device.command((Command.SETPOINT, 72))
        self.device.command(Command.AUTOMATIC)
        self.device.command(Command.VACATE)
#        time.sleep(2)
        self.interface.vacate.assert_called_with('a')
        self.device.command(command=(Command.SETPOINT, 76), source=self.interface, address='a')
        assert not self.interface.cool.called
        self.device.command(command=(Command.SETPOINT, 83), source=self.interface, address='a')
        self.interface.cool.assert_called_with('a')

        self.device.command(command=(Command.SETPOINT, 67), source=self.interface, address='a')
        assert not self.interface.heat.called
        self.device.command(command=(Command.SETPOINT, 61), source=self.interface, address='a')
        self.interface.heat.assert_called_with('a')


        self.interface.heat.reset_mock()
        self.interface.cool.reset_mock()
        self.device.command(command=(Command.SETPOINT, 68), source=self.interface, address='a')
        assert not self.interface.heat.called
        self.device.command(Command.OCCUPY)
        self.device.command(command=(Command.SETPOINT, 68), source=self.interface, address='a')
        self.interface.occupy.assert_called_with('a')
        self.interface.heat.assert_called_with('a')
Ejemplo n.º 2
0
 def test_automatic_delta_setpoint_switchover(self):
     self.device = Thermostat(address='a',
                              devices=self.interface,
                              automatic_delta=2)
     self.interface.automatic = None
     self.device.command(command=(Command.SETPOINT, 76),
                         source=self.interface,
                         address='a')
     self.device.command((Command.SETPOINT, 70))
     # we are not in automatic mode yet
     assert not self.interface.cool.called
     self.device.command(Command.AUTOMATIC)
     self.device.command(command=(Command.SETPOINT, 76),
                         source=self.interface,
                         address='a')
     self.interface.cool.assert_called_with('a')
     self.device.command(command=(Command.SETPOINT, 71),
                         source=self.interface,
                         address='a')
     self.interface.heat.reset_mock()
     self.interface.cool.reset_mock()
     self.interface.level.reset_mock()
     # reset set point within delta
     self.device.command((Command.SETPOINT, 72))
     assert not self.interface.heat.called
     self.device.command(command=(Command.SETPOINT, 69),
                         source=self.interface,
                         address='a')
     self.interface.heat.assert_called_with('a')
Ejemplo n.º 3
0
 def test_automatic_delta(self):
     self.device = Thermostat(
                    address='192.168.1.3',
                    devices=self.interface,
                    automatic_delta=2
                    )
     self.interface.automatic = None
     self.device.command((Command.SETPOINT, 72))
     self.interface.level.assert_called_with('192.168.1.3', 72)
     self.interface.level.reset_mock()
     self.device.command(Command.AUTOMATIC)
     self.device.command(command=(Command.SETPOINT, 76), source=self.interface, address='192.168.1.3')
     self.interface.cool.assert_called_with('192.168.1.3')
     assert not self.interface.heat.called
     self.interface.heat.reset_mock()
     self.interface.cool.reset_mock()
     self.interface.level.reset_mock()
     self.device.command(command=(Command.SETPOINT, 71), source=self.interface, address='192.168.1.3')
     assert not self.interface.heat.called
Ejemplo n.º 4
0
insteon = InsteonHub(
    HTTP(host='IPAddressOrNamedDHCPEntry',
         username='******',
         password='******',
         port='25105'))
ozw = Open_zwave(serialDevicePath="/dev/zwave", config_path="/etc/openzwave")

#Thermostat (override available commads)
thermostat_commands = [
    Command.AUTOMATIC, Command.COOL, Command.HEAT, Command.HOLD,
    Command.SCHEDULE, Command.OFF, Command.LEVEL, Command.CIRCULATE,
    Command.STILL, Command.VACATE, Command.OCCUPY, Command.SETPOINT
]
hall_thermostat = Thermostat(commands=thermostat_commands,
                             name="Thermostat",
                             devices=VenstarThermostat(
                                 HTTP(host='HallThermostat'),
                                 type='commercial'))

#Sensors
ph_calculated = Location('38.576492',
                         '-121.493375',
                         tz='America/Los_Angeles',
                         mode=Location.MODE.STANDARD,
                         is_dst=True,
                         name='Calculated Photocell')

#Front Door sensor, remove non functional status command
d_front_door = Door(address='2AF9B7',
                    devices=(insteon),
                    name="Front Door Sensor",
Ejemplo n.º 5
0
 def test_thermostat_setpoint(self):
     d = Thermostat(address=(123, 123),
                    devices=self.interface,
                    name='Thermo1')
     d.level(74)
Ejemplo n.º 6
0
 def setUp(self):
     self.interface = Mock()
     self.device = Thermostat('192.168.1.3', self.interface)
Ejemplo n.º 7
0
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
d_foyer = Door('D1', sg, name='Foyer Door')
d_laundry = Door('D2', sg, name='Laundry Door')
d_garage = Door('D3', sg, name='Garage Door')