Found the answer after looking at some other example code. This works:
import socket
import time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(2)
s.connect((‘192.168.216.129’, 29999))
def sendCommand(cmd):
cmd = cmd + ‘\n’
print(cmd)
s.sendall(cmd.encode())
time.sleep(5)
rcvd = s.recv(4096)
print(rcvd)
while (1):
sendCommand(‘programState’)
Mark