I’ve been nerding out. It’s something I just can’t stop sometimes.

Most recently working on making our home more connected and efficient. Part of the effort was experimenting with some Wemos I had purchased off of eBay about a month ago. The Wemo app works alright but there’s definitely more to be desired there. (Plus it makes me cringe to think every Wemo is running DDWRT)

The main problem? Wemo doesn’t support Apple Homekit.

So I got to researching and found the Homebridge project to be just what I was looking for. Basically, it emulates a device that operates on the HAP protocol that Apple supports for Homekit. Within Homebridge, you can configure as many devices via as many different interfaces you could imagine. Deploying it to a Raspberry Pi, or similar, can be troublesome and wrought with errors. So why not take a different approach?

Enter Resin OS.

Some advantages of Resin OS are:

  • Deploying a pre-optimized image for the Yocto platform
  • No configuring of any Linux anything (except for the config.json)
  • Get up and running in a few minutes (mostly flashing and container initialization)

I originally played around with Resin’s online platform which shows some promise. For those developers who don’t want to spend time writing code for OTA updates and building Yocto images manually, you should definitely take a look at Resin.io.

(By the way, I have no affiliation with Resin, I think they’ve done a great job and they’ve contributed to the community significantly with their open source tools: http://resinos.io , https://etcher.io , https://www.balena.io )

So how do I get a Wemo working with Homekit?

Resin themselves have some fantastic documentation. I barely had to look anywhere when error messages came up when developing my first crack at the Docker container. (I was originally using the slim image which does not have all the needed utilities that Homebridge requires, easier to just use the latest image instead)

The instructions are as follows:

Install dependencies. On Mac, Node is the only thing you may need to install. Homebrew works best here.

brew install node

Download and install the resin-cli:

npm install —global —production resin-cli

Download your image from the download link if you haven’t already.

Modify the image to your liking by using the cli.

$ sudo resin local configure ~/Downloads/resin.img
? Network SSID Wolff Den
? Network Key This is not our password.
? Do you want to set advanced settings? Yes
? Device Hostname resin
? Do you want to enable persistent logging? no
Done!

“Flash” the image to an SD card. Make sure you have a free device to write to!

$ sudo resin local flash ~/Downloads/resin.img
Password:
? Select drive (Use arrow keys)
❯ /dev/disk1 (32 GB) - RESIN

Wait for the process to complete and then eject the card. Pop it into the device you’ve configured the image for.

Once booted, you should be able to ping the device.

ping resin.local
PING resin.local (192.168.7.45): 56 data bytes
64 bytes from 192.168.7.45: icmp_seq=0 ttl=64 time=9.004 ms
64 bytes from 192.168.7.45: icmp_seq=1 ttl=64 time=6.411 ms
64 bytes from 192.168.7.45: icmp_seq=2 ttl=64 time=4.337 ms
64 bytes from 192.168.7.45: icmp_seq=3 ttl=64 time=4.374 ms

Modify the config.json file to your liking. Highly suggest changing the pin to something different as this is the one that Homebridge uses in their examples.

Also, feel free to modify the Dockerfile to match your needs. In this example the only thing that you may want to change is the image name. By default I have hummingboard-node:latest as the main image.

You can now push the included Homebridge Docker file and associated files directly to your embedded device.

sudo resin local push resin.local —source .

Note: this will take several minutes as it will be building the docker image on the embedded device. This takes much less time using the Resin.io platform as it builds on your local machine and then sent to the embedded device as a complete image

Wait to see the output from Homebridge indicating it’s running.
rdt push completed successfully!

Streaming application logs..
*** WARNING *** The program ‘node’ uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program ‘node’ called ‘DNSServiceRegister()’ which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
[2017-11-2 02:09:43] Loaded plugin: homebridge-platform-wemo
[2017-11-2 02:09:43] Registering platform ‘homebridge-platform-wemo.BelkinWeMo’
[2017-11-2 02:09:43] —
[2017-11-2 02:09:43] Loaded config.json with 0 accessories and 1 platforms.
[2017-11-2 02:09:43] —
[2017-11-2 02:09:43] Loading 1 platforms…
[2017-11-2 02:09:43] [WeMo Platform] Initializing BelkinWeMo platform…
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ 031-45-154 │
    └────────────┘

[2017-11-2 02:09:43] Homebridge is running on port 51826.
[2017-11-2 02:09:43] [WeMo Platform] Found: Master Den [123456789ABC]
[2017-11-2 02:09:43] [WeMo Platform] Found: Jarchel Den [123456789BAC]
[2017-11-2 02:09:43] [WeMo Platform] Found: Front Door Light [123456789CBA]
[2017-11-2 02:09:44] [WeMo Platform] Jarchel Den - Get state: On

Pop open your phone and look for an available accessory in HomeKit. You will likely have to tap on “Don’t Have a Code or Can’t Scan?” and enter the number manually.

Camera add accessory
Add accessory

Add your accessory by entering the passcode displayed earlier.

Add accessory with code.
Homebridge added success!

Congrats! All your Wemo devices should show up now. Enjoy using Siri with your Wemo devices.

Default screen

Stay up to date with more Resin and Raspberry Pi tips at my site.