Add termux script
This commit is contained in:
parent
6e0b9da3b3
commit
c4bd62cd36
6
Makefile
6
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
|
||||
|
|
|
@ -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"
|
Loading…
Reference in New Issue