Objective
After the last toss, this attempt to connect Domoticz to Apple's HomeKit, that is, in the IPhone Siri can voice control. Reference official documentation
Steps
Installing Nodejs
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -sudo apt-get install nodejs -y
Install PM2 after installation is complete
sudo npm install -g pm2
Installing MDNS
sudo apt-get install libavahi-compat-libdnssd-dev
Before installing Homebridge, you need to install two dependent packages Hap-nodejs and Hap-nodejs
sudo npm install -g node-gypsudo npm install -g hap-nodejs
An error occurred while installing Hap-nodejs
user "root" does not have permission to access the dev dir "/usr/lib/node_modules/hap-nodejs/node_modules/curve25519-n/.node-gyp/8.11.4"
Fix problems after reinstalling
cd /usr/lib/node_modules/hap-nodejs/node_modules/curve25519-nsudo node-gyp BUILDTYPE=Release rebuildsudo npm install -g hap-nodejs
The next step is to install Homebridge
sudo npm install -g --unsafe-perm homebridge
Installing the Homebridge Domoticz plugin
sudo npm install -g homebridge-edomoticz
Before configuring, add room area in Domoticz, point settings → more options → floor plan/area diagram → room area, such as add a "living room", add the completion of the living room after the IDX is 2
Select "Living room", add two switch devices
Run Homebridge, will prompt "Config.json (/home/pi/.homebridge/config.json) not found", so go to/home/pi/.homebridge, add config file
cd /home/pi/.homebridgevim.tiny config.json
The contents are as follows, where Bridge's username is to be changed to the physical address of the Raspberry Pi, ifconfig can be viewed, and platforms's roomid changed to the same as the IDX in the living room.
{ "bridge": { "name": "Homebridge", "username": "CC:21:3E:E4:DE:33", "port": 51826, "pin": "031-45-154" }, "description": "Configuration file for (e)xtended Domoticz platform.", "platforms": [ { "platform": "eDomoticz", "name": "eDomoticz", "server": "127.0.0.1", "port": "8080", "ssl": 0, "roomid": 2, "mqtt": 1 } ], "accessories": []}
Add Homebridge to boot with PM2
pm2 start homebridgepm2 savepm2 startupsudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
Run Homebridge, there is a QR code and a code set in the configuration file, open the home in the IPhone, select Add Accessory, you can see the device has been identified
The pairing is successful after manually entering the code, and the two switches that were previously configured will appear in the step down
The switch has already appeared in "Home", can be controlled manually or long press the home button to call out Siri for voice control
Something
I have to say that Domoticz is really plug-in and full-featured, Siri Access makes Domoticz smarter and more convenient
Domoticz access to Apple's HomeKit for Siri control