diff --git a/Makefile b/Makefile index bc0773f..0f5f390 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/termux.sh b/termux.sh new file mode 100755 index 0000000..2c1550f --- /dev/null +++ b/termux.sh @@ -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"