Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Third party Python API for INDI client

Project Description



An INDI Client Python API, auto-generated from the official C++ API using SWIG.


Use pip (recommended, but not yet)

pip install pyindi-client

Alternatively download a release, extract it and run

python install

The file setup.cfg contains configuration options (mainly concerning libindi installation path).


For the above installation to work, you need to have installed from your distribution repositories the following packages: Python setup tools, Python development files, libindi development files and swig.

  • On an Ubuntu-like distribution, you may use

    apt-get install python-setuptools
    apt-get install python-dev
    apt-get install libindi-dev
    apt-get install swig
  • On a Fedora-like distribution, you may use

    dnf install python-setuptools
    dnf install python-devel
    dnf install libindi-devel
    dnf install swig

Getting Started

In the following simple example, an INDI client class is defined giving the implementation of the pure virtual INDI client functions. This is mandatory. This class is instantiated once, and afer defining server host and port in this object, a list of devices together with their properties is printed on the console.

# for logging
import sys
import time
import logging
# import the PyIndi module
import PyIndi

# Fancy printing of INDI states
# Note that all INDI constants are accessible from the module as PyIndi.CONSTANTNAME
def strISState(s):
    if (s == PyIndi.ISS_OFF):
        return "Off"
        return "On"
def strIPState(s):
    if (s == PyIndi.IPS_IDLE):
        return "Idle"
    elif (s == PyIndi.IPS_OK):
        return "Ok"
    elif (s == PyIndi.IPS_BUSY):
        return "Busy"
    elif (s == PyIndi.IPS_ALERT):
        return "Alert"

# The IndiClient class which inherits from the module PyIndi.BaseClient class
# It should implement all the new* pure virtual functions.
class IndiClient(PyIndi.BaseClient):
    def __init__(self):
        super(IndiClient, self).__init__()
        self.logger = logging.getLogger('IndiClient')'creating an instance of IndiClient')
    def newDevice(self, d):"new device " + d.getDeviceName())
    def newProperty(self, p):"new property "+ p.getName() + " for device "+ p.getDeviceName())
    def removeProperty(self, p):"remove property "+ p.getName() + " for device "+ p.getDeviceName())
    def newBLOB(self, bp):"new BLOB "+
    def newSwitch(self, svp): ("new Switch "+ + " for device "+ svp.device.decode())
    def newNumber(self, nvp):"new Number "+ + " for device "+ nvp.device.decode())
    def newText(self, tvp):"new Text "+ + " for device "+ tvp.device.decode())
    def newLight(self, lvp):"new Light "+ + " for device "+ lvp.device.decode())
    def newMessage(self, d, m):"new Message "+ d.messageQueue(m).decode())
    def serverConnected(self):"Server connected ("+self.getHost()+":"+str(self.getPort())+")")
    def serverDisconnected(self, code):"Server disconnected (exit code = "+str(code)+","+str(self.getHost())+":"+str(self.getPort())+")")

logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)

# Create an instance of the IndiClient class and initialize its host/port members

# Connect to server
print("Connecting and waiting 1 sec")
if (not(indiclient.connectServer())):
     print("No indiserver running on "+indiclient.getHost()+":"+str(indiclient.getPort())+" - Try to run")
     print("  indiserver indi_simulator_telescope indi_simulator_ccd")

# Print list of devices. The list is obtained from the wrapper function getDevices as indiclient is an instance
# of PyIndi.BaseClient and the original C++ array is mapped to a Python List. Each device in this list is an
# instance of PyIndi.BaseDevice, so we use getDeviceName to print its actual name.
print("List of devices")
for dev in dl:

# Print all properties and their associated values.
print("List of Device Properties")
for d in dl:
    print("-- "+d.getDeviceName())
    for p in lp:
        print("   > "+p.getName())
        if p.getType()==PyIndi.INDI_TEXT:
            for t in tpy:
                print("       ""("+t.label+")= "+t.text)
        elif p.getType()==PyIndi.INDI_NUMBER:
            for t in tpy:
                print("       ""("+t.label+")= "+str(t.value))
        elif p.getType()==PyIndi.INDI_SWITCH:
            for t in tpy:
                print("       ""("+t.label+")= "+strISState(t.s))
        elif p.getType()==PyIndi.INDI_LIGHT:
            for t in tpy:
                print("       ""("+t.label+")= "+strIPState(t.s))
        elif p.getType()==PyIndi.INDI_BLOB:
            for t in tpy:
                print("       ""("+t.label+")= <blob "+str(t.size)+" bytes>")

# Disconnect from the indiserver

See the examples for more simple demos of using pyindi-client.

See the interface file for an insight of what is wrapped and how.

For documentation on the methods of INDI Client API, refer to the INDI C++ API documentation.



pyindi-client code is free software under the GNU General Public License v3 or later (GPLv3+).

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(5.2 kB) Copy SHA256 Hash SHA256
Source Sep 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting