code: def _command(self, msg):
          
          logger.debug('send command to %s', "ws://{}:{}".format(self.ip, self.port));
          try:
              websocket = yield from websockets.connect(
                  "ws://{}:{}".format(self.ip, self.port), timeout=self.timeout_connect)
          except:
              logger.debug('command failed to connect to %s', "ws://{}:{}".format(self.ip, self.port));
              return False
  
          logger.debug('command websocket connected to %s', "ws://{}:{}".format(self.ip, self.port));
  
          try:
              yield from self._send_register_payload(websocket)
  
              if not self.client_key:
                  raise PyLGTVPairException("Unable to pair")
  
              yield from websocket.send(json.dumps(msg))
  
              if msg['type'] == 'request':
                  raw_response = yield from websocket.recv()
                  self.last_response = json.loads(raw_response)
  
          finally:
              logger.debug('close command connection to %s', "ws://{}:{}".format(self.ip, self.port));
              yield from websocket.close()
docs: Send a command to the tv.