UniFi Security Gateway

Have you tried without the verify_ssl: false line ?

I dont recall doing anything special with certs etc, and mine works fine with this config:

  - platform: unifigateway
    host: 192.168.1.75
    username: !secret unifi_homeassistant
    password: !secret unifi_password
    monitored_conditions:
      - www
      - wan
      - lan
      - wlan

Hello! Did anyone solve the issue with CPU Temp? I get the following errors:

  • Could not render template CPU, the state is unknown
  • Could not render template Memory percentage, the state is unknown
  • Could not render template CPU temperature, the state is unknown
  • Could not render template WAN Download, the state is unknown
    I would really need to have CPU Temp in order to trigger a fan inside my rack.
    Is there any other way to have the Temperature of the USG/Cloud Key or Switch on Home Assistant?
    Thanks!

Cool component. Guess I’ll need to add this as well.
BTW does firmware only list device firmware or also controller updates?

Can somebody give an example how the alerts attributes will look when multiple alerts are present and how to access them (or even loop over them if it is some kind of array)? Thanks!


Here is an example card with a number of alerts - just select the line and a popup will list the alerts.
They could be presented in a more elegant manner with a custom card.

1 Like

Thanks a lot, I figured it out in the mean time. I was struggling as the index of the alerts was a string and not an integer as you would expect.

- type: custom:hui-markdown-card
  content: >
	{% set totalAlerts = states('sensor.unifi_gateway_alerts') | int %}
	{% if totalAlerts > 0 %}
	<span><font color="red"><ha-icon class="left-temp-icon" icon="mdi:alert"></ha-icon> Alerts</font></span><br/>
	{% for i in range(totalAlerts) %}
	{% set jsonBody = state_attr('sensor.unifi_gateway_alerts', (i+1)|string) %}
	{{ jsonBody['datetime'] }}: {{jsonBody['msg']}}
	{% endfor %}
	{% endif %}
1 Like

Hello,

Anyone tried this integration with UDMP ? If yes - and working great - could you please share your configs ?

Appreciate.

Hello,

For some reason that i’m not able to find i’m not able to using the custom component. I don’t have any error but i don’t have the sensors to.

I’m running hassio, with unifi integration and running unifi controller as hassio addon. The component was installed with Hacks.

How can i debug connections issues or other issues? Check config don’t report any errors and logs don’t show any unifigateway error.

Hi folks, great thread. Just about to give this a go with a USG4Pro and the controller running on HASSIO on Ubuntu… Should work by the looks…

My question, I use an openVPN (Nord) via the CLI mapped to vtun0.
Is there a way I could check the status of the tunnel using this great component?
via the CLI I’m able to check the status of the tunnel by entering:

show interfaces

it returns a summary of the LAN interfaces, with the status (S) and link (L), per the below:

admin@SomePlace:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address                        S/L  Description
---------    ----------                        ---  -----------
vtun0        10.X.Y.12/24                      u/u  OpenVPN VPN tunnel

Thanks again folks!

Hi again,
Got the sensors up and running per the thread above - thanks to all for the contribution.
I was curious (further to my tunnel question above), is there a way to have my second WAN interface also added to the sensors (along with the vtun0 above)?

Cheers,

Having thought a just a little bit about this, I’d say monitoring tunnel interfaces aren’t possible. As we’re logging into the controller…
:grimacing:

If you check out the following site, it shows the extent of the API that the integration uses to grab data and in theory anything on this site could be added as part of your own custom integration:

https://api-browser-demo.artofwifi.net/?action=list_devices#

1 Like

Oh okay. Thanks! I’ll check it out.
Have never created my own integration before! Bit exciting… :slight_smile:

Hello! I have the same problem, did you resolve this?

I have this all set up and working successfully. It’s fantastic thanks!

Stupid question of the day:

Where do I add something like -platform? like shown above.
I’d love to be able to pull these into my dashboard but have no idea where this bit of code needs to live!

Many thanks in advance!

i.e.:

  - platform: template
    sensors:
      unifi_gateway_www_xput_down:
        friendly_name: 'USG Speedtest Download'
        unit_of_measurement: Mbps
        value_template: "{{ states.sensor.unifi_gateway_www.attributes.xput_down }}"
        icon_template: mdi:speedometer

  - platform: template
    sensors:
      unifi_gateway_www_xput_up:
        friendly_name: 'USG Speedtest Upload'
        unit_of_measurement: Mbps
        value_template: "{{ states.sensor.unifi_gateway_www.attributes.xput_up }}"
        icon_template: mdi:speedometer

This belongs below the section sensor: inside configuration.yaml (or sensor.yaml or in a package, depending on how you set up your system.

sensor:
  - platform: template
    sensors:
      unifi_gateway_www_xput_down:
        friendly_name: 'USG Speedtest Download'
        unit_of_measurement: Mbps
        value_template: "{{ states.sensor.unifi_gateway_www.attributes.xput_down }}"
        icon_template: mdi:speedometer

  - platform: template
    sensors:
      unifi_gateway_www_xput_up:
        friendly_name: 'USG Speedtest Upload'
        unit_of_measurement: Mbps
        value_template: "{{ states.sensor.unifi_gateway_www.attributes.xput_up }}"
        icon_template: mdi:speedometer

@jchasey hey man, has there been any movement on any of the PR’s for this?
I upgraded my Cloud Key Gen2 Plus to UnifiOS over the weekend and all my sensors tanked. They added a proxy to the Cloud Key to move both network manager and protect to port 443 and changed the API path a bit. So with out changes this Integration will be much less useful as it sits in the very near future…

But it was awesome while it lasted…

Do you have details of the new path etc…happy to incorporate any changes to keep things current

@jchasey I think this is the new path for the UDM/Pro : https://x.x.x.x:443/proxy/network/api/s/

Has been discussed here for some time if that helps? : https://github.com/custom-components/sensor.unifigateway/issues/17

I hope it is this simple with the new UnifiOS on these devices - the latest pyunifi supports this apparently.

The challenge is I don’t have a pro to test any changes on. I can look to make some changes blind and you can try out the code to see if they work?

Hi John, Happy to test whenever you are ready. Most people with a UDM would be forthcoming I am sure. Thanks for looking into this