Example #1
0
def do_command(self, command,device_id):
    token = login_to_logitech(self)
    client = harmony_client.create_and_connect_client(HARMONY_IP, HARMONY_PORT, token)
    print 'doing command', command
    pprint.pprint(client.do_command(device_id,command))
    client.disconnect(send_close=True)
    return 0
Example #2
0
def change_channel(self, channel):
    token = login_to_logitech(self)
    client = harmony_client.create_and_connect_client(HARMONY_IP, HARMONY_PORT, token)
    print 'changing channel', channel
    pprint.pprint(client.change_channel(DEVICE_ID_MAPPINGS['tv'],channel))
    client.disconnect(send_close=True)
    return 0
Example #3
0
def show_config(self):
   """Connects to the Harmony and prints its configuration."""
   token = login_to_logitech(self)
   client = harmony_client.create_and_connect_client(HARMONY_IP, HARMONY_PORT, token)
   self.wfile.write(client.get_config())
   client.disconnect(send_close=True)
   return 0
Example #4
0
def start_activity(self, activity_id):
    """Connects to the Harmony and prints its configuration."""
    token = login_to_logitech(self)
    client = harmony_client.create_and_connect_client(HARMONY_IP, HARMONY_PORT, token)
    print 'starting activity', activity_id
    pprint.pprint(client.start_activity(activity_id))
    client.disconnect(send_close=True)
    return 0
Example #5
0
def show_config(args):
    """Connects to the Harmony and prints its configuration."""
    token = login_to_logitech(args)
    client = harmony_client.create_and_connect_client(
        args.harmony_ip, args.harmony_port, token)
    pprint.pprint(client.send_command())
    client.disconnect(send_close=False)
    return 0
Example #6
0
def get_client(args):
    """Connect to the Harmony and return a Client instance."""
    token = login_to_logitech(args)
    client = harmony_client.create_and_connect_client(
        args.harmony_ip, args.harmony_port, token)
    return client