Can't find site id in plugin 7.34.311

Posted on
Sat Jan 23, 2021 9:00 pm
DPattee offline
Posts: 453
Joined: Jan 14, 2004
Location: Redmond, WA

Can't find site id in plugin 7.34.311

Upgraded from an older and now I'm getting NoSiteContext errors in the log:

Jan 23, 2021 at 6:49:16 PM
uniFiAP Error Connection error: >>10.0.4.2<<
{"meta":{"rc":"error","msg":"api.err.NoSiteContext"},"data":[]}
uniFiAP Error Connection error: >>10.0.4.2<<
{"meta":{"rc":"error","msg":"api.err.NoSiteContext"},"data":[]}


There used to be a place to put in the short Site ID, but it seems to not be available anymore.

I found the config for the settings panel, and it appears an entire section has been commented out:
https://github.com/kw123/unifi/blob/611 ... g.xml#L257

Posted on
Sat Jan 23, 2021 9:18 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Can't find site id in plugin 7.34.311

It should detect all parameters on its own

Please check plugin.log for more info why it does not work

Sent from my iPhone using Tapatalk

Posted on
Sat Jan 23, 2021 9:35 pm
DPattee offline
Posts: 453
Joined: Jan 14, 2004
Location: Redmond, WA

Re: Can't find site id in plugin 7.34.311

It is just the NoSiteContext error over and over. I'm not sure how it would auto-detect the site id, since there could potentially be multiple IDs on a controller?


23 19:32:50 logger enabled for THREADDEBUG ==> TEST ONLY
23 19:32:50 logger enabled for DEBUG ==> TEST ONLY
19:32:50 logger enabled for INFO ==> TEST ONLY
19:32:50 logger enabled for WARNING ==> TEST ONLY
2021-01-23 19:32:50.947 ERROR Plugin.__init__ logger enabled for ERROR ==> TEST ONLY
2021-01-23 19:32:50.947 CRITICAL Plugin.__init__ logger enabled for CRITICAL ==> TEST ONLY
19:32:51 -myLogSet setting parameters -- logFileActive= indigo; logFile= /Library/Application Support/Perceptive Automation/Indigo 7.5/Logs/com.karlwachs.uniFiAP/plugin.log; debugLevel= []
19:32:51 MAP2Vendor initializing
19:32:51 MAP2Vendor initializing finished, read from mac2Vendor.json file
19:32:51 MAP2Vendor initializing finished, read from mac2Vendor.json file
23 19:32:52 unifi-Report getting _id for AP AP_18:e8:29:4a:61:cd /stat/device/18:e8:29:4a:61:cd
23 19:32:52 getunifiOSAndPort existing os>< .. ip#>10.0.4.2< .. port>8443<
23 19:32:53 getunifiOSAndPort trying port#:>8443< gives ret code:('302', '')
23 19:32:53 getunifiOSAndPort found OS:std, port#:8443 using ip#:10.0.4.2
2021-01-23 19:32:53.758 ERROR Plugin.executeCMDOnController Connection error: >>10.0.4.2<<
{"meta":{"rc":"error","msg":"api.err.NoSiteContext"},"data":[]}
23 19:32:54 getunifiOSAndPort existing os>< .. ip#>10.0.4.2< .. port>8443<
23 19:32:54 getunifiOSAndPort trying port#:>8443< gives ret code:('302', '')
23 19:32:54 getunifiOSAndPort found OS:std, port#:8443 using ip#:10.0.4.2
2021-01-23 19:32:55.092 ERROR Plugin.executeCMDOnController Connection error: >>10.0.4.2<<
{"meta":{"rc":"error","msg":"api.err.NoSiteContext"},"data":[]}
23 19:32:55 unifi-Report getting _id for AP AP_b4:fb:e4:23:e9:15 /stat/device/b4:fb:e4:23:e9:15
23 19:32:55 getunifiOSAndPort existing os>< .. ip#>10.0.4.2< .. port>8443<
23 19:32:55 getunifiOSAndPort trying port#:>8443< gives ret code:('302', '')
23 19:32:55 getunifiOSAndPort found OS:std, port#:8443 using ip#:10.0.4.2
2021-01-23 19:32:56.398 ERROR Plugin.executeCMDOnController Connection error: >>10.0.4.2<<
{"meta":{"rc":"error","msg":"api.err.NoSiteContext"},"data":[]}
23 19:32:56 getunifiOSAndPort existing os>< .. ip#>10.0.4.2< .. port>8443<

Posted on
Sat Jan 23, 2021 9:40 pm
DPattee offline
Posts: 453
Joined: Jan 14, 2004
Location: Redmond, WA

Re: Can't find site id in plugin 7.34.311

The code at https://github.com/kw123/unifi/commit/6 ... a2fccR4337 is hardcoding 'default' now I guess? Line 4448 still uses the unifiCloudKeySiteName variable but I don't see any place where it is loading a preference since line 1036 was also commented out and the config screen had that section commented out?

Posted on
Sun Jan 24, 2021 12:14 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Can't find site id in plugin 7.34.311

it is set in line 363
self.unifiCloudKeySiteName = self.pluginPrefs.get(u"unifiCloudKeySiteName", "default")
in startup()

and in line: 4329/4337:
self.unifiCloudKeySiteName = u"default"
in getunifiOSAndPort()

(but yes, I should clean that one up and either set it fixed or get it directly from the controller with:
/proxy/network/api/s/self/sites
or
/api/self/sites)

and in the http dict info it comes back as:
{"meta":{"rc":"ok"},"data":[{"_id":"xxxxx","name":"default","desc":"your site name here ","attr_hidden_id":"default","attr_no_delete":true,"role":"admin","role_hotspot":false}]}
as "name":"default", while the site name is "desc":"your site name is here ",


Q: which controller type are you using and which software version?

and could you enabled debug: (6) curl connection to unifi devices show commands
and run again?

and I have not seen an implementation that does not have the name=default
that is NOT the "site name" you give your install - in "settings/site
It is in edit radius profile in settings of the controller - I believe (thats the only place I found "default"

Karl

Posted on
Sun Jan 24, 2021 1:03 am
DPattee offline
Posts: 453
Joined: Jan 14, 2004
Location: Redmond, WA

Re: Can't find site id in plugin 7.34.311

I’ll get the debug log tomorrow, but I can guarantee my site is isn’t “default” it is an auto-generated 8 character string. That’s standard behavior for controllers that have more than one site or in my case a migration from a gen 1 cloud key to a gen 2 one,

The controller is in the 6.0 range, I can get the specific revision tomorrow.

Note that I’m not talking radius profiles... I’m talking about the site ID which is part of the url used to access the dashboard / api calls and isn’t configurable.

Ie in a url like be,ow the abcd1234 is the site ID which can be either the word “default” or whatever.

https://1.1.1.1:8443/manage/site/ABCD12 ... s/advanced

Posted on
Sun Jan 24, 2021 1:06 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Can't find site id in plugin 7.34.311

Ok then you are I guess the first I know of where the site is not default.

I can automate getting the id.

Karl


Sent from my iPhone using Tapatalk

Posted on
Sun Jan 24, 2021 2:21 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Can't find site id in plugin 7.34.311

ok
i have added the get site id name dynamically

please try: v .314

you should see something like:
Code: Select all
02:13:52 MAP2Vendor initializing  finished, read from mac2Vendor.json file
24 02:13:55 unifi-Report getting _id for AP AP_3_study  /stat/device/f0:9f:c2:d6:df:2f
24 02:13:55 getunifiOSAndPort existing  os>< .. ip#>192.168.1.2< .. port>443<
24 02:13:55 getunifiOSAndPort trying port#:>8443< gives ret code:('000', '')
24 02:13:55 getunifiOSAndPort wrong ret code from curl test:('000', ''), expecting 200 or 302, try again
24 02:13:55 getunifiOSAndPort trying port#:>443< gives ret code:('200', '')
24 02:13:55 getunifiOSAndPort found  OS:unifi_os, port#:443 using ip#:192.168.1.2, unifiCloudKeySiteName:<
02:13:56 UNIFI executeCMDOnController setting site id name to >>default<<

in your plugin.log

karl
[EDIT]
ps. this will only use the FIRST site id name in your controller. If you have multiple this will not work.

Posted on
Sun Jan 24, 2021 6:47 pm
DPattee offline
Posts: 453
Joined: Jan 14, 2004
Location: Redmond, WA

Re: Can't find site id in plugin 7.34.311

I don’t manage multiple sites here anymore so the first in the list is good enough lol

I do see the line in the log where it found the siteid, the errors stopped, and some of the infrastructure items have last updated times of “now” so it appears to be working, thanks!

(There was one error right after upgrading before it did the site id check for a tulle out of range line 4432 but it only went by one time )

Posted on
Sun Jan 24, 2021 7:20 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Can't find site id in plugin 7.34.311

the error is a format statement, will repair itself at next loop, but will reoccur every time you start the plugin

will fix in next release..

I need to think about 2+ sites, how to do that, as I don't have that one setup.

currently the plugin gets the devices from the AP, switches and Gateway -- not from the controller.
Hence it will only see the local devices...

interesting

Karl

Posted on
Mon Jan 25, 2021 4:35 pm
DPattee offline
Posts: 453
Joined: Jan 14, 2004
Location: Redmond, WA

Re: Can't find site id in plugin 7.34.311

Thinking about that and maybe it doesn't matter... The additional sites are for when someone is remotely managing a different / remote facility. Only someone who was running a home lab for tinkering would end up with multiple site IDs for equipment under the same roof (as far as I can imagine)

I'm not sure how you'd programmatically determine which one is the "right" site without letting people just pick / enter the ID, but I doubt they'd need to support multiple sites at one time or support querying gateways/aps at the remote site - since Indigo is generally a home automation system and not a multi-site industrial control system lmao

Posted on
Mon Jan 25, 2021 4:48 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Can't find site id in plugin 7.34.311

posted v .315

will now:
1. get site list, pick first available
2. in config you can selecting of the sites, or do a reset to force a re-read of the site ID's
3. it will also re-read the site IDs if anything goes wrong eg login ...

hope that settles it

Karl

Posted on
Thu Apr 01, 2021 4:59 am
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: Can't find site id in plugin 7.34.311

Not sure if this is really an issue but my site-id selection doesnt stick when I select it on configuration window. Tested this on 7.38.356.

My site id ("od****fu") is second on the list and I selected it couple of times but configure window defaults it back to "default" every times and following errors appear on log

Code: Select all
01 13:55:48 setunifiCloudKeySiteNamer setting site id name to >>default<<, list of Names found:[u'default', u'od****fu']<


Code: Select all
2021-04-01 13:55:56.720   ERROR          Plugin.executeCMDOnController    error:>> url:https://***.***.***.33:443/proxy/network/api/s/default/stat/device/************, resp:{"meta":{"rc":"error","mac":"************","msg":"api.err.UnknownDevice"},"data":[]}

Posted on
Thu Apr 01, 2021 7:16 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Can't find site id in plugin 7.34.311

yes it always picks default. that is a bug.
I guess you are the only one with site name not = default.

I have a version that should work, but I can not test it.
will post one one GitHub for you to test later today

Karl

Posted on
Thu Apr 01, 2021 7:25 am
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: Can't find site id in plugin 7.34.311

kw123 wrote:
yes it always picks default. that is a bug.
I guess you are the only one with site name not = default.

I have a version that should work, but I can not test it.
will post one one GitHub for you to test later today

Karl
I cant remember that I’ve changed it to that value - real site name which is visible in UI isnt that.

So I didnt broke it on purpose, sorry

Thanks again!

Who is online

Users browsing this forum: No registered users and 11 guests

cron