def test_07_knxwrongrangediscover(self): with self.assertRaises(BOFProgrammingError): devices = knx.discover("192.168.1.1/61")
def test_05_knxwrongdiscover2(self): with self.assertRaises(BOFProgrammingError): device = knx.discover("hi")
def test_06_knxwrongmultidiscover(self): with self.assertRaises(BOFProgrammingError): devices = knx.discover("192.168.1.1,hi")
def test_04_knxwrongdiscover(self): device = knx.discover("192.168.1.1") self.assertEqual(device, None)
def test_03_knxrangediscover(self): devices = knx.discover("192.168.1.0/24") self.assertTrue(isinstance(devices, list)) self.assertTrue(isinstance(devices[0], knx.KnxDevice)) self.assertEqual(devices[0].address, BOIBOITE) self.assertEqual(devices[0].port, 3671)
def test_02_knxmultidiscover(self): devices = knx.discover("192.168.1.232,192.168.1.242") self.assertTrue(isinstance(devices, list)) self.assertTrue(isinstance(devices[0], knx.KnxDevice))
def test_01_knxdiscover(self): device = knx.discover(BOIBOITE) self.assertTrue(isinstance(device, knx.KnxDevice))
from sys import path, argv path.append('../') from bof import knx, BOFNetworkError if len(argv) < 2: print("Usage: python {0} IP_RANGE".format(argv[0])) else: devices = knx.discover(argv[1]) if isinstance(devices, knx.KnxDevice): print(devices) else: for device in devices: print(device)