stevejenkins / unifi-linux-utils

Helpful Linux / Unix scripts for admins of Ubiquiti (UBNT) UniFi wireless products
https://www.stevejenkins.com/blog/tag/unifi/
MIT License
700 stars 127 forks source link

Turn Off LED script #24

Open ricktendo opened 6 years ago

ricktendo commented 6 years ago

Is there a way to use the API to turn off the LED on a UAP, if so could you create a script for this?

The UAP in my room is really bright at night and I would like a script that could disable this at nights.

stevejenkins commented 5 years ago

That's a great idea! Let me see what I can figure out...

ricktendo commented 5 years ago

Thanks!

stevejenkins commented 5 years ago

Ooh.... I think I'm on to something. SSH into your AP and do this:

echo '0' >/proc/gpio/led_pattern

Does it turn your LED off?

If so, turn it on again with:

echo '1' >/proc/gpio/led_pattern

I think the best option will be two micro-scripts that can be run via cron which set the desired LED function at the desired times. You could schedule multiple on and off events that way.

ricktendo commented 5 years ago

It worked perfect!

Any chance to make the controller aware of the change in setting of the LED?

stevejenkins commented 5 years ago

Yeah... that might be a bit trickier. But I'm doing some research and will post what I find.

There's a two year old feature requests in the UBNT forum for the ability to schedule the LED lights. Maybe I'll nudge some friends at UBNT to see if someone can cobble that together.

ricktendo commented 5 years ago

LOL yea, I was probably the last to reply in that feature request. They have the new UniFi LED, these have a timer feature

https://unifi-led.ubnt.com/

Thanks for this!

mbierman commented 3 years ago

Seems like mother crontab on my APs get wiped out periodically. Is there a way to make them persistent?