FlyingDiver / Indigo-miniUniFi

Minimalistic UniFi plugin for Indigo
MIT License
0 stars 0 forks source link

0.0.13 crash #20

Closed Koreysherwin closed 3 years ago

Koreysherwin commented 3 years ago

Oct 28, 2020 at 5:55:31 PM Reloading plugin "miniUniFi 0.0.13" Stopping plugin "miniUniFi 0.0.13" (pid 345) Stopped plugin "miniUniFi 0.0.13" Starting plugin "miniUniFi 0.0.13" (pid 839) Started plugin "miniUniFi 0.0.13" miniUniFi Starting miniUniFi miniUniFi Debug updateFrequency = 60.0 miniUniFi Barbie iPhone: Starting Device miniUniFi Korey iPhone: Starting Device miniUniFi Korey MBP 2016: Starting Device miniUniFi Sky Camera: Starting Device miniUniFi UDMP: Starting Device miniUniFi Debug Starting runConcurrentThread miniUniFi Debug UDMP: Updating controller miniUniFi Debug UDMP: Unifi OS controller detected miniUniFi Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 101, in runConcurrentThread File "plugin.py", line 271, in updateUniFiController File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/models.py", line 816, in json File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/init.py", line 307, in loads File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/decoder.py", line 335, in decode File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/decoder.py", line 353, in raw_decode ValueError: No JSON object could be decoded

miniUniFi Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

FlyingDiver commented 3 years ago

Turn on detailed debugging. I need the line with "UniFi Controller Status Response: ". Clearly the UDMP isn't returning the same data as the standard controller. This is a new query to get the controller SW version.

Koreysherwin commented 3 years ago

Reloading plugin "miniUniFi 0.0.13" Stopping plugin "miniUniFi 0.0.13" (pid 839) miniUniFi Barbie iPhone: Stopping Device miniUniFi Korey iPhone: Stopping Device miniUniFi Korey MBP 2016: Stopping Device miniUniFi Sky Camera: Stopping Device miniUniFi UDMP: Stopping Device miniUniFi Shutting down miniUniFi Stopped plugin "miniUniFi 0.0.13" Starting plugin "miniUniFi 0.0.13" (pid 2153) Started plugin "miniUniFi 0.0.13" miniUniFi Starting miniUniFi miniUniFi Debug updateFrequency = 60.0 miniUniFi Barbie iPhone: Starting Device miniUniFi Korey iPhone: Starting Device miniUniFi Korey MBP 2016: Starting Device miniUniFi Sky Camera: Starting Device miniUniFi UDMP: Starting Device miniUniFi Debug Starting runConcurrentThread miniUniFi Debug UDMP: Updating controller miniUniFi Debug UDMP: Unifi OS controller detected miniUniFi Threaddebug UniFi Controller Login Response: { "unique_id": "ceb243e1-d6bb-4b4d-b391-f40f9eaa0117", "username": "test", "first_name": "Test", "last_name": "Er", "full_name": "Test Er", "email": "", "email_status": "UNVERIFIED", "phone": "", "avatar_relative_path": "", "status": "ACTIVE", "sso_account": "", "sso_uuid": "", "sso_username": "", "sso_picture": "", "create_time": 1603648968, "local_account_exist": true, "uid_sso_id": "", "uid_sso_account": "", "password_revision": 1603648968, "extras": {}, "groups": [ { "unique_id": "0df662cd-c9b2-4ea8-a21b-7c58aecfa265", "name": "616 UDM-Pro", "up_id": "", "up_ids": [], "system_name": "616 UDM-Pro", "create_time": "2020-09-03T13:36:40-07:00" } ], "roles": [ { "unique_id": "30235a69-a024-4aff-a6bd-493b1f765e4d", "name": "Super Administrator", "system_role": true, "system_key": "super_administrator", "level": 2 } ], "permissions": { "access.management": [ "admin" ], "led.management": [ "admin" ], "network.management": [ "admin" ], "protect.management": [ "admin" ], "system.management.location": [ "admin" ], "system.management.user": [ "admin" ], "talk.management": [ "admin" ] }, "scopes": [ "write:protect.viewer", "write:protect.user:$", "write:protect.user", "write:protect.sensor", "write:protect.recordingSchedule", "write:protect.nvr", "write:protect.light", "write:protect.group", "write:protect.camera", "write:protect.bridge", "view:user_timezone", "view:user", "view:systemlog", "view:settings", "view:role", "view:permission:viewer", "view:permission:admin", "view:permission", "view:notification", "view:location_policy", "view:location_device", "view:location_activity", "view:location", "view:holiday_timezone", "view:holiday", "view:group", "view:door_group", "view:controller:talk", "view:controller:protect", "view:controller:network", "view:controller:led", "view:controller:access", "view:cloud_access", "view:app:users", "view:app:settings", "view:app:locations", "view:access.visitor", "view:access.systemlog", "view:access.settings", "view:access.schedule", "view:access.policy", "view:access.nfc_card", "view:access.face", "view:access.device", "view:access.dashboard", "update:access.device", "systemlog:user", "systemlog:system", "systemlog:location", "systemlog:access", "readmedia:protect.camera", "read:protect.viewer", "read:protect.user:$", "read:protect.user", "read:protect.sensor", "read:protect.recordingSchedule", "read:protect.nvr", "read:protect.light", "read:protect.group", "read:protect.camera", "read:protect.bridge", "notify:user", "notify:location", "notify:access", "manage:controller:talk", "manage:controller:network", "manage:controller:led", "manage:controller:access", "edit:user_timezone", "edit:user", "edit:systemlog", "edit:settings", "edit:role", "edit:permission:viewer", "edit:permission:admin", "edit:notification", "edit:location_policy", "edit:location_device", "edit:location_activity", "edit:location", "edit:holiday_timezone", "edit:holiday", "edit:group", "edit:feedback", "edit:door_group", "edit:access.visitor", "edit:access.settings", "edit:access.schedule", "edit:access.policy", "edit:access.nfc_card", "edit:access.face", "edit:access.device", "deletemedia:protect.camera", "delete:protect.viewer", "delete:protect.user:$", "delete:protect.user", "delete:protect.sensor", "delete:protect.recordingSchedule", "delete:protect.nvr", "delete:protect.light", "delete:protect.group", "delete:protect.camera", "delete:protect.bridge", "delete:access.device", "create:protect.viewer", "create:protect.user", "create:protect.sensor", "create:protect.recordingSchedule", "create:protect.liveview", "create:protect.light", "create:protect.group", "create:protect.camera", "create:protect.bridge", "assign:role", "adopt:access.device" ], "cloud_access_granted": false, "update_time": 1603833115, "avatar": "", "nfc_token": "", "nfc_display_id": "", "nfc_card_type": "", "nfc_card_status": "", "id": "ceb243e1-d6bb-4b4d-b391-f40f9eaa0117", "isOwner": false, "isSuperAdmin": true } miniUniFi Threaddebug UniFi Controller Status Response: <!doctype html>

miniUniFi Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 101, in runConcurrentThread File "plugin.py", line 271, in updateUniFiController File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/models.py", line 816, in json File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/init.py", line 307, in loads File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/decoder.py", line 335, in decode File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/decoder.py", line 353, in raw_decode ValueError: No JSON object could be decoded

miniUniFi Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) miniUniFi Debug Starting runConcurrentThread

FlyingDiver commented 3 years ago

OK, so the UDMP gives a LOT more info on the Login call, but doesn't understand the Status call. I just pushed a commit, can you grab that one and try it? I don't want to push a new release to try this out.

FlyingDiver commented 3 years ago

Or just change line 222 in plugin.py to: status_url = "{}status"

Koreysherwin commented 3 years ago

standby

Koreysherwin commented 3 years ago

Changed line 222:

`

miniUniFi Threaddebug UniFi Controller Status Response: <!doctype html>

miniUniFi Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 101, in runConcurrentThread File "plugin.py", line 271, in updateUniFiController File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/models.py", line 816, in json File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/init.py", line 307, in loads File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/decoder.py", line 335, in decode File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/simplejson/decoder.py", line 353, in raw_decode ValueError: No JSON object could be decoded

miniUniFi Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) `

FlyingDiver commented 3 years ago

OK, so it doesn't like that URL either. Hmmm. The docs I have are really ambiguous about this one. See if either of these work:

status_url = "{}proxy/network/status" status_url = "{}proxy/network/api/status"

FlyingDiver commented 3 years ago

I don't need all the output, just the lines after "UniFi Controller Status Response: "

Koreysherwin commented 3 years ago

status_url = "{}proxy/network/status"

works, no error

`   miniUniFi Threaddebug           UniFi Controller Status Response: {"meta":{"rc":"ok","uuid":"177f8879-29bb-5f58-ae2e-3eb1cf8ab5bd","server_version":"5.14.24","server_running":true,"db_running":true,"db_connected":true,"db_journaling":false,"db_repairing":false,"db_importing":false,"db_importing_at":-1,"db_importing_name":null,"ucore_installation":true,"udm_connected":true},"data":[]}
   miniUniFi Debug                 UDMP: UniFi Controller Getting Sites
   miniUniFi Threaddebug           didDeviceCommPropertyChange: UDMP -> UDMP
   miniUniFi Threaddebug           origDev:\address : 192.168.0.254
batteryLevel : None
buttonGroupCount : 0
configured : True
description : 
deviceTypeId : unifiController
displayStateId : status
displayStateImageSel : SensorOn
displayStateValRaw : Login OK
displayStateValUi : Login OK
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState : 
folderId : 1501775312
globalProps : MetaProps : (dict)
     com.flyingdiver.indigoplugin.miniUniFi : (dict)
          address : 192.168.0.254 (string)
          controllerType : UDMPro (string)
          password : xxxxx (string)
          port : 443 (string)
          ssl_verify : false (bool)
          username : test (string)
id : 55391458
lastChanged : 2020-10-28 18:26:58
lastSuccessfulComm : 2020-10-28 18:26:58
model : UniFi Controller
name : UDMP
ownerProps : com.flyingdiver.indigoplugin.miniUniFi : (dict)
     address : 192.168.0.254 (string)
     controllerType : UDMPro (string)
     password : Tester1 (string)
     port : 443 (string)
     ssl_verify : false (bool)
     username : test (string)
pluginId : com.flyingdiver.indigoplugin.miniUniFi
pluginProps : com.flyingdiver.indigoplugin.miniUniFi : (dict)
     address : 192.168.0.254 (string)
     controllerType : UDMPro (string)
--snip--
`
FlyingDiver commented 3 years ago

Try 0.0.14.

Koreysherwin commented 3 years ago

works! 👍👍

`

Oct 28, 2020 at 6:35:09 PM
   Reloading plugin "miniUniFi 0.0.14"
   Stopping plugin "miniUniFi 0.0.14" (pid 8564)
   Stopped plugin "miniUniFi 0.0.14"
   Starting plugin "miniUniFi 0.0.14" (pid 8647)
   Started plugin "miniUniFi 0.0.14"
   miniUniFi                       Starting miniUniFi
   miniUniFi Debug                 updateFrequency = 60.0
   miniUniFi                       Ap - Patio: Starting Device
   miniUniFi                       Barbie iPhone: Starting Device
   miniUniFi                       Korey iPhone: Starting Device
   miniUniFi                       Korey MBP 2016: Starting Device
   miniUniFi                       Sky Camera: Starting Device
   miniUniFi                       UDMP: Starting Device
   miniUniFi Debug                 Starting runConcurrentThread
   miniUniFi Debug                 UDMP: Updating controller
   miniUniFi Debug                 UDMP: Unifi OS controller detected
   miniUniFi Debug                 UDMP: UniFi Controller Getting Sites
   miniUniFi Debug                 Korey MBP 2016: Online @ KnB
   miniUniFi Debug                 Sky Camera: Online
   miniUniFi Debug                 Korey iPhone: Online @ KnB
   miniUniFi Debug                 Barbie iPhone: Online @ KnB
   miniUniFi Debug                 Ap - Patio: Online`
FlyingDiver commented 3 years ago

Is the SW version showing in the "Firmware" column of the Indigo client?

Koreysherwin commented 3 years ago

Uptime is in the state in indigo:

Screen Shot 2020-10-28 at 6 46 43 PM

Not seeing a Firmware State?

Screen Shot 2020-10-28 at 6 45 05 PM
FlyingDiver commented 3 years ago

Not the state list:

Screen Shot 2020-10-28 at 9 49 11 PM
FlyingDiver commented 3 years ago

You might need to add that column to the UI. Right click anywhere in that bar.

Koreysherwin commented 3 years ago

it's there:

no firmware showing for the G3 IP camera:

Screen Shot 2020-10-28 at 6 59 24 PM
FlyingDiver commented 3 years ago

Looks like the controller reports the camera as a client, not a UniFI device, if I'm reading the model column correctly. I don't even look at version info for clients.

What's in the type and model states for the UDMP 616 device?

Koreysherwin commented 3 years ago

Model = UDMPRO TYPE = udm

Screen Shot 2020-10-28 at 7 37 13 PM Screen Shot 2020-10-28 at 7 37 32 PM
FlyingDiver commented 3 years ago

Great. I'll put that model info in the next release.

Koreysherwin commented 3 years ago

No camera show up, nor does the 48 port switch

Screen Shot 2020-10-28 at 7 39 41 PM
FlyingDiver commented 3 years ago

Where do they show up in the UniFI web UI? Under devices or clients?

FlyingDiver commented 3 years ago

What kind of switch?

Koreysherwin commented 3 years ago

in the controller under devices:

Screen Shot 2020-10-28 at 7 50 48 PM
Koreysherwin commented 3 years ago

UniFi Switch 48 AT-500W

FlyingDiver commented 3 years ago

Weird. And where did that "--none--" come from? I'm not adding it to the list.

Screen Shot 2020-10-28 at 10 53 07 PM
Koreysherwin commented 3 years ago

you got me.. perhaps that's the switch, let me add that and see what it does

Koreysherwin commented 3 years ago

Yes, that's the switch.

Screen Shot 2020-10-28 at 7 55 27 PM
FlyingDiver commented 3 years ago

Oh, wait, that's what I'm putting in the list when there's no 'name' or 'hostname' in the states. Is there any state with the name in it?

Koreysherwin commented 3 years ago

model: S248500

Screen Shot 2020-10-28 at 7 57 43 PM
FlyingDiver commented 3 years ago

Maybe you never gave it a name in the web UI. I guess I could fall back to the 'model' state.

Koreysherwin commented 3 years ago

yes that was the deal, no Alias in the controller, added one now it shows.

Screen Shot 2020-10-28 at 8 01 29 PM
FlyingDiver commented 3 years ago

OK, I'm now checking for 'name', then 'hostname', then 'model' before I punt on the name. ;)

Koreysherwin commented 3 years ago

interesting now too, since I added the G3 camera as a client it now shows in devices, but offline:

Screen Shot 2020-10-28 at 8 00 12 PM
FlyingDiver commented 3 years ago

They both had the same "name" before, which was messing up the list, I think.
Devices should show up on or offline. Anything that's adopted by the controller.

Koreysherwin commented 3 years ago

that one is my weather camera BTW: 😁

https://admin.meteobridge.com/cam/8d0ff1a8bad9e8e915751f42ee099abc/camplus.jpg

FlyingDiver commented 3 years ago

Time to crash. If you see anything else, let me know and I'll deal with it tomorrow.

Koreysherwin commented 3 years ago

Deleted it and now it does not show the camera in devices list:

Good night.

Screen Shot 2020-10-28 at 8 06 23 PM
FlyingDiver commented 3 years ago

I was doing the name fixes wrong (wrong place in the code). Fixing it now.

FlyingDiver commented 3 years ago

Should be finally fixed in 0.0.15.