Page 1 of 1

Communicating between Plugin and Background Tasks

PostPosted: Tue Dec 25, 2018 8:38 am
by dclonts
Maybe a dumb question, but here goes. Rewriting my AppleScript pool control software in Python.

I will use a low level serial communication task run as a thread. Running it in Background Tasks.

What is best way to communicate between my custom pool Plugins and the task? since they are all running in the server, assume I can cross access namespaces, but not sure how. would prefer to set up queue in and queue out of the backgrounder.

in AppleScript communicated using indigo variables, but that was a real kluge.

Re: Communicating between Plugin and Background Tasks

PostPosted: Thu Dec 27, 2018 11:37 am
by jay (support)
So, you envision a separate process that does the low-level communication with the serial port, and then some kind of queueing mechanism to accept requests from any number of plugins? I'm trying to understand the components in your scenario and the architecture. For instance, I'm unclear what you mean by "Running it in Background Tasks" means...

Re: Communicating between Plugin and Background Tasks

PostPosted: Thu Dec 27, 2018 11:49 am
by FlyingDiver
This would be a lot easier if you just wrote it all in one plugin with the serial comm running in it's own thread. Or just poll the serial port in the (existing) background thread. Trying to replicate what you had to do to make it work in AppleScript is going to make it way more complicated.

If it was me, I'd be looking at how the Pentair plugin works. It does serial comm to the pool controller. Or one of the many other plugins that maintain a serial connection to whatever they're controlling. Lutron RRA2, RFPlayer, Concord4 are just the ones I deal with.