T2 = 0 TF2 = 0 txt = Colors() try: ic = Ice.initialize(sys.argv) adapter = ic.createObjectAdapterWithEndpoints( "TemperatureAdapter", ic.getProperties().getProperty("TemperatureServer.Endpoints")) object = TemperatureI() adapter.add(object, ic.stringToIdentity("Temperature")) adapter.activate() except: status = 1 traceback.print_exc() sys.stdout.write(txt.warning("Monitoring sensor...\t")) sys.stdout.flush() p = subprocess.Popen("sudo pcsensor", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) out = p.stdout.readline() if out.find("Couldn't find the USB device, Exiting") == -1: print txt.bold(txt.green("Running")) else: print txt.bold(txt.fail("Failed --> " + out)) sys.exit() while True: p = subprocess.Popen("sudo pcsensor", stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
props["x10server.HouseModule." + str(i) + ".type"])) else: Modules.append( Mod(props["x10server.HouseModule." + str(i) + ".name"], props["x10server.HouseCode"] + str(i), props["x10server.HouseModule." + str(i) + ".type"], False)) print txt.bold(txt.green("Done")) txt = Colors() status = -1 ic = None ## Initialize HEYU system sys.stdout.write(txt.warning("Initializing x10 system...\t")) sys.stdout.flush() proc = subprocess.Popen("sudo heyu start", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) (out, err) = proc.communicate() try: ic = Ice.initialize(sys.argv) adapter = ic.createObjectAdapterWithEndpoints( "NetAdapter", ic.getProperties().getProperty("x10server.Endpoints")) if err != "": print txt.bold(txt.fail("Failed")) print txt.fail("Can't open tty line. Check the permissions.")
import sys, traceback, Ice import x10 from Colors import Colors txt = Colors() status = 0 ic = None try: sys.stdout.write(txt.warning("Connecting to x10server...\t")) sys.stdout.flush() ic = Ice.initialize(sys.argv) base = ic.stringToProxy(ic.getProperties().getProperty("x10view.Proxy")) net = x10.NetPrx.checkedCast(base) if not net: raise RuntimeError("Invalid proxy") print txt.green(txt.bold("Done")) while True: entry = raw_input(">> ") if entry == "show environment": print net.showEnvironment() elif entry.find("deactivate") != -1: words = entry.split(" ") net.setInactive(words[1]) elif entry.find("activate") != -1: words = entry.split(" ") net.setActive(words[1]) except: traceback.print_exc() status = 1