Controlling LightwaveRF and Nest Thermostat with Siri

LightwaveRF and Nest are currently not supported by Apples HomeKit and could be awhile until this happens. The wait is now over thanks to the HAP NodeJS bridge.

What is the HAP NodeJS Bridge?

The HAP NodeJS Bridge (by Khaos Tian) is basically a way to instantly enable any smart or connected home automation product to be used with Apple Homekit.

The HAP Bridge acts like a Homekit bridge and gives a platform to define each of your devices as an accessory.

homescreenOnce you have the server running you will need a Homekit enabled app installed on your phone.  If you have a Apple Developer licence you can click here for a demo as a start or you can download one of many new Homekit enabled apps from the AppStore (e.g. Eve).

After you’ve installed and configured the app, you can start using Siri to control your home. Commands include:

  • Siri, turn on the living room lights
  • Siri, set the temperature to 20 degrees

If your phone is plugged in for charging you don’t even need to touch your phone to control your devices, just say your command after “Hey Siri!”

How do you install and configure the HAP NodeJS Bridge?

The perquisite to installing the HAP bridge is that the systems needs to have NodeJS (atleast verision 0.12).  The installation and launch details of the HAP Bridge can be found here: and can be installed using the git clone command:

git clone

The app configuration

Now that the server is running, let’s move on to the app. The demo app mentioned above is fairly simple to use. To link the app to the bridge simply click on add accessory and the bridge should be listed. Select the listed bridge and it will prompt for the code, the code can be found in the Bridge_Info.js (default is 031-45-154) file in the accessories folder. When that’s successful you will see the demo accessories.

You can now actually test Siri using the demo accessories!

Configuring the accessories 

Nearly any smart/home automation accessory can be configured to work with this Homekit bridge. All you need to do is define an accessory file for each device.  The accessory file defines the accessory and includes the actions possible, they are defined using object literal notification.

As I use Domoticz as my home automation platform, I’ve configured accessories based on that. I could have written a script that automatically grabs the devices from Domoticz and creates an accessory for each one, but I didn’t want to pollute my Homekit bridge with accessories which I won’t be controlling with Siri.

As most of my accessories will have common commands (e.g. Light on/off), I’ve created a shared class which will contain common actions.

Below is a snippet of the for Domoticz helper class (full class is here)

exports.switchAction = function (idx, action){
   var post_options = 
     host: '',
     port: '8089',
     path: '/json.htm?type=command&param=switchlight&idx='+idx+'&switchcmd='+action,
     method: 'GET',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Content-Length': post_data.length

exports.switchBrightness = function (idx, level){
 //32 = 100%
 var dimlevel = level / 3.125;
 var post_options = 
    host: '',
    port: '8089',
    path: '/json.htm?type=command&param=switchlight&idx='+idx+'&switchcmd=Set%20Level&level='+dimlevel,
    method: 'GET',
     'Content-Type': 'application/x-www-form-urlencoded',
     'Content-Length': post_data.length

Once the helper class was created, I then create accessories for each of the devices I wanted to control.  Click here for an example of the accessory definition.  As Domoticz now supports Nest, I’ve also created a accessory for my Nest thermostat, which enables me to use Siri to change the temperature.

Home Kit App

Once all the accessories (e.g. LightwaveRF swtiches and Nest etc..) are defined, if they will appear in the HomeKit app.

The accessories then can be assigned to Rooms, Zones and Trigger and Actions be created.  By doing this you can tell Siri to turn on lights for particular rooms or zones.

Keeping the service running

To ensure that the HomeKit server is running all the time, I used a tool called Forever.  Forever is a simple CLI tool for ensuring that a given script runs continuously.

Forever can be used using the following command:

forever start BridgedCore.js

Now you’re ready to use Siri to control your smart home…



The Initial Setup

There are a number of ways to control your home. You could use the LightwaveRF WIFI unit or go down the custom route.

I decided to go down the custom route.  This post will describe my setup.

What’s in your setup?

Currently my setup consists of two hardware components (apart from the light switches and sensors); a Raspberry Pi and the RFXCOM RFXtrx433.

As I went down the custom route I needed a computer which would be left on 24/7 as it will IMG_1752be the “brains” of the smart home. For this I opted to use the Raspberry Pi (B+ model).  The reason behind this decision is that the Pi is small, doesn’t use a lot of power and very quite as no fans are needed.  Another reason for opting for the Pi is that they have GPIO pins which give the flexibility to connect components directly to the Pi.  For example to integrate with my house alarm system.

My Raspberry Pi is used for two purposes; one for XBMC (Raspbmc/Kodi) and the other for home automation.  To date I’ve not experienced any performance issues, the future plan is to have one Pi dedicated for home automation and the other for XBMC.

And of course my setup consists of LightwaveRF switches, LightwaveRF relays, HomeEasy PIR and a Byron Doorbell.  I’ve also got a setup to interface with my existing house alarm. I will post about that particular setup at later stage.

How’s it all connected?

The setup between the Raspberry Pi and the RFXtrx433 is pretty much plug and play.  The lighting components are linked to the Raspberry Pi wirelessly via the  RFXtrx433.

What software do you run?

After much deliberation between custom software and open source platform, I decided to go with the open source platform option and use Domoticz.

Domoticz is a open source Home Automation System, that lets you configure and bring together smartIMG_2755 devices from different manufacturers.  Main features include the ability to create custom events, automated smart timers and flexibility with custom scripts.  As the platform has a HTML5  front end, it is automatically scaled for different devices.

Setting up Domoticz on the Raspbery Pi is pretty simple. The steps can be found here

Once you have the software running you simply access the platform through any browser (http://raspberry PI IP :8080).  From the browser you can add new components to your setup.  Its very simple to setup, for example to add a new LightwaveRF switch, you click on “Manual Light/Switch”, Select RFXtrx433 as the hardware, Type as LightwaveRF and give it an ID. Once this is done you put your switch in to learning mode.  To do this on the dimmer switches press and hold down both the ‘ON’ AND ‘OFF’ buttons until the blue and amber LEDs ash alternately. The dimmer switch is now in learning mode.  Once its in learning mode, click your light switch button in domoticz, the blue light on the dimmer will flash to confirm the pairing.

So that’s it, once you have added your switches, you can now access them from any web browser on any device.

One downside to going down the custom route is that you need to consider service up time. By this I mean you ideally want the server to start up again if it crashes. For this I used Watchdog. Watchdog is a applications that knows when your raspberry is down, and will automatically reboot it in case this happens.  This can be configured to send you emails when a crash occurs.  Click here for more information.

How do you access the platform remotely?

In order to access the platform remotely, port fowarding needs to be setup on your router.  This is a pretty straightforward task. You can use to test if your port forwarding works.  Once this is setup, you access the platform using your IP address and the port of the domoticz server.

Domoticz has built in security to stop unauthorised access. There are two options, the first is using a username and password and the second is done using certificates. This under the System tab in the Setup menu.

To wrap up…

So that’s it, this is my setup.  Please get in touch if you have any questions.

In future posts I’ll go in to details of the mobile apps which I’ve tried, how I’ve intergrated my house alarm (using GPIO Pins), my door bell setup, geofencing, push notifications and other tech which I’ve added to my home automation system.