def test_command(self): name = "device" commands = {"test_command": "test_ir"} itach = iTach(ipaddress="localhost", port=4998) device = itach.add(VirtualDevice( name=name, commands=commands)) with pytest.raises(itachip2ir.iTachException): response = device.test_command()
def test_device(self): name = "device" commands = {"test_command": "test_ir"} itach = iTach(ipaddress="192.168.1.111", port=4998) device = itach.add(VirtualDevice( name=name, commands=commands)) assert itach.devices[device.name] == device assert device.name == name assert device.commands == commands
def test_devices(self): name1 = "device1" name2 = "device2" commands = {"test_command": "test_ir"} itach = iTach(ipaddress="192.168.1.111", port=4998) device1 = VirtualDevice( name=name1, commands=commands) device2 = VirtualDevice( name=name2, commands=commands) devices = itach.add(device1, device2) assert itach.devices[device1.name] == device1 assert itach.devices[device2.name] == device2 assert device1.name == name1 assert device2.name == name2 assert device1.commands == commands assert device2.commands == commands
from itachip2ir import VirtualDevice, iTach commands = { "toggle_power": "sendir,1:3,7,40064,1,1,96,23,49,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,908,97,23,49,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,908,97,23,49,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,908,97,23,49,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,908,97,23,49,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,908,97,23,49,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,4000", "toggle_mute": "sendir,1:3,1,40192,1,1,97,23,25,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,912,96,23,25,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,912,96,23,25,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,934,97,23,25,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,935,97,23,25,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,935,97,23,25,23,25,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,4000", "volume_up": "sendir,1:3,2,40192,1,1,97,23,25,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,915,96,23,25,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,912,96,23,25,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,932,97,23,25,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,4000", "volume_down": "sendir,1:3,8,40192,1,1,97,23,49,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,891,96,23,49,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,888,96,23,49,23,49,23,25,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,4000", "input_sat": "sendir,1:3,1,40192,1,1,97,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,898,96,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,888,96,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,921,97,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,921,97,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,921,97,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,921,97,23,49,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,49,4000", "input_tv": "sendir,1:3,1,40192,1,1,97,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,874,96,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,864,96,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,897,97,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,897,97,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,897,97,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,897,97,23,25,23,49,23,25,23,49,23,25,23,49,23,49,23,25,23,25,23,25,23,25,23,49,23,49,23,25,23,25,4000", "input_bd": "sendir,1:3,1,40192,2,1,97,23,25,23,49,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,25,23,25,23,25,23,49,23,25,23,49,23,25,23,25,628,96,23,25,23,49,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,25,23,25,23,25,23,49,23,25,23,49,23,25,23,25,624,96,23,25,23,49,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,25,23,25,23,25,23,49,23,25,23,49,23,25,23,25,660,97,23,25,23,49,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,25,23,25,23,25,23,49,23,25,23,49,23,25,23,25,660,97,23,25,23,49,23,49,23,25,23,49,23,25,23,25,23,25,23,25,23,25,23,25,23,49,23,25,23,25,23,25,23,49,23,25,23,49,23,25,23,25,4000" } itach = iTach(ipaddress="192.168.1.111", port=4998) stereo = itach.add(VirtualDevice(name="stereo", commands=commands)) if __name__ == "__main__": print(stereo.toggle_power()) print(stereo.volume_up()) print(stereo.volume_down())
def test_itach(self): itach = iTach(ipaddress="192.168.1.111") assert itach.ipaddress == "192.168.1.111" assert itach.port == 4998 assert itach.devices == {}