Hello,

I would like to develop a client for focusing automatically my spectrograph.
My starting point is the "2.3. Goto Vega and take some pictures" example from the tutorial

My first question is directly related to this example where I don't really understand this piece of code:
ccd_connect=device_ccd.getSwitch("CONNECTION")
while not(ccd_connect):
time.sleep(0.5)
ccd_connect=device_ccd.getSwitch("CONNECTION")
if not(device_ccd.isConnected()):
ccd_connect[0].s=PyIndi.ISS_ON # the "CONNECT" switch
ccd_connect[1].s=PyIndi.ISS_OFF # the "DISCONNECT" switch
indiclient.sendNewSwitch(ccd_connect)
Why do we check for ccd.isConnected() if before we checked device_ccd.getSwitch("CONNECTION")?

My second question is about the Focuser simulator. My code, cloned from the tutorial example, is as follows:
focus_max_pos = device_focus.getNumber("FOCUS_MAX")
while focus_max_pos is False:
time.sleep(0.5)
focus_max_pos = device_focus.getNumber("FOCUS_MAX")
print(f"focus_max_pos = {focus_max_pos[0].value}")

focus_max_pos[0].setValue(8333)
indi_client.sendNewProperty(focus_max_pos)

focus_max_pos = device_focus.getNumber("FOCUS_MAX")
while focus_max_pos is False:
time.sleep(0.5)
focus_max_pos = device_focus.getNumber("FOCUS_MAX")
print(f"focus_max_pos = {focus_max_pos[0].value}")

focus_speed = device_focus.getNumber("FOCUS_SPEED")
while focus_speed is False:
time.sleep(0.5)
focus_speed = device_focus.getNumber("FOCUS_SPEED")
print(f"focus_speed = {focus_speed[0].value}")

I obtain in the terminal:
...
focus_max_pos = 0.0
focus_max_pos = 8333.0
focus_speed = 8333.0
Why does this code set the focus speed to 8333 also? I suspect there is something in principle of the properties I don't really understand :-(

I attach my entire code to this message.

Thank you for your help,

Antoine

Read More...