I dont think you can use the physicalgraph.device.Protocol.LAN protocol. From what I remember reading, there’s a bug in the Smartthings hub where it strips some of the things needed. (see this TCP Commands not transmitting with HubAction?)
You may have to rewrite it to something like this…
new physicalgraph.device.HubAction(“body”: “$theCom\r\n”, “headers”: [ HOST: HostAddress(), “Content-Type”: “text/plain; charset=utf-8”])