Here's the script I put together to check if the Flip Flap is open, close it if it is, and wait for it to report closed. I also have the companion to open it if it's closed.
BTW, a side note about the Flip Flat: Don't use it to generate flats immediately after a set of lights during a job if you have an OAG. Don't ask why I know this...
#!/bin/bash
#Shell script to close/park the Flip Flat if the cap is open
#AirBourn 2022
debug=false
coverProp="Flip Flat.Status.Cover"
motorProp="Flip Flat.Status.Motor"
#Delineator
IFS='='
coverStatus=$(indi_getprop "$coverProp")
read -ra cArr <<< "$coverStatus"
coverString=${cArr[1]}
if $debug; then echo " cStatus: ${coverStatus}"; fi
if $debug; then echo " cString: ${coverString}"; fi
motorStatus=$(indi_getprop "$motorProp")
read -ra mArr <<< "$motorStatus"
motorString=${mArr[1]}
if $debug; then echo " mStatus: ${motorStatus}"; fi
if $debug; then echo " mString: ${motorString}"; fi
if [[ "$coverString" == "Open" ]]
then
if $debug; then echo " Sending Close Command"; fi
indi_setprop "Flip Flat.CAP_PARK.PARK=On"
indi_setprop "Flip Flat.CAP_PARK.UNPARK=Off"
while [ $coverString != "Closed" ]
do
coverStatus=$(/usr/bin/indi_getprop "$coverProp")
#echo "Cover: ${coverStatus}"
read -ra cArr <<< "$coverStatus"
coverString=${cArr[1]}
if $debug; then echo " Cover: ${coverString}"; fi
motorStatus=$(/usr/bin/indi_getprop "$motorProp")
#echo "Motor: ${motorStatus}"
read -ra mArr <<< "$motorStatus"
motorString=${mArr[1]}
if $debug; then echo " Motor: ${motorString}"; fi
done
fi
if $debug; then echo " Cover is ${coverString}"; fi
exit 0