-
-
Save UBNT-cmb/7bbb329db577ee84067de3d42ff9f438 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
username=username | |
password=password | |
baseurl=https://localhost:8443 | |
site=default | |
cookie=/tmp/unifi_cookie | |
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': true }" $baseurl/api/s/$site/set/setting/mgmt |
#!/bin/sh
username=username
password=password
baseurl=https://ip:8443
site=default
device=$2
cookie=/tmp/unifi_cookie
state=$1
if [ $# == "0" ]; then
echo "site configuration:"
echo "USAGE: $0 true|false"
echo "or device configuration:"
echo "USAGE: $0 on|off|default deviceId"
exit 1
fi
curl_cmd="curl --tlsv1 --silent --cookie ${cookie} --cookie-jar ${cookie} --insecure "
${curl_cmd} --data "{\"username\":\"$username\", \"password\":\"$password\"}" $baseurl/api/login
if [ "$#" -eq "2" ]; then
${curl_cmd} -X PUT --data "{\"led_override\":\"$state\"}" $baseurl/api/s/$site/rest/device/$device
elif [ "$#" -eq "1" ]; then
${curl_cmd} --data "{\"led_enabled\":\"$state\"}" $baseurl/api/s/default/set/setting/mgmt/
fi
#!/bin/sh
username=username
password=password
baseurl=https://ip:8443
site=default
device=$2
cookie=/tmp/unifi_cookie
state=$1if [ $# == "0" ]; then
echo "site configuration:"
echo "USAGE: $0 true|false"
echo "or device configuration:"
echo "USAGE: $0 on|off|default deviceId"
exit 1
ficurl_cmd="curl --tlsv1 --silent --cookie ${cookie} --cookie-jar ${cookie} --insecure "
${curl_cmd} --data "{"username":"$username", "password":"$password"}" $baseurl/api/loginif [ "$#" -eq "2" ]; then
${curl_cmd} -X PUT --data "{"led_override":"$state"}" $baseurl/api/s/$site/rest/device/$device
elif [ "$#" -eq "1" ]; then
${curl_cmd} --data "{"led_enabled":"$state"}" $baseurl/api/s/default/set/setting/mgmt/
fi
Hi @JacekDob,
I tried to run this script but nothing changes. Does it still work?
For me it works, but I'm using 6.0.36 version.
I tried also 6.1.71 and it is still working.
Great!
This stopped working with a recent UniFi update. Any idea why?