class HTTPTests(TestCase): def setUp(self): self.interface = HTTP self._protocol = 'http' self._host = "www.google.com" self.interface = HTTP(protocol=self._protocol, host=self._host) def test_instance(self): self.assertIsNotNone(self.interface) def test_read(self): response = self.interface.read() self.assertIn("google", response) def test_write(self): response = self.interface.write("", None, "POST") self.assertIn("google", response)
class HTTPTests(TestCase): def setUp(self): self.interface = HTTP self._protocol = 'http' self._host = "www.google.com" self.interface = HTTP(protocol=self._protocol, host=self._host) def test_instance(self): self.assertIsNotNone(self.interface) def test_read(self): response = self.interface.read() self.assertIn("google", response) def test_write(self): response = self.interface.write("", None, "POST") self.assertIn("google", response) def test_write_tuple(self): command = 'path', 'data', self.interface.write(command)
#from pytomation.interfaces import UPB, InsteonPLM, TCP, Serial, Stargate, W800rf32, \ #NamedPipe, StateInterface # Import all the Pytomation Devices we will use. from pytomation.devices import Attribute, Light, Location, Thermostat, Room, Door, Lock, Scene from pytomation.common import User #Web Server websocket = PytoWebSocketServer() #Interfaces 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'))
def setUp(self): self.interface = HTTP self._protocol = 'http' self._host = "www.google.com" self.interface = HTTP(protocol=self._protocol, host=self._host)
def setUp(self): self.host = 'api.sprk.io' self.i = HTTP('https', self.host) # self.i = Mock_Interface() self.interface = SparkIO(self.i, self.host)
websocket = PytoWebSocketServer() #Interfaces insteon = InsteonPLM(Serial('/dev/insteon', 19200, xonxoff=False)) 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'))) #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='2A.F9.B7', devices=(insteon), name="Front Door Sensor", commands=[Command.OPEN, Command.CLOSE])
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