Control FHEM with Siri

Apple has recently introduced their HomeKit framework to allow control of home automation appliances with Siri. Unfortunately only very few devices are supported right now. Fortunately Alex Skalozub has reverse engineered the HomeKit protocol and KhaosT has built a HomeKit Accessory Server HAP-NodeJS from it. Nick Farina has then built the homebridge server upon it which can be used to bridge a plethora of devices to HomeKit, such as Phillip’s Hues, Sono’s speakers etc. Andre has contributed a FHEM shim to homebridge, enabling many FHEM devices to be controllable via HomeKit and thus Siri. Here are some hints how to get it working:

and edit config.json such that your FHEM platform is correctly defined.

On the FHEM side, only the genericDeviceTypes switch, outlet, light, blind, speaker, thermostat have to be added to the global user attributes list:

Don’t just overwrite the global user attributes list, append at the end. Then start the homebridge server for the first time:

To run homebridge as a service and start it with the system, install this service file:

Description=Start homebridge server

into /etc/systemd/system/homebridge.service . You can download a template with wget and adapt your username:

Then enable & start the service in systemctl:

Check if it is running correctly:

Now install the Elgato Eve app on your iDevice. If homebridge is running correctly, the accessories defined there should be visible in the Eve app. The default pin code for all HomeBridge accessories is 03145154. If you have to delete some device, you will manually have to remove the corresponding file in ~/homebridge/persist. To figure out which file to remove, have a look at the debug http server http://yourip:8080/persist.

Now you can finally order Siri to turn on the TV light. Here is a list of possible commands from Apple’s website

„Turn on the lights“ or „Turn off the lights.“
„Dim the lights“ or „Set the brightness to 50%.“
„Set the temperature to 68 degrees.“
„Turn on the coffee maker.“

If you set up homes, zones, rooms, or scenes, you can use also commands like this:

„Turn on the upstairs lights.“
„Turn off Chloe’s light.“
„Turn down the kitchen lights“
„Dim the lights in the dining room to 50%.“
„Make the living room lights the brightest.“
„Set the Tahoe house to 72 degrees.“
„Set the thermostat downstairs to 70.“
„Turn on the printer in the office.“
„Set up for a party, Siri.“
„Set the dinner scene.“
„Set my bedtime scene.“

Or their German counterparts:

„Schalte das Licht ein.“ oder „Schalte das Licht aus.“
„Dimme das Licht.“ oder „Dimme das Licht auf 50 %.“
„Stelle die Temperatur auf 20 °C ein.“
„Schalte die Kaffeemaschine ein.“

Mit Befehlen wie den folgenden können Sie Einstellungen für Wohnbereiche, Zimmer oder Umgebungen zusammenfassen:

„Schalte alle Lampen im Obergeschoss ein.“
„Schalte Chloes Licht aus.“
„Dimme das Licht in der Küche.“
„Dimme das Licht im Esszimmer auf 50 %.“
„Stelle das Licht in der Küche am hellsten ein.“
„Stelle die Temperatur im Tahoe-Haus auf 22 °C ein.“
„Stelle das Thermostat im Erdgeschoss auf 21 °C ein.
„Schalte den Drucker im Büro ein.“
„Siri, bereite alles für eine Party vor.“
„Bereite das Ambiente fürs Abendessen vor.“
„Aktiviere den Nachtruhemodus.“