Add termux script

This commit is contained in:
qvalentin 2023-12-09 13:25:57 +01:00
parent 6e0b9da3b3
commit c4bd62cd36
2 changed files with 19 additions and 0 deletions

View File

@ -3,3 +3,9 @@ install:
run:
FRITZ_PASSWORD=$$FRITZ_PASSWORD python main.py
termux:
pkg install python jq
echo "Don't forget to set the password in ~/.shortcuts/tasks/wifi.sh"
cp termux.sh ~/.shortcuts/tasks/wifi.sh
chmod +x ~/.shortcuts/tasks/wifi.sh

13
termux.sh Executable file
View File

@ -0,0 +1,13 @@
#!/data/data/com.termux/files/usr/bin/env bash
connection_info=$(termux-wifi-connectioninfo)
ip_address=$(echo "$connection_info" | jq -r .ip)
if [ "$ip_address" != "192.168.178.3" ]; then
termux-notification -c "Not trying to turn of wifi, as you are not at home"
exit 1 # You can choose to exit the script or add other error-handling logic
fi
cd ~/wifi-off/
export FRITZ_PASSWORD="your_password"
make run && termux-notification -c "Turned of wifi"