Hello. I'm writing a client using PyIndi-Client to control a ZWO ASI6200MM Pro. I am using Python package Flask to allow for the exposure info to be sent as a http POST request. The client and indiserver are running on a Raspberry Pi 4. The camera is not attached to any telescope but is connected to the RPi4 via USB. When I send the POST request to take the exposure, the client outputs the following:
2020-07-2420:46:29,834 new Message 2020-07-24T20:46:29: [INFO] Taking a 10 seconds frame...
2020-07-2420:46:29,836 172.19.0.1:59174 POST /elements/1/cameras/1:startExposure 1.1202579393[2020-07-2420:46:29,836] 172.19.0.1:59174 POST /elements/1/cameras/1:startExposure 1.12025793932020-07-2420:46:40,939 new Message 2020-07-24T20:46:40: [INFO] Exposure done, downloading image...
2020-07-2420:46:41,064 new Message 2020-07-24T20:46:41: [INFO] Download complete.
2020-07-2420:46:41,066 new Message 2020-07-24T20:46:41: [WARNING] Telescope focal length is missing.
2020-07-2420:46:41,067 new Message 2020-07-24T20:46:41: [WARNING] Telescope aperture is missing.
INDI server indiserver/7624 disconnected.
2020-07-2420:46:43,274 Server disconnected (exit code = -1,indiserver:7624)
In case it is relevant to know, here is the simple script to send the request:
import requests
url = 'http://localhost:9001/elements/1/cameras/1:startExposure'
data = {'exposure':10}
x = requests.post(url, json = data)
print(x.text)
I have copied code from www.indilib.org/develop/indi-python-bindings.html to print out BLOB information after the exposure is taken, but this is obviously not printed before the indiserver disconnects, so it seems the problem happens after the exposure is taken but before the indiserver receives the BLOB. I am hoping someone can explain what the error code -1 means (I have been unable to find any documentation of indiserver error codes) and tell me if there is some way to fix this problem. Thank you.
Last edit: 3 years 9 months ago by Stephen Berg. Reason: fixed typo
I should have added, this is my newBLOB method for post-exposure image processing:
def newBLOB(self, bp):
self.logger.info("new BLOB " + bp.name)
print("name: ", bp.name," size: ", bp.size," format: ", bp.format)
# get image data
fits=bp.getblobdata()
print(type(fits))
# write image data to BytesIO buffer
blobfile = io.BytesIO(fits)
# open a file and save buffer to disk
with open("%s.fits" % datetime.now(), "wb") as f:
f.write(blobfile.getvalue())
blobfile.close()
INDI server still running? Maybe the client disconnects after they send the request? I'm not exactly familiar with how the python binding work, I presume they work along the same lines as the C++ client?
Thanks for the reply. The INDI server and the client are running in separate docker containers linked with a docker network, and yes, the INDI server continues to run after the client is forcibly disconnected. If the docker container with the client is rebooted, it will connect to the INDI server again with no problems. However, the fact that it disconnects after an exposure is a pretty large issue in the context of the project I’m working on, because there is nothing in the client that tells the server to disconnect after an exposure. Also, I have only use PyIndi so I am not very familiar with the C++ client, but I would also assume it works along the same lines. Do you know what the error code -1 signifies?
If the pyINDI client acts the same as the C++ one, then there shouldn't be any disconnections. Maybe it's best to communicate with the pyINDI maintainer?