UniFi Security Gateway

I believe the cpu needs to be lower-case as its case sensitive:

value_template: "{{ states.sensor.unifi_gateway_wan.attributes['gw_system-stats']['cpu'] 

However, that stat is cpu usage, not temperature.

“cpu” lowercase = usage
“CPU” uppercase = temperature

Like I said before… When I setup with uppercase CPU, the value stays empty of the new sensor.

Got a bit further in this:

value_template: "{{ states.sensor.unifi_gateway_wan.attributes['gw_system-stats']['temps']['CPU'] }}"

That gives me the correct temperature! Now I need to figure out how to remove the " C" (with the space)

Does anyone have an idea what to do? I’m not a JSON expert :frowning:

Took me a while to get there but got it fully working now.

here is the code:

  - platform: template
    sensors:
      unifi_gateway_wan_cpu:
        friendly_name: 'CPU percentage'
        value_template: "{{ states.sensor.unifi_gateway_wan.attributes['gw_system-stats']['cpu'] }}"
        unit_of_measurement: percentage
      unifi_gateway_wan_mem:
        friendly_name: 'Memory percentage'
        value_template: "{{ states.sensor.unifi_gateway_wan.attributes['gw_system-stats']['mem'] }}"
        unit_of_measurement: percentage
      unifi_gateway_wan_cpu_temp:
        friendly_name: 'CPU temperature'
        value_template: "{{ states.sensor.unifi_gateway_wan.attributes['gw_system-stats']['temps']['CPU']|replace('C', '') }}"
        unit_of_measurement: degrees
      unifi_gateway_wan_ip:
        friendly_name: 'WAN IP'
        value_template: '{{ states.sensor.unifi_gateway_wan.attributes.wan_ip }}'
4 Likes

Thanks just what I was looking for.

Hi there. Is it suppose to work in 0.95? Just get updated and get Platform not found during configuration check.

I have the same issue on 0.95.

I have the same issue with 0.95. :frowning:

We ever get a fix? I thought it was me :slight_smile:

I had to disable the sensor this morning until it gets corrected…
I have been watching your PR and I noticed that there has been no attention from the Dev. @jchasey , Maybe he’s AFK enjoying his summer, I am not in that much of a hurry… :slight_smile:

1 Like

Unfortunately not had the time to look into the issue in detail, other than to confirm that I am experiencing the same problem.
I’ve had a brief look at new replacement library for pyunifi that was integrated in the most recent update and it appears that this should be able to be used as a replacement for this component too.

1 Like

@jchasey thanks for the update. No worries get to it when you can… We all have lives AFK…

I’ve had an initial look at the issue, unfortunately when in the development environment (0.96) it all works fine, but I can reproduce the issue on 0.95.4 on my RPi running Hassio. It just makes for slower debugging!
Those who are having the issue are you running Hassio ?

I’m running 0.95.4 on hassio on an Ubuntu vm and I have the issue.

I’m running hassio 0.95.4 on an Debian 9.9 vm and I have the issue. The issue started for me at hassio 0.95.0.

I am running hassio 0.95.4 on the Intel NUC build - HassOS 2.12 production build… Also, not sure if it matters, but I am also running the USG Pro4, which in iteself, I found a couple of minor issues when the component was running…

I’m running HASSIO 0.95.4 and this doesn’t work for me.

The common factor appears to be HASSIO which suggests that a change to setup/dependency installation process is at fault.
Anyone NOT running HASSIO that is experiencing the same issue?

I think the common factor is 0.95.x

For me the problems started with the upgrade to 0.95.0

For me it was the upgrade to 0.95 as well.

1 Like