×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

PyINDI not working...

  • a Guest
  • a Guest's Avatar Topic Author
  • Visitor
  • Visitor

PyINDI not working... was created by a Guest

Hello,
This basic code is not working after the upgrade of Rasberry Pi OS yesterday.
INDIserver is working ok and I confirmed with KStar.
On KStar, I can move the AVX mount.

import PyIndi
import time
import sys
import threading

class IndiClient(PyIndi.BaseClient):
    def __init__(self):
        super(IndiClient, self).__init__()

    def newDevice(self, d):
        pass

    def newProperty(self, p):
        pass

    def removeProperty(self, p):
        pass

    def newBLOB(self, bp):
        global blobEvent
        print("new BLOB ", bp.name)
        blobEvent.set()
        pass

    def newSwitch(self, svp):
        pass

    def newNumber(self, nvp):
        pass

    def newText(self, tvp):
        pass

    def newLight(self, lvp):
        pass

    def newMessage(self, d, m):
        pass

    def serverConnected(self):
        pass

    def serverDisconnected(self, code):
        pass


# connect the server
indiclient = IndiClient()
indiclient.setServer("localhost", 7624)

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")
    sys.exit(1)

# connect the scope
telescope = "Celestron GPS"
device_telescope = None
telescope_connect = None

# get the telescope device
device_telescope = indiclient.getDevice(telescope)
while not (device_telescope):
    time.sleep(0.5)
    device_telescope = indiclient.getDevice(telescope)

# wait CONNECTION property be defined for telescope
telescope_connect = device_telescope.getSwitch("CONNECTION")
while not (telescope_connect):
    time.sleep(0.5)
    telescope_connect = device_telescope.getSwitch("CONNECTION")

# if the telescope device is not connected, we do connect it
if not (device_telescope.isConnected()):
    # Property vectors are mapped to iterable Python objects
    # Hence we can access each element of the vector using Python indexing
    # each element of the "CONNECTION" vector is a ISwitch

    telescope_connect[0].s = PyIndi.ISS_ON  # the "CONNECT" switch   --> I got error here.  TypeError: 'ISwitchPropertyview' object is not subscriptable

    telescope_connect[1].s = PyIndi.ISS_OFF  # the "DISCONNECT" switch
    indiclient.sendNewSwitch(telescope_connect)  # send this new value to the device

I have no idea about this error. It worked before I upgraded Rasberry Pi 4 OS.
telescope_connect variable is just empty.
I started "indiserver indi_celestron_gps" before run python code. I don't see any error while running.
Does anyone have any idea?
Thank you.
2 years 7 months ago #75121

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0

Replied by Remy on topic PyINDI not working...

I had same issue recently when using the default PyINDI package,
i ran this command to install the latest and then everything work fine, you might want to give it a try:pip install git+https://github.com/indilib/pyindi-client.git@68803a1#egg=pyindi-client
2 years 7 months ago #75136

Please Log in or Create an account to join the conversation.

Moderators: Radek Kaczorek
Time to create page: 0.321 seconds