brutella / hkcam

Open-Source HomeKit Surveillance Camera
https://hochgatterer.me/hkcam/
Apache License 2.0
925 stars 141 forks source link

Can't access hkcam with Apple's Home app #38

Closed marf85 closed 5 years ago

marf85 commented 5 years ago

Hello,

I've downloaded latest raspbian image - here and installed it on rpi zero w with Noir Camera. Only info I have in logs are :

pi@raspberrypi:~ $ tail -f /var/log/hkcam/current
2019-06-04_07:33:04.93116 DEBUG 2019/06/04 08:33:04 camera_control.go:194: {"assets":[]}
2019-06-04_07:33:04.94253 INFO 2019/06/04 08:33:04 ip_transport.go:186: Listening on port 43325

Camera works, cause I can take pictures with it and record video ( with raspistill and raspivid).

When I open a Home app ( Apple's one) I can see the camera, it also asks me for the pin when I connect to it. But after that, nothing happens. I get "Couldn't add Camera" message.

Where I can look for additional info about this ?

IMG_1245 IMG_1246

brutella commented 5 years ago

Take a look at the log file when you try to add the camera to HomeKit. You can access the log file as described here.

marf85 commented 5 years ago

Log file is like this :

`pi@raspberrypi:~ $ tail -f /var/log/hkcam/current

2019-06-22_12:30:51.28658 DEBUG 2019/06/22 13:30:51 camera_control.go:194: {"assets":[]} 2019-06-22_12:30:51.30193 INFO 2019/06/22 13:30:51 ip_transport.go:186: Listening on port 38251 `

No information is logged when I try to connect. But I see this device in Home App. I put in the PIN and ... nothing happens. IMG_0136

brutella commented 5 years ago

It seems like iOS has problems connecting to the device. Do you have other Raspberry Pis with the same hostname connected to your WiFi network?

RaymondMouthaan commented 5 years ago

I have a similar issue .. I ran hkcam just fine, but after changing the hostname and removing the accessory for the Home App and re-adding it, It just doesn't appear in the app.

brutella commented 5 years ago

You can reset hkcam completely by deleting the folder /var/lib/hkcam/data. The next time you boot the Raspberry Pi, you should be able to pair it with HomeKit again.

marf85 commented 5 years ago

It seems like iOS has problems connecting to the device. Do you have other Raspberry Pis with the same hostname connected to your WiFi network?

@brutella I had another RPi in the network, but with a different hostname. Even when I disconnected it ( ony RPi Zero with hkcam now in that network) I stil can't connect. I see the device in Home App, but after putting in PIN nothing happens and I don't see any info in logs.

brutella commented 5 years ago

Have you tried to disconnect your iOS device from your local WiFi and then connect it again. It looks like a dns issue.

marf85 commented 5 years ago

OK, yes, disconnecting from WiFi and connecting again , alongside rpi reboot fixed the issue with connecting to hkcam from Home app.

It's connected now, it appears in Home app, but there is no video stream.

And this is what I get in logs : pi@raspberrypi:~ $ tail -f /var/log/hkcam/current 2019-06-27_19:47:11.43405 libpostproc 54. 1.100 / 54. 1.100 2019-06-27_19:47:11.48086 [video4linux2,v4l2 @ 0x19b2310] ioctl(VIDIOC_G_FMT): Invalid argument 2019-06-27_19:47:11.48245 /dev/video1: Invalid argument 2019-06-27_19:47:13.04918 DEBUG 2019/06/27 20:47:13 characteristics.go:48: 192.168.1.131:53569 PUT /characteristics 2019-06-27_19:47:13.05356 DEBUG 2019/06/27 20:47:13 characteristic_controller.go:76: {"characteristics":[{"aid":1,"iid":18,"value":"ARUCAQABEJc8KtWCgkbrkcr0ljcR1o8="}]} 2019-06-27_19:47:13.06008 DEBUG 2019/06/27 20:47:13 setup.go:53: {Command:{Identifier:[151 60 42 213 130 130 70 235 145 202 244 150 55 17 214 143] Type:0} Video:{CodecType:0 CodecParams:{Profiles:[] Levels:[] Packetizations:[]} Attributes:{Width:0 Height:0 Framerate:0} RTP:{PayloadType:0 Ssrc:0 Bitrate:0 Interval:0 ComfortNoisePayloadType:0 MTU:0}} Audio:{CodecType:0 CodecParams:{Channels:0 Bitrate:0 Samplerate:0} RTP:{PayloadType:0 Ssrc:0 Bitrate:0 Interval:0 ComfortNoisePayloadType:0 MTU:0} ComfortNoise:false}} 2019-06-27_19:47:13.06307 DEBUG 2019/06/27 20:47:13 stream.go:28: stop stream 2019-06-27_19:47:13.06640 DEBUG 2019/06/27 20:47:13 ffmpeg.go:113: Stopping loopback 2019-06-27_19:48:18.76269 DEBUG 2019/06/27 20:48:18 characteristics.go:48: 192.168.1.131:53569 PUT /characteristics 2019-06-27_19:48:18.76523 DEBUG 2019/06/27 20:48:18 characteristic_controller.go:76: {"characteristics":[{"aid":1,"iid":10,"ev":false},{"aid":1,"iid":9,"ev":false},{"aid":1,"iid":19,"ev":false}]} 2019-06-27_19:55:27.30209 DEBUG 2019/06/27 20:55:27 characteristics.go:43: 192.168.1.131:53569 GET /characteristics map[id:[1.19]] 2019-06-27_19:55:27.33663 DEBUG 2019/06/27 20:55:27 characteristics.go:48: 192.168.1.131:53569 PUT /characteristics 2019-06-27_19:55:27.33911 DEBUG 2019/06/27 20:55:27 characteristic_controller.go:76: {"characteristics":[{"aid":1,"iid":20,"value":"ARArorKP02lJr7JK4yp88V53AxoBAQACDTE5Mi4xNjguMS4xMzEDAvHIBAKT6wQlAhBG2spSyn0urjcZXHVVeqENAw54ScbCl2q8WLkFAqnBAwEBAAUlAhBVBi64jKuqLy+s1yOyrP3eAw7tjleoesIGcdp\/2GHGUAEBAA=="}]} 2019-06-27_19:55:27.34301 DEBUG 2019/06/27 20:55:27 setup.go:93: {SessionId:[43 162 178 143 211 105 73 175 178 74 227 42 124 241 94 119] ControllerAddr:{IPVersion:0 IPAddr:192.168.1.131 VideoRtpPort:51441 AudioRtpPort:60307} Video:{Types:[{Type:0}] MasterKey:[70 218 202 82 202 125 46 174 55 25 92 117 85 122 161 13] MasterSalt:[120 73 198 194 151 106 188 88 185 5 2 169 193 3]} Audio:{Types:[{Type:0}] MasterKey:[85 6 46 184 140 171 170 47 47 172 215 35 178 172 253 222] MasterSalt:[237 142 87 168 122 194 6 113 218 127 216 97 198 80]}} 2019-06-27_19:55:27.36028 DEBUG 2019/06/27 20:55:27 setup.go:127: {SessionId:[43 162 178 143 211 105 73 175 178 74 227 42 124 241 94 119] Status:0 AccessoryAddr:{IPVersion:0 IPAddr:192.168.1.245 VideoRtpPort:51441 AudioRtpPort:60307} Video:{Types:[{Type:0}] MasterKey:[70 218 202 82 202 125 46 174 55 25 92 117 85 122 161 13] MasterSalt:[120 73 198 194 151 106 188 88 185 5 2 169 193 3]} Audio:{Types:[{Type:0}] MasterKey:[85 6 46 184 140 171 170 47 47 172 215 35 178 172 253 222] MasterSalt:[237 142 87 168 122 194 6 113 218 127 216 97 198 80]} SsrcVideo:1 SsrcAudio:2} 2019-06-27_19:55:27.37346 DEBUG 2019/06/27 20:55:27 characteristics.go:43: 192.168.1.131:53569 GET /characteristics map[id:[1.20]] 2019-06-27_19:55:27.42870 DEBUG 2019/06/27 20:55:27 characteristics.go:48: 192.168.1.131:53569 PUT /characteristics 2019-06-27_19:55:27.43233 DEBUG 2019/06/27 20:55:27 characteristic_controller.go:76: {"characteristics":[{"aid":1,"iid":18,"value":"ARUCAQEBECuiso\/TaUmvskrjKnzxXncCNAEBAAIJAQECAgECAwEAAwsBAgAFAgLQAgMBHgQXAQFjAgSxxLQcAwIrAQQEAAAAPwUCYgUDLAEBAgIMAQEBAgEAAwEBBAEeAxYBAW4CBLGqOlQDAhgABAQAAKBABgENBAEA"}]} 2019-06-27_19:55:27.44505 DEBUG 2019/06/27 20:55:27 setup.go:53: {Command:{Identifier:[43 162 178 143 211 105 73 175 178 74 227 42 124 241 94 119] Type:1} Video:{CodecType:0 CodecParams:{Profiles:[{Id:2}] Levels:[{Level:2}] Packetizations:[{Mode:0}]} Attributes:{Width:1280 Height:720 Framerate:30} RTP:{PayloadType:99 Ssrc:481608881 Bitrate:299 Interval:0 ComfortNoisePayloadType:98 MTU:0}} Audio:{CodecType:2 CodecParams:{Channels:1 Bitrate:0 Samplerate:1} RTP:{PayloadType:110 Ssrc:1413130929 Bitrate:24 Interval:0 ComfortNoisePayloadType:0 MTU:0} ComfortNoise:false}} 2019-06-27_19:55:28.45730 DEBUG 2019/06/27 20:55:28 stream.go:37: start stream 2019-06-27_19:55:28.45834 DEBUG 2019/06/27 20:55:28 stream.go:82: &{/usr/bin/ffmpeg [ffmpeg -f v4l2 -framerate 30 -i /dev/video1 -an -codec:v h264_omx -pix_fmt yuv420p -vsync 2 -video_size 1280:-2 -framerate 30 -level:v 4.0 -f rawvideo -tune zerolatency -b:v 299k -bufsize 299k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params RtrKUsp9Lq43GVx1VXqhDXhJxsKXarxYuQUCqcED srtp://192.168.1.131:51441?rtcpport=51441&localrtcpport=51441&pkt_size=1378&timeout=60] [] <nil> 0x200e0e8 0x200e0f0 [] <nil> <nil> <nil> <nil> <nil> false [] [] [] [] <nil> <nil>} 2019-06-27_19:55:29.28482 ffmpeg version 3.2.14-1~deb9u1+rpt1 Copyright (c) 2000-2019 the FFmpeg developers 2019-06-27_19:55:29.30020 built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 2019-06-27_19:55:29.30107 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared 2019-06-27_19:55:29.30447 libavutil 55. 34.101 / 55. 34.101 2019-06-27_19:55:29.30558 libavcodec 57. 64.101 / 57. 64.101 2019-06-27_19:55:29.30665 libavformat 57. 56.101 / 57. 56.101 2019-06-27_19:55:29.30772 libavdevice 57. 1.100 / 57. 1.100 2019-06-27_19:55:29.30887 libavfilter 6. 65.100 / 6. 65.100 2019-06-27_19:55:29.30997 libavresample 3. 1. 0 / 3. 1. 0 2019-06-27_19:55:29.31103 libswscale 4. 2.100 / 4. 2.100 2019-06-27_19:55:29.31208 libswresample 2. 3.100 / 2. 3.100 2019-06-27_19:55:29.31312 libpostproc 54. 1.100 / 54. 1.100 2019-06-27_19:55:30.00673 [video4linux2,v4l2 @ 0x8da180] ioctl(VIDIOC_STREAMON): Operation not permitted 2019-06-27_19:55:30.00819 /dev/video0: Operation not permitted 2019-06-27_19:55:30.55950 ffmpeg version 3.2.14-1~deb9u1+rpt1 Copyright (c) 2000-2019 the FFmpeg developers 2019-06-27_19:55:30.56081 built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 2019-06-27_19:55:30.56162 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared 2019-06-27_19:55:30.56486 libavutil 55. 34.101 / 55. 34.101 2019-06-27_19:55:30.56596 libavcodec 57. 64.101 / 57. 64.101 2019-06-27_19:55:30.56701 libavformat 57. 56.101 / 57. 56.101 2019-06-27_19:55:30.56807 libavdevice 57. 1.100 / 57. 1.100 2019-06-27_19:55:30.56923 libavfilter 6. 65.100 / 6. 65.100 2019-06-27_19:55:30.57199 libavresample 3. 1. 0 / 3. 1. 0 2019-06-27_19:55:30.57360 libswscale 4. 2.100 / 4. 2.100 2019-06-27_19:55:30.57469 libswresample 2. 3.100 / 2. 3.100 2019-06-27_19:55:30.57678 libpostproc 54. 1.100 / 54. 1.100 2019-06-27_19:55:30.62206 [video4linux2,v4l2 @ 0x2336310] ioctl(VIDIOC_G_FMT): Invalid argument 2019-06-27_19:55:30.62357 /dev/video1: Invalid argument 2019-06-27_19:55:57.41963 DEBUG 2019/06/27 20:55:57 characteristics.go:48: 192.168.1.131:53569 PUT /characteristics 2019-06-27_19:55:57.42223 DEBUG 2019/06/27 20:55:57 characteristic_controller.go:76: {"characteristics":[{"aid":1,"iid":18,"value":"ARUCAQABECuiso\/TaUmvskrjKnzxXnc="}]} 2019-06-27_19:55:57.42817 DEBUG 2019/06/27 20:55:57 setup.go:53: {Command:{Identifier:[43 162 178 143 211 105 73 175 178 74 227 42 124 241 94 119] Type:0} Video:{CodecType:0 CodecParams:{Profiles:[] Levels:[] Packetizations:[]} Attributes:{Width:0 Height:0 Framerate:0} RTP:{PayloadType:0 Ssrc:0 Bitrate:0 Interval:0 ComfortNoisePayloadType:0 MTU:0}} Audio:{CodecType:0 CodecParams:{Channels:0 Bitrate:0 Samplerate:0} RTP:{PayloadType:0 Ssrc:0 Bitrate:0 Interval:0 ComfortNoisePayloadType:0 MTU:0} ComfortNoise:false}} 2019-06-27_19:55:57.43074 DEBUG 2019/06/27 20:55:57 stream.go:28: stop stream 2019-06-27_19:55:57.43305 DEBUG 2019/06/27 20:55:57 ffmpeg.go:113: Stopping loopback

brutella commented 5 years ago

How much memory did you assign to the GPU?

marf85 commented 5 years ago

I've reinstalled Raspbian on SD card and it worked. You were correct about issue being in my network. Thank you for help.