Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

How to: Raspberry Pi Home Security Camera System

PREFACE

In the eighth article of this series, I use raspberry pi and security cameras to build a monitoring system. Normal installation method just can’t meet my strong desire to explore. I decided to make security monitoring access the HomeKit, to get a unified management with other intelligent devices in the home on my iPhone. I have also written about how to install the Hass.io system and the Home-bridge plug-in using the Raspberry Pi to connect with the MI smart hardware. However, when accessing security monitoring, I found out that the existing system had a serious problem that the “Home-bridge-camera-ffmpeg” plug-in was unable to be installed. After consulting a few geeks, I finally got the solution — The system is poor.  I only had to begin again.

As you will see in this article:

1. The whole process of installing HASSbian system for Raspberry Pi.

2. Home-bridge plug-in installation skills.

3. Home-bridge connects MI smart devices.

4. Setup tutorial of how the ezviz X5C connects to the HomeKit.

Easy is the beginning of trouble.

How to: Raspberry Pi Home Security Camera System

I have seen the simple steps of installing Hass.io and I didn’t think this all-graphic type of operation was hard for my level until I entered the SSH interface. It’s quite different from the tutorial! I try to type “sudo NPM install -g homebridge-camera-ffmpeg” to install plugin, it is useless! I have consulted from lots of digital master; they can do nothing but highly recommended to replace the Hass.io into HASSbian system with integrated Hass controls. Since there is no way out, I decide to reinstall it.

Install the system from the beginning.

Step 1:  Remove the 16GB TF card from the Raspberry Pi, remove all partitions and format them.

Step 2:  Download the latest version of HASSbian and burn it into the TF card by using Etcher software.

How to: Raspberry Pi Home Security Camera System

Step 3: insert the TF card into the Raspberry Pi and connect the power supply. In my previous experience, you have to wait for a long period which is enough to watch an episode of drama. If you’re worried about if the Raspberry Pi is working, turn on the Router’s management interface to see how the network traffic works. It’s still working if there is volatility.

Step 4:  Enter http:// Rasberrypi.com in Chorme and the IP address is 8123. You can see the Web management page of the system just as Hass. io system. The difference is there isn’t “Hass.io” button on the right side of the menu. This button is supposed to be used for graphical plug-in installation, this illustrates that the HASSbian system plug-in is done through the command line.

See also  Don't Miss Your kids New Season Fashion: Gymboree Kids Clothing Wholesale

How to: Raspberry Pi Home Security Camera System

Step 5:  The HASSbian system has native SSH, and the MAC system can access directly with the “terminal”. The command is “SSH PI @ raspberry PI IP-address”, and the default password is “raspberry”.

Step 6: Type “sudo apt-get update” instruction and upgrade the system.

Install the SMB Shared disk.

Step 1:  Type the “sudo hassbian-config install samba” to install the SMB plug-in.

How to: Raspberry Pi Home Security Camera System

Step 2:  Type “sudo smbpasswd-a PI” to set access password.

Step 3:  Open the network in the Finder, and the instructions are set correctly if there is “HASSbian” in it

Install and configure Home-bridge

STEP 1:  INSTALL NODEJS

Input “curl – sL https://deb.nodesource.com/setup_8.x | sudo bash – E -“. Press “enter”, wait for the instruction execution is completed. Then input “sudo apt – get the install – y nodejs” . Press “enter”.

STEP 2: INSTALL Avahi

Input “sudo apt-get install libavahi-compat-libdnssd-dev”. Press “enter”.

STEP 3: INSTALL Home-Bridge

Input “sudo npm install -g –unsafe-perm homebridge”. Press “enter”.

STEP 4: RUN HomeBridge

Input “HomeBridge”. Press “enter”. At this point, if the interface shows as above pic, the installation of HomeBridge is successful.

Step 5: SET UP STARTING UP

Input “CD /etc/default”. Press “enter”. After enter the path, input “sudo nano homebridge”. Press “enter” to enter the editor, post “HOMEBRIDGE_OPTS= /home/ PI /.homebridge”. Run “Ctrl +X, Y,” then press “enter” to return.

Input “cd /etc/systemd/system” Then press “enter” to enter the path. Put in “sudo nano homebridge.service” Press “enter”to enter editor.

Post ”[Unit] Description=Node.js HomeKit Server

After=syslog.target network-online.target

[Service]

Type=simple

User=pi

EnvironmentFile=/etc/default/homebridge

ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS

Restart=on-failure

RestartSec=10

KillMode=process

[Install]

WantedBy=multi-user.target

Ctrl+X,Y” Press “enter” to exit.

Input “cd /””enter”、“sudo systemctl daemon-reload” Press the “enter”.“sudo systemctl enable homebridge”、“sudo systemctl start homebridge” Press the “enter”、“sudo systemctl status homebridge” Press the “enter”.

HomeBridge connects with MI smart devices.

In the previous article, I mentioned that I connected MI smart device with HomeAssistant and make HomeKit control through HomeBridge. Today I am gonna show a more direct way that to get MI smart devices direct docking HomeBridge to achieve HomeKit control.

See also  #unboxing&review: Guess what? I can’t stop buying Pandora!

STEP 1: INSTALL MI PLUG-IN

Input “sudo npm install -g homebridge-mi-aqara”. Press “enter”.

STEP 2: EDIT CONFIGURATION FILE

Input “cd ~/.homebridge”. Press “enter” into the menu. Then input “nano config.json” Press “enter” to enter the editor.

Post

{

“bridge”: {

“name”:”Homebridge”,

“username”:”11:11:11:11:11:11″,

“port”:51826,

“pin”:”111-11-123″

},

“platforms”: [{

“platform”:”MiAqaraPlatform”,

“gateways”: {

“xxx”:”yyyyy”

}

}]

}

The value behind “name” can be made up according to your preference, and so does the value after “username”. Please note that the range of characters is of a-f and 0-9. “XXX” is replaced by the MAC address of the MI smart hardware, and “yyyyy” is replaced with the communication protocol password.It is important to note that the above is the configuration code for the new version of HomeBridge-MI-Aqara. Currently, the code in many tutorials on Baidu is an old version and cannot be used!

How to get the “sid” and “password”?

Enter the Settings page of the website, click “about”, and hit in the blank space.

“Sid” is in the “gateway information” page, “password” is in the LAN communication protocol.

Next, open the “family” APP in the iPhone, scan the QR code generated in the “HomeBridge” command, and click several next steps to add the  MI gateway along with the associated device.


Connect ezviz monitoring device to HomeKit.

In the previous security monitoring update, I had planned to connect with Homekit in the future, so I bought a series of ezviz products that were billed to have a slightly simpler operation. The principle is to use its own RTSP protocol to realize the transmission of video stream. It is very interesting for you guys to explore that if other monitoring of similar RTSP protocol use can perform such operations.

STEP 1: SET MANAGING ACCOUNT ON WEBSITE.

Open the old version of the ezviz PC software. It must be the old version, the new version is unavailable. My version number is “2.2.4”. Click “equipment management” on the lower left corner, and find X5C in the pop-up window, then click the “advanced configuration”

In the pop-up menu, click “user”, next click “add”, and fill in the password, IP address, and MAC address of X5C in the new menu. Then click “apply”. It is important to say that the IP address of X5C must be set to static IP, which cannot be automatically obtained by DHCP, otherwise the IP will be reconfigured.

See also  How to Choose Casual Shoes for Men: Suitable Shoes Can Perfect the Way You Walk

STEP 2:  ADD HOME-BRIDGE INSTALL CONFIGURATION FILE

Use the “terminal” of the MAC system to enter SSH again. Input “sudo NPM install -g homebridge-camera-ffmpeg” instruction to install the plug-in.

Fill in the following code when you enter “config.json” configuration file again:

“platform”: “Camera-ffmpeg”,

“cameras”: [{

“name”: “NVR”,

“videoConfig”: {

“source”: “-rtsp_transport tcp -re -i rtsp://username:password@IPaddress:554/MPEG-4/ch1/main/av_stream”,

“maxStreams”: 2,

“maxWidth”: 1280,

“maxHeight”: 720,

“maxFPS”: 30

}

}]

The “username” and “password” are the same with first step setting on PC software. “IP address” is the static address of the X5C.

STEP 3:  ADD HOME-ASSISTANT INSTALL CONFIGURATION FILE

Open the HASSbian Shared disk in the Finder network, and in the HomeAssistant directory you will see the configuration. Open configuration file with notepad and add the following code:

camera:

– platform: ffmpeg

ffmpeg_bin: /usr/bin/ffmpeg

name: NVR

input: -rtsp_transport tcp -i rtsp://username:password@IP address:554/MPEG-4/ch1/main/av_stream

extra_arguments: -pred 1 -q:v 2

The “username” and “password” are the same with first step setting on PC software. “IP address” is the static address of the X5C.

Restart the Raspberry Pi, you can find the Windows of video in the “family” APP on your phone. But the real effect was disappointing, the lagging was so evident and the experience feeling is just so bad. What can I say? It is always better in dream than reality.

LAST

The HASSbian system was a little harder to install than Hass.io. However, when installing a plug-in, the code execution step is relatively straightforward and quick, and more easily to resolved the errors which are more evident. Although the graphics interface of Hass.io looks relatively simple, but it often stops for a long time when installing the plug-in. It is also unclear whether the source file has been blocked or the installation is in conflict. Therefore, if you guys want a relatively stable system in the future, I strongly recommend installing the HASSbian system.

IF YOU LOVE IT, PLEASE FOLLOW AND THUMB UP.

Author: kiday612

Source: smzdm.com

More Review about  Raspberry Pi on Our Site:

Unfold the mystery of Raspberry Pi