Gearbest super deals

How to make YeeLight smart bulb compatible with HomeKit by Raspberry Pi and HomeBridge

ByAdan Flannigan 2019-07-20 5449

Each time you need to open a specific App to switch the Smart Strip Light, and it can not be used after the network is disconnected. The most deadly point is that the official App Widget often hangs, resulting in discomfort of the experience. This may be the easiest guide on HomeKit connection.

make YeeLight smart bulb compatible with HomeKit by Raspberry Pi and HomeBridge 

Hardware to be prepared

The following is the hardware used when the landlord toss, can be changed according to individual needs.

● Raspberry Pi 3 generation B type and related minimum system (including Micor SD card, power supply, etc.)

● MacBook Pro computer (Windows PC, Ubuntu, Linux)

● YeeLight Smart Light Bulb  

● A network cable

Of course, if you have a router with enough ROM space, you can choose to install HomeBridge on the router. The specific tutorial can be pulled to the bottom of the page, click the link.

The following tutorial is based on the MacBook Pro running macOS Sierra and Raspbian Jessie's Raspberry Pi.  

Step 1 : Install the system and log in to the Raspberry Pi

After getting the Raspberry Pi, connect the power and network cable, insert the system's Micro SD card into the Raspberry Pi, and install the system for the Raspberry Pi. I chose Raspbian Jessie from the official website because other systems may need to install additional plugins.

The specific installation tutorial can refer to the network, the method is to write the downloaded Raspbian system image directly into the SD card in Win32 Disk Imager, even the formatting is not needed, one button is painless. After writing, insert the Raspberry Pi and plug it in to power it up.

Before starting the installation related plug-ins, not because of GFW of the network, Raspberry Pi download speed will be very slow. Recommended that open SS and select the US server and global agent.

After the installation is complete, connect the Raspberry Pi and router with a network cable, open the terminal of the computer, and log in to the Raspberry Pi with ssh.

Ssh pi@raspberrypi.local or Ssh pi@XXXX

XXXX is the IP address of the Raspberry Pi, which can be viewed on the running page of the router. After that, the terminal will ask for a password and enter raspberry to enter. The terminal on the way to enter the password will not display any characters, just enter it normally.

Step 2: Update Raspberry Pi software source

After logging in to the Raspberry Pi, first upgrade the software source, enter the following code in the terminal, and wait for a while.

Sudo apt-get update

Sudo apt-get upgrade

Step 3: Open Yeelight's Geek mode

Taking advantage of the updated software source, we download the official Yeelight app from the App Store, connect the light bulb first, then click the three bars in the upper right corner to open the geek mode below.

Step 4: Install Node.js

Going back to the terminal, we continue to install Node.js. Starting with version 4.0.0, Node.js supports ARM-based platforms by default, and we only need to enter the relevant code.

Enter the following commands in the terminal in turn:


Tar -xvf node-v4.3.2-linux-armv6l.tar.gz

Cd node-v4.3.2-linux-armv6l

Sudo cp -R * /usr/local/

After you finish, type   Node -v   Check if the installation is complete, if it is displayed   V4.3.2   , indicating that Node.js is installed successfully.

Step 5: Install Avahi and related dependencies

Enter the following command at the terminal:

Sudo apt-get install libavahi-compat-libdnssd-dev

Step 6: Install HomeBridge and related dependency packages

Enter the following commands in the terminal in turn:

Sudo npm install -g --unsafe-perm homebridge hap-nodejs node-gyp

Cd /usr/local/lib/node_modules/homebridge/

Sudo npm install --unsafe-perm bignum

Cd /usr/local/lib/node_modules/hap-nodejs/node_modules/mdns

Sudo node-gyp BUILDTYPE=Release rebuild

Step 7: Add a Yeelight profile

Enter the following command:

Sudo npm install -g homebridge-yeelight

Wait for the command to finish running, enter

Cd /home/pi/.homebridge/

Vi config.json

Click the i key on the keyboard and the -- INSERT -- appears in the lower left corner of the terminal, as shown below.

 make YeeLight smart bulb compatible with HomeKit by Raspberry Pi and HomeBridge

Copy the following code to the terminal:

{"bridge": {"name": "YeeBridge","username": "18:00:27:40:BC:1B","port": 51825,"pin": "031-45-154"},"platforms": [{"platform" : "yeelight","name" : "yeelight"}]}

After the paste is complete, press the Esc key, type: wq (the colon cannot be less, and it is an English character) and press Enter.

make YeeLight smart bulb compatible with HomeKit by Raspberry Pi and HomeBridge 

After that, you can run HomeBridge:


After this step is completed, HomeBridge is installed and running, YeeLight is also successfully connected to Apple HomeKit, open the home app that comes with iOS 10, click to add accessories. There will be two accessories, the first one is YeeBridge, which is a bridge; the other is the light bulb we want to control.

Now, you can enjoy "Hey Siri, help me drive a light".

Step 8: Automatically run the HomeBridge service after the Raspberry Pi starts

But is our tossing finished? No, it’s far from finished. If you turn off the terminal now, you will find that HomeBridge is down. We can't have a terminal on the computer to keep the Raspberry Pi running the service, so there is a final step to add the HomeBridge service to the Raspberry Pi system service.

● First we have to open the root account, first enter it in the terminal:

Sudo   Passwd   Root

● You will then be prompted to set the password for the root account, which will be confirmed once after the first input. There will be no characters displayed for the same two inputs. Once the entry is complete, enable the root account and enter the following command:

Sudo   Passwd   --unlock   Root

● Then you will be prompted with an error: passwd:   Password   Expiry   Information   Changed. The reason is that the new version of the system disables ssh login to the root account by default. We need to modify the configuration file. Enter the following command at the terminal:

Sudo   Nano   /etc/ssh/sshd_config

● Search for "PermitRootLogin" with Ctrl + W, then change PermitRootLogin without-password to PermitRootLogin yes , then press Ctrl + O to save and press Enter to exit the editor.

● GitHub provides three ways to get the HomeBridge service to run automatically after the Raspberry Pi starts. I chose the way init.d. turn on This page Download the file locally, then rename the template to homebridge (or whatever name you want) and put it in the raspberry pie directory /etc/init.d. Note that you must use the root account here, otherwise you will be prompted for no permissions. Since I don't code and program, I use WinSCP to log in to the root account, and the little ones who are familiar with the code can use the code to operate.

● Then right click on the Text Editor to open it and change the opening characters as follows:



# Provides: homebridge

# Required-Start: $network $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Start daemon at boot time

# Description: Enable service provided by daemon.



Cmd="DEBUG=* /usr/local/bin/homebridge"


Save when you're done, then go back to the terminal and enter the following code in order:

Sudo chmod 755 /etc/init.d/homebridge

Sudo update-rc.d homebridge defaults

Now, you can type HomeBridge in the terminal, wait for the service to run, then turn off the terminal to see if you can continue to use the Home App to turn on the light bulb; or restart the Raspberry Pi to see if the HomeBridge service is working.

If all of the above are successful, congratulations, everything is done.

make YeeLight smart bulb compatible with HomeKit by Raspberry Pi and HomeBridge 

 You may also want to read:
 How to solve the weather update problem of Xiaomi Mi band 4?
 How to install Xiaomi M365 electric scooter firmware mod?
 Xiaomi Mi A3 specs, release date, design and all we know before its presentation

Gearbest mobile phone clearance sale

Extensive Product Selection

● Over 300,000 products

● 20 different categories

● 15 local warehosues

● Multiple top brands

Convenient Payment

● Global payment options: Visa, MasterCard, American Express

● PayPal, Western Union and bank transfer are accepted

● Boleto Bancario via Ebanx (for Brazil)

Prompt Shipping

● Unregistered air mail

● Registered air mail

● Priority line

● Expedited shipping

Dedicated After-sales Service

● 45 day money back guarantee

● 365 day free repair warranty

● 7 day Dead on Arrival guarantee (DOA)

You might also like


Related Products