berkinet wrote:You might want to organize the plugin so that on startup, and perhaps as an action, it searches for Sky boxes and stores any found hosts in plugin-properties. If there is typically just one box per location, that would be fine. On the other hand, if there could be multiple boxes, you might look at the device factory model. I have no experience with the factory model, but I think it would do what you want.
Yeah, that's basically what I'm aiming for - but as one or more devices with an on/off state and serial no property, not plugin-properties.
berkinet wrote:To handle all this in a plugin, you could do something like:
In deviceStartComm() call into the sky code to populate your box(es) into properties and then have the code return control back to plugin.py. So, instead of waiting for command line input, the code could just quit.
As well as showing the on/off state, the device(s) will be the target for actions (SkyRemote actions > Send command: Device [x], Command [y]) in case there are more than one box. (I have two, but the second is still in its box until I've finished watching a recorded series on the old non-HD box). I'll also have to use the save() and load() functionality in the existing code to save the host details to file, because it stores a huge array of data, not just IP address or serial no - but as you say, call this on startup and shutdown, as well as an action/menu item.
Is the factory model an Indigo concept or Python concept - I've not heard of it in either, but presumably Indigo?
berkinet wrote:In runConcurrentThread() just loop, with a 0.5 or so, second pause waiting for events to be fired or action requests to be received
That's what I wasn't sure of last night - if I needed runConcurrentThread() to pro-actively monitor for events/actions, or whether Indigo would call one of my methods when one of my actions was executed, allowing me to process it accordingly.
I'm aiming to have the additional methods in the Sky code done tonight, to a point that I can call everything from the command line that I'm anticipating the plugin calling, rather than the current embedded calls within 'self'. myMain(), mySearchHosts(), mySave(), myLoad(), mySendCommand(), etc. If I get those done quick enough, I might even create a basic plugin with a bunch of test buttons within the plugin's configUI dialog box.
Peter