cdallum
September 18, 2018, 12:20am
24
Thanks for the tips. I'll make these changes and see how it works.
Regarding some of your advice, I picked up information from other posts. Sounds like these items aren't needed, though, so I'll go ahead and remove them.
TelnetClose()
All of this goes in a driver for a device that will connect to telnet. You open the connection this way:
telnetConnect(String ip, int port, String username, String password)
or
telnetConnect(Map options, String ip, int port, String username, String password)
Only option is "termChars" which changes what the termination character is.
Then, to send/receive messages:
def sendMsg(String msg) {
return new hubitat.device.HubAction(msg, hubitat.device.Protocol.TELNET)
}
and
def parse(String …
PauseExecution(1000)
Here you go:
This part goes in your initialization code, to open the telnet connection.
//open telnet connection
telnetConnect(ip, 23, "lutron", "integration")
//give it a chance to start
pauseExecution(1000)
That opens a telnet connection on port 23 of "ip", with login "lutron" and password "integration".
Use a method like this to send a message:
def sendMsg(String msg) {
return new hubitat.device.HubAction(msg, hubitat.device.Protocol.TELNET)
}