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

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.

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

Then install Node.js and its dependencies

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

We will create a directory that will contain the configuration file

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

Paste this database (source) by adapting it to your configuration: server IP, HTTPS port, 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

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

It’s over

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

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

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.


DIY Projects