The INDI specification and protocol is widely used in the astronomical world for controlling telescopes, however it is a general purpose protocol and can be used for any form of instrumentation. It defines the data to be divided into ‘switches’, ‘lights’, ‘numbers’, ‘text’ and ‘BLOBs’ (binary large objects), which covers a wide swathe of typical uses.
The basic idea is that a driver has to be written, interfacing to your own instrument code and organising any data you present into a standard format which includes things such as labels and numeric format strings. This is then served on a port to which a client can connect. The client could be remote, or could run locally.
The client uses the labels and names to present the data, and to send controlling information, such as switch On or Off. The client can be anything from an automating script, terminal client, distributed displays or anything which can be written which understands the protocol. In my case I was aiming at a terminal display.
As the client learns everything from the presented protocol, it can be general purpose, the same client being able to connect to any INDI service. It could also be written to control a specific instrument if required.
So the project turned into three Python programs:
indipydriver
This provides classes you use to create a driver which sets, updates and reads data, with a further class to serve your driver (or multiple drivers) on a port.
indipyterm
This is the general purpose terminal client, it is simply run, connects to a port, and displays and controls the instrument parameters it learns. There is no user programming involved.
indipyclient
This is a Python package that most users will not run directly, it is used by indipyterm to decode the INDI protocol and present the received data as Python classes. This code could have been an integral part of indipyterm, but I separated it into its own package as it could be useful if a user wants to create his own clients or scripts for automated remote control.
Installing
All three packages are available on Pypi, indipydriver is typically installed into a project virtual environment, and your own code will import it and use its classes.
Installing indipyterm will automatically install and use indipyclient, together with the ‘textual’ package – and its dependencies, which is a library for creating terminals.
If you use the uv tool, indipyterm can be very simply loaded from Pypi and run with the single command:
uvx indipyterm
For full details of the indipydriver package and its classes, together with examples, follow the readthedocs link.