#!/usr/bin/python ''' Created on Oct 4, 2010 @author: sam ''' import pylights, time, kynetx, re, json from pprint import pprint p = pylights.plm("/dev/tty.serial") #,"verbose") d = pylights.deviceFile("./devices.xml") c = pylights.commandsFile("./commands.xml") app = kynetx.kynetx("a41x138") def showmessage(info, from_addr, command): print index = d.getIndexByAddress(from_addr) from_name = d.getNameByIndex(index) from_addr = re.sub('\s+','.',p.list_to_hex(from_addr)) if from_name: print "got message from: " + p.list_to_hex(from_addr) else: from_name = "unknown" print "got message from: " + from_addr print "command hex: " + hex(command[0]) command_name = c.getCommandFromHex(command[0]) event_num = c.getCommandNumFromHex(command[0])
import kynetx from Tkinter import * app = kynetx.kynetx("a369x122") data = app.raise_event("desktop", "say_hello") action = app.directives[0]['action'] if action == "go": msg = app.directives[0]['options']['msg'] root = Tk() if msg is not None: w = Label(root, text=msg) else: w = Label(root, text="No msg from Kynetx today!") w.pack() root.mainloop()
import kynetx app = kynetx.kynetx("a41x135") data = app.raise_event("test","events") print data for directive in app.directives: print directive['action']