w1tw0lf / Unifi-Device-info

Unifi AP Device info via API for home assistant
17 stars 3 forks source link

satisfaction per signal allways -1 #8

Open DAVIZINH0 opened 6 days ago

DAVIZINH0 commented 6 days ago

Hello I configure this integration and works fine! i use home assistant os and the addon unifi. It works great with all parameters but the "satisfaction" dont report the correct information

The general satisfaction is ok. report data like 98%

But the 2.4ghz and the 5ghz report -1

i have 4 aps. and all of this report -1 i think maybe something is wrong

can i make some changes or something to find the problem?

w1tw0lf commented 6 days ago

Hi

Working perfectly on my side. Will compare files on my side once in front of a pc and update if needs be.

DAVIZINH0 commented 6 days ago

I make some changes, because my APS are the u7pro with wifi6ghz. Its easy the changes but it will be interesesting to say. Tomorrow i will put here

w1tw0lf commented 5 days ago

Unfortunetly I don't have a u7 device yet.

If you share what you have done to get it to work, will see if I can add it to the code.

DAVIZINH0 commented 5 days ago

Unfortunetly I don't have a u7 device yet.

If you share what you have done to get it to work, will see if I can add it to the code.

The modification are easy, because the wifi6ghz are the wifi2

in the py script, adding this:

wifi2clients = devs['radio_table_stats'][2]['user-num_sta']
wifi2score = devs['radio_table_stats'][2]['satisfaction']

and modify the final with this new 2 informations:

final = json.dumps({"Clients":numclients,"Guests":numguests,"Clients_wifi0":wifi0clients ,"Clients_wifi1":wifi1clients ,"Clients_wifi2":wifi2clients ,"Score":score,"CPU":str(cpu),"RAM":str(ram),"Uptime":uptime,"Score_wifi0":wifi0score ,"Score_wifi1":wifi1score ,"Score_wifi2":wifi2score ,\
                "Activity":str(activity)+' Mbps',"Update":update})

in the configuration.yaml add the new 2 atributes

     json_attributes:
         - Clients_wifi2
         - Score_wifi2

and in the sensor section add this 2 new sensors:

      unifi_ap_6ghz_wifi_devices:
          value_template: >
              {{ states.sensor.unifi_ap.attributes.Clients_wifi2 }}
          friendly_name_template: Unifi AP 6gHz Clients

      unifi_ap_6_score:
          value_template: >
              {% if is_state_attr('sensor.unifi_ap', 'Score_wifi2' , -1) %}
                N/A
              {% else %}
                {{ states.sensor.unifi_ap.attributes.Score_wifi2 }}.
              {% endif %}
          friendly_name_template: Unifi AP 6gHz SCORE

the score allways report -1 but not only wifi6. the 3 wifi (2.4ghz, 5ghz, and 6ghz, report -1 value :-(