Long-lived python script with Indigo access?

Ask questions about integrating other services (internet and otherwise) and applications with Indigo.
Posts: 4
Joined: Thu Feb 16, 2023 7:21 am

Long-lived python script with Indigo access?

Post by NOVAmike »

I have a 3rd party device that provides an OS daemon to talk to it. It creates 3 named pipes, 2 are a command/response pair and the 3rd is read-only and reports async events.

I can handle reading and writing ASCII to/from the first two pipes via normal Indigo python scripts. No problem. Those script invocations run to completion and exit.

But I'm having trouble figuring out how to handle the async events. I need to open the event pipe and read from it in a long-lived loop (possibly parsing the events into setting a handful of Indigo variables). I can then automate things using triggers based on those variables changing state. The events could be several per second or one per week and I don't want to miss any.

My concern is the "long-lived loop" will be a problem. In my experience, Indigo doesn't like running scripts that don't terminate after a few seconds.

So how do I create a Python script with Indigo server access that runs indefinitely as a daemon?

Is this just a very simple Indigo plugin? I looked there but it seemed very focused on config and UI elements that don't apply to my case.

Thanks for any guidance!
User avatar
jay (support)
Site Admin
Posts: 18313
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas

Re: Long-lived python script with Indigo access?

Post by jay (support) »

If you run a Python script as an external script (as opposed to an embedded script), it can run forever (in it's own process).
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Post Reply

Return to “Integrating Services/Applications”