rxseger / homebridge-camera-motion

Motion detector camera plugin for Homebridge
MIT License
48 stars 9 forks source link

How to view the camera in HomeKit #13

Closed mabrodeur closed 6 years ago

mabrodeur commented 6 years ago

Hi,

I installed Motion correctly as I can see the stream by going to http://xxx.xxx.xxx.xxx:8081 and I have installed your homebridge module. If I take a snapshot from the web (localhost:7999/0/action/snapshot) I receive a notification in HomeKit correctly but I do not have the picture. Also I do not see my camera in HomeKit, only a motion sensor. Am I supposed to see the camera also? Am I doing something wrong? Thanks

mabrodeur commented 6 years ago

Oh well... The motion sensor was added automatically to my Home app but not the camera. I had to add the camera manually. However, now everything works fine. I can see the snapshot in my notification and in my Home app. But if I press on the feed, I get a "Camera unavailable" message and can't get the feed.

Any idea?

mabrodeur commented 6 years ago

Found it. Needed to add the homebridge user to the video user group so it has access to the feed.

Gatzu75 commented 6 years ago

Hi Marc how you did it? what is the video user group?

mabrodeur commented 6 years ago

Hi, I did it based on this : https://github.crookster.org/Adding-A-Webcam-To-HomeKit/#usb-webcam---logitech-c615

This needs the user that runs homebridge to have permission to access the /dev/video0 device where the kernel interface to camera gets made available. In my setup, the user is homebridge and the video group is video

So basically sudo usermod -aG video homebridge would do the trick

Then you need to logout/login or simply reboot and it should work

mabrodeur commented 6 years ago

If you setup your homebridge to launch on startup using systemd as explained here : https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi#running-homebridge-on-bootup-systemd You should have a user named homebridge

Gatzu75 commented 6 years ago

at moment I'm still using PI user (just to test) but the stream seems not work.

mabrodeur commented 6 years ago

Do you run homebridge as a service or you are just calling homebridge ? Does it work if you run homebridge while logged in as the pi user? Can you give me the log, maybe I could help.

Gatzu75 commented 6 years ago

no I'm still calling homebrige with pi user and it doesn't work. i used "sudo usermod -aG video pi" too.

mabrodeur commented 6 years ago

Does homebridge run and you do not see the feed or does it crash? Can you access the feed if you go directly on http://raspberry-pi-ip-here:8081 in a web browser?

Gatzu75 commented 6 years ago

everything seems work fine: homebridge is running and the accessories are installed on my iphone. The notification is working and i'm able to see the snapshots. In the web browser, I'm correctly see the cam streaming. But whe I try to see the cam streaming, homekit shows me "camera unavailable".

mabrodeur commented 6 years ago

I followed this tutorial to run homebridge as a service : https://timleland.com/setup-homebridge-to-start-on-bootup/

And then I added the homebridge user to my video group and rebooted. It then worked... I do not have this plugin installed right now so I really can't test things to help you sorry.

Gatzu75 commented 6 years ago

are you running MOTION as service too? how is your motion config file?

mabrodeur commented 6 years ago

I wiped my partition so I do not have access to it. I opted for another plugin instead as the motion detection faque pretty bad. It was alway triggering notifications and I couldn't manage to make it less sensitive. I was using : MotionEye which (I guess) runs motion as a service and adds a nice WebUI to control your motion config. As I didn't run motion by itself I can't tell sorry. I went for https://github.com/KhaosT/homebridge-camera-ffmpeg which work pretty great. I don't have motion detection, but I will plug a IR Motion sensor in the GPIO to act as a motion detector in homekit with something like that : https://github.com/Killerameise/homebridge-infrared-motion-sesnor-gpio I will have way better detection and if you put both of the in the same room you will get a screenshot when a motion is detected (I need to validate this)

Gatzu75 commented 6 years ago

it is a solution close to what I was thinking about.. thanks