Created
January 1, 2022 18:59
-
-
Save Code-Tap/2bc54d8d84512c4b6532150e786c7f74 to your computer and use it in GitHub Desktop.
bash script to toggle Unifi AP led
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
username=user #Replace with your admin user | |
password=pass #Replace with your admin pass | |
baseurl=https://localhost:8443 #Replace localhost with the ip or hostname of your unifi controller | |
site=default | |
cookie=/tmp/unifi_cookie | |
if [ $1 = true ] || [ $1 = false ]; then | |
curl_cmd="curl --tlsv1 --silent --cookie ${cookie} --cookie-jar ${cookie} --insecure " | |
${curl_cmd} --data "{'username':'$username', 'password':'$password'}" $baseurl/api/login | |
${curl_cmd} --data "{ 'led_enabled': $1 }" $baseurl/api/s/$site/set/setting/mgmt | |
else | |
echo "Invalid state: $1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment