Giter Site home page Giter Site logo

didel / homekitcam Goto Github PK

View Code? Open in Web Editor NEW
79.0 11.0 11.0 6 KB

A project to make a Raspberry Pi driven, HomeKit Enabled camera.

License: MIT License

JavaScript 100.00%
raspberry-pi pi-camera homekit homekit-accessory raspberry-pi-camera raspberry raspberrypi raspberry-pi-3 hap-nodejs-accessories

homekitcam's Introduction

HomeKitCam

A project to make a Raspberry Pi driven, HomeKit Enabled camera.

This project aims to make a simple DIY HomeKit enabled camera using only a Raspberry Pi and the Raspberry Camera Module. The software is based on the HAP-NodeJS HomeKit API by KhaosT.

Requirements

One of the aims of this project is to be as simple as possible. You will only need:

  • A working Raspberry Pi (the newer, the better), configured with a standard Raspbian installation
  • A Pi Camera Module
  • A suitable usb power adapter to power the Pi

Installation

To install, clone the project into a folder. Then cd to that directory, and run npm install to install all the necessary packages.

Starting HomeKitCaM

The camera can be run by running the command: node PiCamera_accesory.js

On any iOS 10 device, open the Home app and add a new accessory. The Raspberry should show up as 'Pi Camera'. When asked to scan the HomeKit accessory code, choose to manually enter a code and enter 031-45-154. After that, the pairing should be successful and the camera should start to send screenshots to the Home app.

homekitcam's People

Contributors

diarmuidie avatar didel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homekitcam's Issues

Will not start

I cloned this down and ran npm install

when running node PiCamera_accessory.js I get the following output

/home/pi/HomeKitCam/PiCamera_accessory.js:25
let sessionIdentifier = uuid.unparse(sessionID);
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3

Single frame is streamed then times out, not a performance issue

Hi.

This is exactly the project I've been meaning to use my Zero W for. I managed to get npm and everything setup for HomeKitCam but I'm finding the stream from iPhone shows the 1st frame when connected, then times out.

The npm/PiCamera_accessory.js script shows the following options when I connect with my iPhone:

bitrate: 299
avconv stream: -f video4linux2 -i /dev/video0 -s 640:480 -threads auto -vcodec h264 -an -pix_fmt yuv420p -f rawvideo -tune zerolatency -vf scale=w=640:h=480 -b:v 100k -bufsize 200k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params wuxFurc9azRuIgjC98gWfSsmwIDjOdBtRpfu1UtQ srtp://192.168.2.133:64011?rtcpport=64011&localrtcpport=64011&pkt_size=1378

My iPhone shows a frame, then nothing happens until I finally get a "No response" message.

I ran top on another term on the Zero and there's no CPU usage after the 1st frame. When the connection is established, the avconv process will pop at the top with 20% CPU, then disappear from the list while the streaming stalls out.

Is there anyway to figure out the problem that avconv is happen?

How to get working on a Mac with usb camera?

How could I get this to work on a Mac? I prefer to run it on this type of machine because hopefully the greater power will provide less latency in the stream. Any help is greatly appreciated.

Painfully slow stream

I use the HomeKitCam on my computer with a microsoft Cinema camera and it works perfect.
No i try to do the same thing with my raspberry pi and the picam and get painfully slow laggs on the stream i talking about one second in real time takes 20 seconds to watch in the home kit app

I have tried to change the ffmpegCommand params without result. is it really possible to stream with ffmpeg and raspberry pi Model B?

/Adam

No snapshot over cellular

When I use a raspberry zero wifi and raspberry camera with homekitcam everything works fine when at home with wifi. But when using cellular the snashot dont refresh and the streaming dont work.
Any clues on why this happens?

cant run node PiCamera_accessory.js ? ideas?

pi@raspberrypi:/HomeKitCam $ ls
LICENSE node_modules package.json PiCamera_accessory.js README.md
pi@raspberrypi:
/HomeKitCam $ node PiCamera_accessory.js
/home/pi/HomeKitCam/PiCamera_accessory.js:25
let sessionIdentifier = uuid.unparse(sessionID);
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3
pi@raspberrypi:~/HomeKitCam $

Entering camera stream in iOS Home app crashes PiCamera_accessory.js

Hi! When I enter camera stream in iOS Home app PiCamera_accessory.js crashes.

bitrate:  299
avconv stream:  -f video4linux2 -i /dev/video0 -s 640:480 -threads auto -vcodec h264 -an -pix_fmt yuv420p -f rawvideo -tune zerolatency -vf scale=w=640:h=480 -b:v 100k -bufsize 200k -payload_type 99 -ssrc 1 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params gAi3S7pQdEW/Z7GPqOGtV8TgR/2xLvHcUXtD+Lcv srtp://192.168.1.14:60622?rtcpport=60622&localrtcpport=60622&pkt_size=1378
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: spawn avconv ENOENT
    at _errnoException (util.js:1026:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

If it could help, I have Raspbery PI Zero W with Camera v2.1 and 16GB SD Card, clean Raspbian Stretch Lite installed from raspberrypi.org with enabled camera using sudo raspi-config and HAP-NodeJS installed as recommended on instalation guide.

Video stream not working?

This might be a duplicate of #3, but I'm having a slightly different issue. The snapshots work fine with the camera, but the stream does not load at all. I can wait as long as I want, but the camera will still keep trying and the script will still keep printing the command over and over again. Has anybody gotten this to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.