from tellcore.telldus import TelldusCore core = TelldusCore() lamp = core.add_device("lamp", "arctech", "selflearning-switch", house=12345, unit=1) lamp.turn_on() for device in core.devices(): device.turn_off()
print "Local current time :", localtime print 'Init telldus core' lightcore = TelldusCore() light_list = [] names = [] groups = [] # Parse from XML xml_config = untangle.parse('config.xml') for switch in xml_config.control.devices.switch: names.append(switch['name']) light_list.append(lightcore.add_device( switch['name'], switch['protocol'], switch['model'], house=switch['house'], unit=switch['unit'], code=switch['code'])) # Extract groups from config file row = 0 for group in xml_config.control.group: groups.append([]) groups[row].append(group['name']) groups[row].append(group['repeats']) for switch in group.switch: groups[row].append(switch['name']) row += 1