Control Unifi AP LED Lights

Hello all!

Can we add to the unifi Direct or unifi led integrations the ability to control the led in the unifi APs. (controls brightness, color, on off etc). This has been accomplished in homebridge here.

Any chance we could repurpose the pseudo code of the homebridge integration to improve our home assistant integration?

Today I just use homebridge and the homekit integration to get this into homebridge, but it would be better to have the direct integration.

Thoughts?

I agree that LED control is needed, but I feel like switch entities in the UniFi Network integration would be a better place to put it (at least for the way I want to use it, I guess).

I was proposing they be lights so we could control brightness, color etc.

I would like to have the possibility to control device LEDs (APs and switches) too.
I think it should be part of the unify network plugin, because this should have all needed posibilities with it’s API access.

1 Like

Any update on getting this in to the UniFi Networking Integration?

Would love to see this feature introduced.

I’m surprised this isn’t already available as an option. I’d like to use it for visible confirmation in some automations.

voted.

How do you set it up with homekit?

Check out the homebridge link above.

Doesn’t say how to use it, do I need an Apple device for it?

Setup a homebridge instance and install and configure the plugin.

Your home assistant should discover home assistant as a homekit hub and you can connect them.

No apple device needed.

Is there anyway to add home bridge to home assistant, or I’d need it running on a computer?

the link above details how to install homebridge.

you can run it on the same machine as home assistant depending on how you setup home assistant.

I recommend you reach out to the homebridge community if you have more questions about how to set it up:

Ideally this functionality would be added to home assistant so we don’t need to setup homebridge at all!

Agreed!

I found this add on hassio-addons/homebridge at main · davide125/hassio-addons · GitHub

Wow very easy setup
I used the plugin called
UniFi Access Point Light

So using some of the info on this post and other places I am able to control the Unifi E7 AP RGB LEDs:

From the ‘Advanced SSH & Web Terminal’ Add-On (Protection mode: Off) I ran:
docker exec -it homeassistant bash
ssh-keygen -t rsa -b 2048
set identity location to /config/.ssh_unifi/id_rsa ( or anywhere in the /config dir, just need to call it out in the ssh command with -i)
In the Unifi Controller under ‘controller/settings/system/advanced/ssh keys’ add add contents of the /.ssh_unifi/id_rsa.pub file.

In my configuration.yaml I have:
shell_command: !include shell_command.yaml

In the shell_command.yaml I added this: (had to full restart HA to get them to show up)

# AP-MASTER LED Colors
  ap_master_led_red: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 255,0,0 > /proc/ubnt_ledbar/color'
  ap_master_led_green: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 0,255,0 > /proc/ubnt_ledbar/color'
  ap_master_led_blue: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 0,0,255 > /proc/ubnt_ledbar/color'
  ap_master_led_white: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 255,255,255 > /proc/ubnt_ledbar/color'
  ap_master_led_off: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 0,0,0 > /proc/ubnt_ledbar/color'
# AP-MASTER LED Brightness
  ap_master_led_bright_100: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 255 > /proc/ubnt_ledbar/brightness'
  ap_master_led_bright_75: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 192 > /proc/ubnt_ledbar/brightness'
  ap_master_led_bright_50: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 128 > /proc/ubnt_ledbar/brightness'
  ap_master_led_bright_25: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 64 > /proc/ubnt_ledbar/brightness'
  ap_master_led_bright_1: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 3 > /proc/ubnt_ledbar/brightness'
# AP-MASTER LED Breath
  ap_master_led_breath_on: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 1 > /proc/ubnt_ledbar/breath'
  ap_master_led_breath_off: ssh -i /config/.ssh_unifi/id_rsa -o 'StrictHostKeyChecking=no' admin@ap-master 'echo -n 0 > /proc/ubnt_ledbar/breath'

Can create a command for any of the 16777216 colors just specifying the RGB color codes in the 255,0,0 part of the commands.

Hopefully this can be added to the HA integration or via the API