seaside1 / unifiprotect

openHAB UniFi Protect Addon
Eclipse Public License 2.0
21 stars 6 forks source link

Can't found cameras #4

Closed stas-dovgodko closed 3 years ago

stas-dovgodko commented 3 years ago

13:06:07.873 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: f0:9f:c2:c1:51:41 13:06:07.874 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 0 macToCamera=] 13:06:07.874 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Failed to handle command since there is no camera

on latest alfa-10

BTW something wrong with camera things. Your manual says that should be channel="unifiprotect:camera:NVRID:MACADDRESS:*" channels but OH admin shows channel="unifiprotect:camera:NVRID:NAME:*" - hope this helps

stas-dovgodko commented 3 years ago

Another log error

13:05:33.379 [DEBUG] [t.websocket.UniFiProtectEventWsClient] - Connecting to: wss://192.168.1.2/proxy/protect/ws/updates 13:05:33.380 [DEBUG] [.websocket.UniFiProtectEventWebSocket] - Error in websocket: null java.nio.channels.AsynchronousCloseException: null at org.eclipse.jetty.client.HttpDestination.close(HttpDestination.java:382) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:260) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:93) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:180) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:201) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:371) [bundleFile:9.4.20.v20190813] at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:93) [bundleFile:9.4.20.v20190813] at org.openhab.binding.unifiprotect.websocket.UniFiProtectEventWsClient.stop(UniFiProtectEventWsClient.java:64) [bundleFile:?] at org.openhab.binding.unifiprotect.internal.UniFiProtectEventManager.stop(UniFiProtectEventManager.java:100) [bundleFile:?] at org.openhab.binding.unifiprotect.internal.UniFiProtectNvrThingHandler.updateStatus(UniFiProtectNvrThingHandler.java:119) [bundleFile:?] at org.openhab.binding.unifiprotect.internal.UniFiProtectNvrThingHandler.initialize(UniFiProtectNvrThingHandler.java:106) [bundleFile:?] at org.openhab.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:152) [bundleFile:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?] at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?] at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?] at java.util.concurrent.FutureTask.run(Unknown Source) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?] at java.lang.Thread.run(Unknown Source) [?:?]

stas-dovgodko commented 3 years ago

cloud keygen2+ version 2.0.27 protect 1.17.4

seaside1 commented 3 years ago

Hi!

I think your item definition is wrong. I need to update the documentation to be correct. This an example for Reboot: Switch G3PEHReboot "G3PEH Reboot [%s]" (G3PEH) { channel="unifiprotect:camera:ad266882a1:B4FBE47ED472:reboot" }

Where ad266882a1 is the id of my bridge and B4FBE47ED472 is the id of the camera (it is the macaddress without :")

I assume you run openhab 3 ?

The easiest way to check that you have the correct channel is to look in the gui see attached screenshot:

g3

Nevermind it says g3camera the version I'm using is the next unreleased version

Have you added the things manually or using the gui?

stas-dovgodko commented 3 years ago

Yes OH3.

My definition manually:

` Bridge unifiprotect:nvr:home "UniFi Protect NVR" [ host="192.168.1.2", username="openhab", password="....", refresh=60, imageFolder="/etc/openhab/html/protect/" ] { Thing camera parking_camera [name="Parking", mac="F0:9F:C2:C1:51:41"] }

Switch G3DMyCamSnapshot "G3 Cam Snapshot " (gUniFiProtect) { channel="unifiprotect:camera:home:parking_camera:snapshot",expire="3s,command=OFF" }

` GUI shows item attached to g3 channel well, but switch does not work (log error).

stas-dovgodko commented 3 years ago

Debug log

17:23:37.121 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: F0:9F:C2:C1:51:41 17:23:37.121 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:23:37.122 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Failed to handle command since there is no camera 17:23:37.123 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: F0:9F:C2:C1:51:41 17:23:37.124 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:23:37.125 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Failed to handle command since there is no camera 17:23:37.126 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: F0:9F:C2:C1:51:41 17:23:37.127 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:23:37.128 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Failed to handle command since there is no camera 17:23:50.311 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Executing refresh job 17:23:50.313 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refreshing Protect: 6214031 17:23:50.314 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refreshing the UniFi Protect Controller unifiprotect:nvr:home 17:23:50.315 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Refresh Protect fetch cameras 17:23:50.316 [DEBUG] [nal.model.request.UniFiProtectRequest] - Key: x-csrf-token, value: a5cb3a9a-a9c8-44d2-8978-d93c6f7b5884 17:23:50.316 [DEBUG] [nal.model.request.UniFiProtectRequest] - Created new request host: 192.168.1.2, scheme: https, path: /proxy/protect/api/bootstrap 17:23:50.317 [DEBUG] [nal.model.request.UniFiProtectRequest] - New request: HttpRequest[GET /proxy/protect/api/bootstrap HTTP/1.1]@14ef35d 17:23:50.318 [DEBUG] [nal.model.request.UniFiProtectRequest] - >> GET https://192.168.1.2/proxy/protect/api/bootstrap 17:23:50.420 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Successfullt sent request 17:23:50.420 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Request is ok, parsing cameras 17:23:50.423 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Camera: UniFiProtectCamera [name=Yard, id=604a0805033e9c03e70003fd] 17:23:50.424 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Camera: UniFiProtectCamera [name=Parking, id=604a101a001d9c03e7000432] 17:23:50.425 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Got Cameras size: 2 17:23:50.426 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Put all size: 2 17:23:50.427 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - UniFiProtectNvrDevice: UniFiProtectNvrDevice [mac=7483C276CA7D, host=192.168.1.2, name=controller, canAutoUpdate=false, isStatsGatheringEnabled=true, timezone=Europe/Kiev, version=1.17.4, firmwareVersion=2.0.27, hardwarePlatform=apq8053, ports={ump=7449, http=7080, https=7443, rtsp=7447, rtsps=7441, rtmp=1935, devicesWss=7442, cameraHttps=7444, cameraTcp=7877, liveWs=7445, liveWss=7446, tcpStreams=7448, playback=7450, emsCLI=7440, emsLiveFLV=7550, cameraEvents=7551, tcpBridge=8888, ucore=11081, discoveryClient=0}, uptime=332679000, lastSeen=1615821828432, isUpdating=false, lastUpdateAt=null, isConnectedToCloud=false, isStation=false, enableAutomaticBackups=true, enableStatsReporting=false, isSshEnabled=false, releaseChannel=release, hosts=[192.168.1.2], hardwareId=61d8d577-40e3-5242-a62e-09a0ec4d2f63, hardwareRevision=113-02570-16, hostType=59760, hostShortname=UCKP, isHardware=true, timeFormat=12h, recordingRetentionDurationMs=null, enableCrashReporting=true, disableAudio=false, storageInfo=UniFiProtectSystemInfo [cpu=UniFiProtectCpuInfo [averageLoad=1.125, temperature=64.622], memory=UniFiProtectMemoryInfo [available=1355668, free=48864, total=3052792], storage=UniFiProtectStorageInfo [devices=[UniFiProtectHardDrive [model=TOSHIBA MQ01ABD100V, size=1000204886016, healthy=true]], available=740890472448, isRecycling=false, size=942307909632, type=hdd, used=201400659968]]] 17:23:50.428 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - UniFiProtectNvrUser: UniFiProtectNvrUser [enableNotifications=false, localUsername=openhab, firstName=Openhab, id=604f3f6101e4e303e7001d58] 17:23:50.429 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Login Token Success: a5cb3a9a-a9c8-44d2-8978-d93c6f7b5884 17:23:50.430 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Successfully refreshed bootstrap 17:23:50.431 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Nvr Refresh! 17:23:50.431 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: name 17:23:50.433 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: host 17:23:50.434 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: version 17:23:50.435 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: firmware-version 17:23:50.436 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: uptime 17:23:50.438 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: last-seen 17:23:50.439 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: last-updated-at 17:23:50.440 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: is-connected-to-cloud 17:23:50.441 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: enable-automatic-backups 17:23:50.443 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: hosts 17:23:50.444 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - HOSTS: 192.168.1.2 17:23:50.446 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: host-short-name 17:23:50.449 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: recording-retention-duration 17:23:50.450 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: storage-total-size 17:23:50.452 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: storage-type 17:23:50.454 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: storage-used 17:23:50.456 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: storage-available 17:23:50.458 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: cpu-average-load 17:23:50.460 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: cpu-temperature 17:23:50.462 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: mem-available 17:23:50.464 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: mem-free 17:23:50.466 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: mem-total 17:23:50.468 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: device-0-model 17:23:50.470 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: device-0-size 17:23:50.472 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: device-0-healthy 17:23:50.474 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Refresh Channel: alerts 17:23:50.475 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Alert NVR: false: 17:23:50.475 [DEBUG] [.internal.UniFiProtectNvrThingHandler] - Alert NVR val: false: 17:23:50.476 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: f0:9f:c2:c1:50:49 17:23:50.477 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:23:50.478 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Camera Refresh! null 17:23:50.479 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: F0:9F:C2:C1:51:41 17:23:50.480 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:23:50.481 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Camera Refresh! null 17:24:36.625 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: F0:9F:C2:C1:51:41 17:24:36.627 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:24:36.628 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Failed to handle command since there is no camera 17:24:40.139 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - Getting camera from cache configMac: F0:9F:C2:C1:51:41 17:24:40.140 [DEBUG] [rotect.internal.model.UniFiProtectNvr] - InsightCache: UniFiProtectCameraCache [size= 2 macToCamera=] 17:24:40.140 [DEBUG] [ternal.UniFiProtectCameraThingHandler] - Failed to handle command since there is no camera

seaside1 commented 3 years ago

I got it to work. You need to have the mac address in the format Uppercase letters and without ":".

Bridge unifiprotect:nvr:ad266882a1 "UniFi Protect NVR" [ host="xxxxxxx", username="openhab", password="coolopenhab", refresh=60 ] { Thing camera B4FBE49F8DC6 [name="Front door camera", mac="B4FBE49F8DC6"] }

seaside1 commented 3 years ago

I would recommend you to use the built in GUI for adding things. You will get discovery as well, making it really simple to add all things without syntax errors.

stas-dovgodko commented 3 years ago

Thing camera B4FBE49F8DC6 [name="Front door camera", mac="B4FBE49F8DC6"]

awesome! working. Looks like should be thing name == mac and without ":"

seaside1 commented 3 years ago

I have updated the documentation for the manual configuration.