Skip to main content

HomeKit and Siri

With HomeKit integration, you will be able to control your IoT projects from your iOS or macOS device. After you have your device in your Home app, you can control it using Siri.

info

At the end of the article, you will ask Siri for the temperature in your bedroom and she will tell you back the temperature from your HARDWARIO temperature sensor!

Installation

If you want to use the following integration on HARDWARIO Hub or Debian and Ubuntu system, you have to install few dependencies. Connect to the command line of HARDWARIO Hub and use the article Raspberry Pi Login.

After you login in, copy, paste and run the following commands.

sudo apt-get updatesudo apt-get install libavahi-compat-libdnssd-dev

Open HARDWARIO Hub in your Browser (Linux and macOS can use hub.local, on Windows you have to use the IP address of HARDWARIO Hub). In the menu select functions and in the top right corner click on the hamburger menu. Click on manage palette and select Install card, where search:

node-red-contrib-homekit-bridged

info

When a message with the title Installing 'node-red-contrib-homekit-bridged' pops up, just click Install. After Installation, you should see module in the advanced group.

Connect Hardware

Flash Firmware

Pair the Device

Open HARDWARIO Hub page in the browser, same as in the chapter Installation and select the Devices tab in the side menu and click on Start pairing button.

Assemble the Device

Now unplug the Core Module from the computer and connect it to the Battery Module.

Test

You should see the device now (it should be paired). You can look at the Messages tab and see that the temperature messages are incoming now.

Connect it all together

Open the Functions tab in the side menu. Open the Hamburger menu, select Import > Clipboard and paste the following code

    [{"id":"c10a49.8c0905b8","type":"mqtt in","z":"2c41a2bd.aa36ae","name":"Temperature from Core Module","topic":"node/push-button:0/thermometer/0:1/temperature","qos":"2","broker":"29fba84a.b2af58","x":230,"y":180,"wires":[["d7033322.3f2d5"]]},{"id":"d7033322.3f2d5","type":"template","z":"2c41a2bd.aa36ae","name":"Convert payload to HomeKit JSON format","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n\"CurrentTemperature\": \"{{payload}}\"\n}","output":"str","x":600,"y":180,"wires":[[]]},{"id":"29fba84a.b2af58","type":"mqtt-broker","z":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]
info

The imported flow should look like the following

Place the Homekit node from the advanced group and connect it to the template node in the flow

Double-click on the HomeKit node in flow the settings window should popup

Setup the Bridge

info

This will be the Bridge between our Hardware sensors and your iPhones, iPads, macs, etc.

Click on the little pencil icon next to the bridge part of the setting and fill it as follows and click Add

Fill in the rest of the settings according to the screenshot below. Click Done and then Deploy

Pairing

Now as you can see on your screen and screenshot below. The device is waiting for pairing with code 111-11-111. Open the Home app on your iPhone or iPad and click Add Accessory > Don't Have a Code or Can't Scan > HARDWRIO bridge. Select Add anyway on the next screen. On the screen where you have to input code, input the number 1 to all boxes

Setup

Now just setup where is your bridge and temperature sensor.

Siri

info

If you have some device in the Home app, you can control it or get information from it via Siri.

So if you want to get the temperature from Core Module which we just set up, just ask Siri for example: "what's the temperature in the bedroom?".

Conclusion

With the HomeKit plugin, you can simulate real HomeKit devices. This plugin can also control things. So you can use it to control the Relay Module, etc.

caution

This plugin has a little issue. Every time, you Deploy flow, you have to reset all Node-RED, or the HomeKit plugin won't work.

You can do it by following the command (you have to do it on HARDWARIO hub if the plugin is installed there):

pm2 restart node-red