Introduction: Take Snapshots of Who Visits Your Door With Homebridge and Google Drive

About: Creator of multiple Apple HomeKit devices using homebridge in an attempt to increase the WAF score of my home automation attempts.

In this instructable I will walk you thru taking snapshots of who visits your front door and storing them on google drive. For this instructable I'm using Homebridge with a motion sensor and a IP camera to capture the image, and then using Google Drive to store the image. Also as this is using HomeKit, you will receive picture notifications on your iOS device when someone approaches your door.

Step 1: Parts List

1 - A running homebridge instance ( ). There are a lot of other guides for this, so I won't repeat this here. I'm using a RaspberryPI 2 for mine.

2 - Apple TV4 or iPad running as homekit hub for remote access to the camera and motion sensor.

3 - A homekit motion sensor. For mine I'm using a X-10 MS14A Motion Sensor that I have had for a long time. This is connected to HomeKit via the homebridge-heyu plugin.

4 - An small bird house that you can repurpose for installing a motion sensor.

5 - An unused Android smartphone. In my case we had a Samsung S4 Mini that wasn't being used anymore.

6 - A charger for the cell phone.

7 - A suction cup cell phone holder. I bought one for $12 from Pacific Mall.

8 - A Google Drive Account

Step 2: Setting Up the Camera

On the phone, install the app 'IP Webcam'

In the app, select the following options:

1 - Video Preferences

- Video Resolution - Set to a maximum of 1920x1080 - make note of this value for later

- Photo Resolution - Set to a maximum of 1920x1080

- Main Camera - Primary Camera

2 - Effects

- Enable text overlay

- Overlay format %x %X

3 - Disable notification

4 - Stream on device boot

5 - Start Server

- Make note of url for phone on bottom of screen i.e. This will be needed later

Step 3: Install the Camera

Pick a location to install your phone where it can see the location you want to monitor, and you can plug the phone changer. In my case I installed this in the front window behind the curtains.

Use the suction cup phone holder to hold the phone in the window, and plugin the phone. On your computer, go to the url you recorded on the previous step. You should see the IP Webcam website. From here you can check and see if your phone is pointing the right direction and mirror/flip the display if needed.

Step 4: Configure Your Camera in Homebridge

On your computer running homebridge, install and configure the plugin homebridge-camera-ffmpeg. For instructions on installing the plugin, please see this page

For your config.json, please use this as the settings for the camera, where X.X.X.X is the ip address of your phone/camera. For maxWidth and maxHeight please use the values from earlier.

<p>{<br>  "platform": "Camera-ffmpeg",
  "cameras": [
      "name": "Camera Name",
      "uploader": true,
      "videoConfig": {
      	"source": "-f mjpeg -i http://X.X.X.X:8080/video",</p><p>        "stillImageSource": "-i http://X.X.X.X:8080/shot.jpg",</p><p>      	"maxStreams": 2,
      	"maxWidth": 1920,</p><p>      	"maxHeight": 1080,</p><p>      	"maxFPS": 30,
      	"vcodec": "h264_omx"            

After restarting homebridge, and adding the camera in the Home app you should now be able to see the camera and watch video.

Step 5: Configure Google Drive

This presumes you already have a google account, and have access to google drive already

Step 1: Turn on the Drive API
a. Use this wizard create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.

b. On the Add credentials to your project page, click the Cancel button.

c. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.

d. Select the Credentials tab, click the Create credentials button and select OAuth client ID.

e. Select the application type Other, enter the name "Drive API Quickstart", and click the Create button.

f. Click OK to dismiss the resulting dialog.

g. Click the file_download (Download JSON) button to the right of the client ID.

h. Move this file to your .homebridge and rename it client_secret.json.

Step 2: Authorize your computer to access your Drive Account

a. Change to the directory where the plugin is installed i.e.

cd /usr/lib/node_modules/homebridge-camera-ffmpeg

b. Run the authorization module

node quickstart.js

c. Browse to the provided URL in your web browser.

If you are not already logged into your Google account, you will be prompted to log in. If you are logged into multiple Google accounts, you will be asked to select one account to use for the authorization.

d. Click the Accept button.

e. Copy the code you're given, paste it into the command-line prompt, and press Enter.

Step 6: Install and Setup Your HomeKit Motion Sensor

In my house I have on older X-10 system with a couple of their motion sensors I wasn't using. And I needed to install this in a location where it could watch the front walkway without being too obvious, so I picked a spot in the front garden, and installed it into a bird house I had lying around. It is a little obvious but not too much. It received an okay WAF score. Also my X-10 system was fully integrated into HomeKit with the homebridge-heyu plugin.

To configure the motion sensor into Homekit it won't go into detail on this, as each sensor will have their own instructions, but the motion sensor and the camera both need to be in the same room on the Home app for rich notifications to work.

Step 7: Done

You should now start to receive notifications on you IOS device with a picture whenever the motion sensor is triggered. And if you swipe left on the notification you should be given the opportunity to view a larger picture.

Also if you look in your Google Drive account, you should see a folder called "Camera Pictures" and a picture should be stored with every iOS notification.

Internet of Things Contest 2017

Participated in the
Internet of Things Contest 2017