Integrate Arduino / ESP8266 + Blynk IoT to iOS with Homebridge and HomeKit

Table of Contents
drapeau france
level advanced

Blynk consists of a server and an application for iOS. If you have your own Blynk private server (read this article to learn how), you can make your connected objects developed using Blynk accessible from the internet without having to expose your hardware to the internet through the Homebridge project. For this you will need an Apple TV (4th generation at least) or an iPad (iOS 8 minimum) to communicate with your objects outside your home. The other advantage of exposing Blynk objects to HomeKit is to have a much better integration with iOS. You can order by voice or view your data from an Apple Watch.

Install Node.js on Raspberry Pi

This tutorial is adapted to Raspbian Pixel. First, make sure that Node.js is not already installed on your distribution. If so, you can proceed to the next step.

pi@raspberrypi:~ $ node -v
Warning. Check the impact on other projects that use Node.js before you start.

If Node.js is not at least version 6.3.1, it is necessary to install it. Start by updating your system

sudo apt-get update
sudo apt-get upgrade

Then install Node.js and its dependencies

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install libavahi-compat-libdnssd-dev

Finally install Homebridge and the homebridge-blynk plugin (GitHub repository page)

sudo npm install -g --unsafe-perm homebridge hap-nodejs node-gyp homebridge-blynk

We will create a directory that will contain the configuration file

mkdir ~/.homebridge

At first we will configure the bridge to make it detectable by iOS. Although this does not seem to be mandatory, I prefer to know the Raspberry Pi’s MAC address. By doing this, iOS immediately discovers the Homebridge Bridge. Run ifconfig  and note the MAC address that corresponds to the connection mode (eth0 in Ethernet, and wlan0 in Wi-Fi).

hombridge domoticz adresse mac rpi hwaddr

Open the configuration file with a text editor

sudo nano ~/.homebridge/config.json

Paste this database (source) by adapting it to your configuration: server IP, HTTPS port, accessories.

    "bridge": {
        "name": "Homebridge",
        "username": "C8:28:EB:14:31:27",
        "port": 51826,
        "pin": "031-45-154"

    "description": "This is an example configuration file. You can use this as a template for creating your own configuration file.",

    "platforms": [
            "platform": "Blynk",
            "name": "Blynk",
            "server": "BLYNK_SERVER_IP",
            "httpsPort": "9443",
            "token" : "yourTOKEN",
            "dashboardName": "Blynk Sensors",
            "accessories": [
                    "name":             "Temperature",
                    "widget":           "TemperatureSensor",
                    "caption":          "Temperature",
                    "pin":              "V0"
                    "name":             "Humidity",
                    "widget":           "HumiditySensor",
                    "caption":          "Humidity",
                    "pin":              "V1"
    "accessories": [

Here, I took again the example presented in this article which made it possible to recover the measurement of temperature and humidity of a probe DHT22. The plugin is documented very briefly. To retrieve measurements, the parameters

  • Name: this name does not seem important. It seems to be just used for the Homebridge newspaper
  • Widget: defines the type of service HomeKit. For example TemperatureSensor for publication of temperature, HumiditySensor for moisture. All types of services supported by HomeKit are defined in the HAP-Node project here. Here is a non-exhaustive list of services managed by HomeKit. By assigning the appropriate service, Maison will be able to display the pictogram and the corresponding unit:
    • AirPurifier
    • AirQualitySensor
    • BatteryService
    • CameraControl
    • CameraRTPStreamManagement
    • CarbonDioxideSensor
    • CarbonMonoxideSensor
    • ContactSensor
    • Door
    • Doorbell
    • Fan
    • FanV2
    • GarageDoorOpener
    • HeaterCooler
    • HumidifierDehumidifier
    • HumiditySensor
    • LeakSensor
    • LightSensor
    • Lightbulb
    • LockManagement
    • Microphone
    • MotionSensor
    • OccupancySensor
    • SecuritySystem
    • Slat
    • SmokeSensor
    • StatefulProgrammableSwitch
    • StatelessProgrammableSwitch
    • TemperatureSensor
    • Thermostat
    • Window
    • WindowCovering
  • Caption: the label that will be displayed in the House application (can be modified directly in House)
  • Pin: the pin on which the information is retrieved or on which Homekit can send a command (for example to light a lamp …).

Save the configuration with CTRLM + X then O. Launch Homebridge

pi@raspberrypi:~ $ homebridge
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <>
[2017-03-09 15:02:29] Loaded plugin: homebridge-blynk
[2017-03-09 15:02:29] Registering platform 'homebridge-blynk.Blynk'
[2017-03-09 15:02:29] ---
[2017-03-09 15:02:29] Loaded config.json with 0 accessories and 1 platforms.
[2017-03-09 15:02:29] ---
[2017-03-09 15:02:29] Loading 1 platforms...
[2017-03-09 15:02:29] [Blynk] Initializing Blynk platform...
[2017-03-09 15:02:29] [Blynk] Loading accessories...
[2017-03-09 15:02:29] [Blynk] Found: Temperature
[2017-03-09 15:02:29] [Blynk] Found: Humidity
[2017-03-09 15:02:29] [Blynk] Initializing platform accessory 'Temperature'...
[2017-03-09 15:02:29] [Blynk] Initializing platform accessory 'Humidity'...
[2017-03-09 15:02:29] Loading 0 accessories...
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
    │ 031-45-154 │     
[2017-03-09 15:02:29] Homebridge is running on port 51826.

Start Home on your iPhone or iPad, click Start

homekit homebridge blynk start configuration

Then add an accessory

homekit homebridge blynk add accessoiry

In order for Home to find the gateway, you must be connected to the same WiFi network.

 homekit homebridge blynk select bridge

Enter the PIN that appears in the Terminal

homekit homebridge blynk enter code

Pairing is in progress

5 homekit homebridge blynk association

It’s over

6 homekit homebridge blynk ready

Home then offers to add devices connected to Homebridge. Here we start with the humidity sensor.

homekit homebridge blynk add humidity sensor

Then temperature

homekit homebridge blynk add temperatureservice sensor

You can now enjoy your Blynk objects within the House application

9 homekit homebridge blynk

Blynk objects are also available from the locked screen

homekit homebridge blynk locked screen

Now, you can follow this tutorial to complete the Homebridge configuration and start it automatically at system startup

Click to rate this post!
[Total: 0 Average: 0]

Thanks for your reading

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
We will be happy to hear your thoughts

Leave a Reply

Read more
DIY Projects
DIY Projects