Unifi sensor custom component

Great news …thanks a lot mate

In case you weren’t factoring it in to your rewrite, I just spotted this in my logs and wanted to let you know…
No ‘version’ key in the manifest file for custom integration ‘my_unifi’. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'my_unifi’
First part of the Breaking Changes for 2021.3 :+1:

Is this component still under development?

Hey,

I have some good news. There’s a new version of my unifi sensor at: https://github.com/clyra/unifics. It has support to hacs but not there yet (you can add it as a custom repository in hacs). It’s async and uses the unifcontrol library. I’m using the udm-support branch of the unificontrol library, so it “should” work with UDM, but need testing. It has support to be configured by the UI. You can still use the yaml, but be aware that I changed a few configuration options (“url” is now “host”, so dont include the “http[s]” part).

4 Likes

Hey. I missed one place where the component should be “async” and it broke on HA 2021.4.0. Just fixed (or hope so…) that. New version on git repo.

1 Like

Hi, wondering if you could throw some light on this? Getting the following error:

2021-04-09 11:10:34 ERROR (SyncWorker_4) [custom_components.unifics.api_wrapper] unificontrol error: Expecting value: line 2 column 1 (char 1)

Using a CloudKey Gen2 running network v6.0.45, HA 2021.4.1 and the following configuration:

  - platform: unifics
    name: Unifi Sensor
    host: 192.168.0.42
    port: 443
    username: !secret unifi_user
    password: !secret unifi_password
#    site: <your "site" on controller> (optional, default: 'default')
#    verify_ssl: <True/False> (optional, default: 'False')
#    udm: <True/False> (optional, if you have a Unifi Dream Machine use True as the API is different)

I know I can get through to Unifi with the credentials and port number as I have these configured for the unifigateway integration (which I’ve disabled currently to have a go at this exciting looking one!).

Thanks in advance

@woodmj74 udm needs to be true :+1:

Awesome @ZuluWhiskey!

That’s done it :slight_smile: (wrongly assumed the CloudKey didn’t need the UDM setting!)

It’s because the CloudKey now runs UniFiOS that was originally on the UDM but has been rolled out onto the CloudKeys now :slight_smile:

1 Like

hey guys,

I’m about to make a few changes to the sensor, like add the wired devices counter back. Is there something else you would like to add?

Is there currently a “Number of WiFi clients” sensor? Because I’ve looked through what I have available and I don’t see this?

did you tried my sensor? this is what it does.

Apologies, I thought this was for the official UniFi integration. I have not used your custom component.

…any plans to add these sensors to the official UniFi integration?

No problem @Alec . Well, I dont have any plans to add the sensor to the official Unifi integration, but who knows… I do have plans to make it into HACS so it should be easier to install and upgrade.

Hi there!

This custom_component broke with the latest update due the lack of Manifest file

Are you planning on updating it? Many of my automation depend on the amount of Wifi devices and I would need to know If i need to find a replacement!

Have you tried the new component mentioned above? As far as I can see it does everything that the old integration did :+1:

Oh snap, I didn’t saw it!
Sorry!

Although, it seems to be counting my devices in double?

Maybe cause it also pulls the Switches?
As you can see, it doubled after the update of the component:

Hi,
That’s new… The new component is a bit different from the old one as it get the number of the devices from the AP instead of listing every device and count them. I can fix it, but will need some logs from you. Please open a issue on github.

1 Like

I installed your sensor and my count is really inaccurate (I have 200 devices) and it sees 0. I have the following error in the logs:
This error originated from a custom integration.

Logger: custom_components.unifics.sensor
Source: custom_components/unifics/sensor.py:241 
Integration: Unifi Counter Sensor 
First occurred: 10:45:42 AM (30 occurrences) 
Last logged: 10:53:06 AM

Error while trying to update sensor: can only concatenate str (not "NoneType") to str
ap_name: AP Barn Outside AP, client_essid: iOT
ap_name: AP Barn Outside AP, client_essid: Sibenik

I keep getting this message:

2023-08-06 20:49:00.230 ERROR (MainThread) [custom_components.unifics.sensor] Unexpected error fetching sensor data: Expecting value: line 1 column 1 (char 0)

And I have the sensors with the red exclamation mark as unavailable…

Any ideas?

Fresh install