Monitoring your Unifi AP

I came up with this as an alternative if anyone is interested.

which one is the latest version?

or

GitHub - RubenDijk/homeassistant: Homeassistant stuff (this one is the linked on the top)

Iā€™d love to get it working but I am stuck somewhere. Could you help me?
Currently I run 8 AP on a controller which is installed on a pi (Version 6.5.55), without a self-signed certificate (browser states that the certificate is not trustworthy) . My last try for the first AP was:

host = ā€˜Controller-IPā€™
username = ā€˜Unifi-Userā€™
password = ā€˜Unifi-PWā€™
version = ā€˜v6ā€™
site_id = ā€˜defaultā€™
port = ā€˜8443ā€™
verify_ssl = False
target_mac = ā€˜Unifi-Macā€™ ## the mac address of your AP device

client = Controller(host, username, password, port, version,
site_id=site_id, ssl_verify=verify_ssl)

All I get is this error:

[homeassistant.components.command_line] Command failed: python3 /config/scripts/unifi_ap1.py

I also tried version v5; version unifiOS; and verify_ssl = True

Which device you running on ? Are you running a stand alone controller ? Think the port might be wrong.

I run the controller on a raspi 4, 8443 is the port I access the controller with my browser

Update: I tried Port 443 in combination with Version v5 and unifiOS as well as in combination with ssl = True and ssl= false.

no success so far.

Did you add the custom component: GitHub - custom-components/sensor.unifigateway: High level health status of UniFi Security Gateway devices via UniFi Controller ?

It needs some part of the component in order to work correctly.

Yes, this component is up and running. Iā€™ll try more possibilities later on but for now Iā€™ll let it be.

Thanks a lot @w1tw0lf for this project.
Itā€™s exactly what I needed.
Iā€™ve met some issues like some other people here.
Pay attention to setup the correct AP version !
Only 1 pending ā€œissueā€ on my side.
I donā€™t have any icon shown. I keep eye icon in the card and on the entity as well.
Any hint on that ?
Thanks

Mind sharing a screenshot of the card ?

Here it is :
2022-02-08 08_40_07-Home ā€“ Home Assistant

For the icon, you need to customize the entity, sensor.****_ap with an entity picture. You can place the file as a *.png under /config/www

I uploaded the 5 that i have to the git page

I canā€™t because my sensor unifi_ap has no unique_ID
2022-02-08 09_26_14-Configuration ā€“ Home Assistant

Do you have any idea from where this comes from ?
Did I miss setup something ?

Donā€™t worry about, that is normal.

in your configuration.yaml add the following:

customize:
  sensor.unifi_ap:
    entity_picture: /local/u6.png

Just replace u6.png with the one you want to use. Make sure the png is located in /config/www. Restart home assistant and it will display correctly.

Thanks for your prompt replies.
Unfortunately, I donā€™t find where exactly I need to insert this in my configuration.yaml.
under line below ?

sensor:
  - platform: command_line

2022-02-08 10_12_40-Home Assistant

put it right at the end of the file.

customize should be at the beginning of a new line, in other words no spaces before.

sensor:
  - platform: command_line

customize:
  sensor.unifi_ap:
    entity_picture: /local/u6.png

PS: Sorry corrected my code snippet, had some spacing errors.

Thanks @w1tw0lf !
I had to put the customize part under homeassisant as below :

homeassistant:
    customize:
        sensor.unifi_ap:
            entity_picture: /local/images/UnifiAP.png

It works perfectly like this !

Beware - if you have a unifi controller with multiple sites (or youā€™re not using the ā€œdefaultā€ site), be sure to set your python script to use the Site ID and NOT the actual name of the site as it appears in the sites list. Instead, it is a ā€œsite IDā€ which is a random string of 8 characters that can be found in the URL of the web browser when logged into the Unifi controller.

For example, my site name might be ā€œHomeSite1ā€, but the site that I had to define in the python script was actually the random string that I got from the web browser. I discovered this by viewing the unifi controller logs, and logs showed that the unifi controller wasnā€™t liking the site Id.

For example, when I manage my ā€œHomeSite1ā€ unifi controller, the URL in the web browser looks like this:

unifi. ui. com/ 7.0.22.0/ unifi/site/xtm8ytp4

#### fill in your unifi controller credentials ####

host = '192.168.1.XXX'
username = 'User'
password = 'Password'
site = 'xtm8ytp4' #Site ID, not actual site name e.g. HomeSite1. Site ID found in web browser while managing unifi controller.
port = '8443'
mac = 11:22:33:44:55:66' ## the mac address of your AP device
1 Like

Iā€™d love to monitor my Dream Machine in HA. I am running HA OS in Hyper-V. Can I run the python module and script in HA OS?

Sorry for late reply. Havenā€™t work with the dream machine yet, but donā€™t see why it wouldnā€™t work with it.

Is there an easy way to find out the correct version? Iā€™ve tested nearly everything without successā€¦