How to add another python script to Pre-Post Observation Script?

I’m currently using the following configuration in my station:

satnogs-pre {{ID}} {{FREQ}} {{TLE}} {{TIMESTAMP}} {{BAUD}} {{SCRIPT_NAME}}
satnogs-post {{ID}} {{FREQ}} {{TLE}} {{TIMESTAMP}} {{BAUD}} {{SCRIPT_NAME}}

I want to incorporate two additional Python scripts, ON.py and OFF.py, to control a GPIO pin. Specifically, I want the pin to be set to 1 (on) when a satellite rises and 0 (off) when the satellite sets.

I’ve already attempted to add python /home/pi/ON.py in the satnogs-pre file. The ON.py script is set with chmod 777 and works well when I manually call the satnogs-pre file. However, it doesn’t run during a real observation or when the file is executed by the SatNOGS client.

I’m seeking assistance to resolve this issue. Can someone help me?

Hi,
this is on a RPi I guess?
I’d start with checking the permissions for the gpio, the pi user and satnogs-client are different users with different permissions and group membership.
Add echo statements in the scripts so you see them in the logs, that way you will be able to see if there’s errors directly after, or the echo is missing altogether.
I have done this in the past, controlling relays for vhf/uhf and enabling preamp, so I know it can be done.

Hello together,

I also would like to hook up onto this topic, since I am planning to switch UHF and VHF antennas with respect to the observation frequency. Moreover, I would like to switch LNAs on/off at the beginning/end of an observation using the GPIO of RPi4 running the SatNOGS Client Ansible.

I wasn’t able to get any work done on that, but I have started with some research. Maybe following threads will help you: