I'm not sure if that's INDI backend issue (INDI Library: 2.0.3) or pyindi-client issue (1.9.1) or I'm missing something.
Looks like getDevices() client function always returns devices set at the first time client connected to INDI server. The value is not updated between reconnects.
How to reproduce:
Simple INDI client working in infinite loop and printing names of active devices (see below)
While script running start indiserver with 3 drivers of your choice. Observe list of connected devices printed by the script.
Stop indiserver (DO NOT restart python script) and rerun indiserver with 5 drivers of your choice. Observe list of connected devices printed by the script. You will notice that not all devices are printed out by the script.
#!/usr/bin/env python3
# coding=utf-8
import PyIndi, time
class IndiClient(PyIndi.BaseClient):
def __init__(self):
super(IndiClient, self).__init__()
def serverConnected(self):
'''Emmited when the server is connected.'''
print(f"Server connected ({self.getHost()}:{self.getPort()})")
def serverDisconnected(self, code):
'''Emmited when the server gets disconnected.'''
print(f"Server disconnected (exit code = {code},{self.getHost()}:{self.getPort()})")
self.disconnectServer() # double shot to disconnect
indiclient = IndiClient()
indiclient.setServer("localhost", 7624)
while True:
while not indiclient.isServerConnected():
indiclient.connectServer()
if indiclient.isServerConnected():
time.sleep(1)
else:
print(f"Cannot connect to INDI server on {indiclient.getHost()}:{str(indiclient.getPort())}. Retrying in 5 seconds.")
time.sleep(5)
devices = indiclient.getDevices() # Get all devices from INDI server
for device in devices:
device_name = device.getDeviceName()
print(device_name)
time.sleep(1)
I'm not sure if that's INDI backend issue (INDI Library: 2.0.3) or pyindi-client issue (1.9.1) or I'm missing something. Looks like getDevices() client function always returns devices set at the first time client connected to INDI server. The value is not updated between reconnects.
How to reproduce: