×

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

Bi-monthly release with minor bug fixes and improvements

Script to park the telescope

  • Posts: 9
  • Thank you received: 0
Hello.

I would like to have a simple script that reads a note and if it says "1", for example, it parks the telescope. If it says "0", waits some time and reads it again.
It would do it while a normal session with INDI and Kstars is going on. The note would be received from another computer in the same network.
I am almost new to scripts in Linux so any help would be appreciated.

The computer is a Raspberry Pi 3b+ and the telescope is a Meade LX200 GPs.

Thanks.

David Cejudo
Observatorio El gallinero
El Berrueco, Madrid, Spain
4 years 3 months ago #47064

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

  • Posts: 278
  • Thank you received: 17

Replied by S on topic Script to park the telescope

I don't know why you want to do this, but I do something similar for weather safety using this

indilib.org/devices/weather/weather-safety-proxy.html

and a simple script that reads a flag from another RPI using ssh.
4 years 3 months ago #47067

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

  • Posts: 9
  • Thank you received: 0

Replied by David on topic Script to park the telescope

Hello.
So if i understand it correctly, the Weather Safety Proxy reads, through a script, a note like this:

{
"timestamp_utc": "2019-03-24T23:26:02",
"roof_status": {
"open_ok": 0,
}
}

Would you mind to share that script?

And if its is "1", the session goes on and if it is "0", triggers an alert, correct?
But i did not find an option to park the telescope in the weather tab in Eckos. There are options for roof closure only.

David.
4 years 3 months ago #47093

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

  • Posts: 278
  • Thank you received: 17

Replied by S on topic Script to park the telescope

My script looks like this
#!/usr/bin/python3
import json
import subprocess
from datetime import datetime
encoding = 'utf-8'
 
now=datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S%z")
res = subprocess.check_output(["/home/pi/isItClear.sh"])
clear=int(float(res.decode(encoding))>0.75)
 
if clear==0:
    msg="Cloudy"
elif clear==1:
    msg="Sky is clear"
else:
    msg="Something odd is going on..."
    clear=0
 
print(json.dumps({"timestamp_utc": now,"roof_status": {"open_ok": clear,"reasons": msg}}))

The 'isItClear.sh' script just read a file on another RPI, which has an all sky camera attached to it and determines if it is clear by counting the number of stars it catches.

Nothing have been thoroughly tested, so use at your own risk ;-)
4 years 3 months ago #47096

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

  • Posts: 9
  • Thank you received: 0

Replied by David on topic Script to park the telescope

Hello.

Thanks for your answer. I tried the script adapted to my set up but could not make it work.
I wrote a pretty simple script to check if it works, it seems to work when run the module with IDLE, i get this:

{"timestamp_utc": 2019-12-31T01:10:46 ,"roof_status": {"open_ok": 1}}

But when i try with INDI the log at the INDI control panel shows:
"[ERROR] Got no output from script..."
"[WARNING]Soft error occurred during UNSAFE conditions , IGNORE

Any help would be appreciated.

This is my simple script:

#!/usr/bin/python3
import json
import subprocess
from datetime import datetime
encoding = 'utf-8'

now=datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S%z")

print(json.dumps({
"timestamp_utc": now,
"roof_status": {
"open_ok": 1
}
}))
4 years 3 months ago #47472

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

Time to create page: 0.748 seconds