Hubitat LiteTouch 2000 ethernet->serial integration

No idea if anyone here uses this, I had a few users of my plugin for this on Vera, so I know it's out there. It works for control, but...

I am having 2 problems though:

  1. The polling loop doesn't seem to be working. It should continuously poll the loads in a circular queue to ensure the states are up to date since the LT2000 protocol doesn't notify when changes are made via wall keypad.
  2. When a load is changed via the Hubitat, it does a poll on it to verify that the change took. I get a "read timed out" error. Data is coming back though, but it seems like it's not interpreting it. If I telnet to the port and type the command to poll a load, the response that comes back is in the format "18 250\r". I can't figure out why it's not matching this.

Any ideas here? I've never done anything in Groovy before.

Hrm, looks like if I want to hold open a single TCP connection and re-use it, I can't do it through the app, and I need to do it in a driver. So converting it to a driver for the ethernet portion, which will create child devices similar to how the Elk M1 integration works.

Don't run the code I posted, it starts to be a disaster because I think it's opening multiple connections to the serial port and that's causing some issues. I'll post a note on the original post when it's fine.

Any pointers on this code appreciated.

Any ideas on this?