Blog

Controlling motorized window blinds with HomeKit

April 19, 2021

A cikk magyar változatáért kattints ide.

Those pesky environmental variables 🏡

When we moved into our new apartment, we needed a smart solution that would make HomeKit compatible with the motorized blinds. When we bought the place, the blinds system was already installed, so breaking the walls to add Zigbee switches or Fibaro Roller Shutter modules wasn’t an option.

The challenge was to integrate the 433 MHz radio-controlled system into the HomeKit ecosystem for each blind. I used the Homebridge-Hoobs combo and a Broadlink RM 3 Pro device for this. Before starting the project, I made sure the radio signal could reach all the blinds from every room, as I didn’t want to face connectivity issues due to the distance from the Broadlink device.

In my case, there were six blinds (Bedroom, Study, Terrace, and three Living Room blinds) to control, all powered by the common ”Smarthome” motors used in many homes.

Prerequisites ❕

Before getting into the technical details, how does the factory remote control work for these blinds? Essentially, each remote is programmed with three commands: ”up,” ”down,” and ”stop.” The downside is that if you want to partially open or close a blind, you must manually stop it at the desired position. After the smart integration, however, you can set the blinds to any percentage without manually intervening. You could, for example, ask Siri to open the living room blinds to 32%, and it will do it.

If you’re planning something similar, check whether the blinds use encrypted, frequency-hopping communication. If they do, this solution won’t work. Luckily, mine didn’t, but one of my neighbours ran into this problem.

When I started the project, I bought the newest hardware available: the Broadlink RM 4 Pro, which can learn and replicate infrared and radio signals. It worked great with its own app, but no Homebridge plugin could properly handle the RM4 models due to their encrypted communication, so integrating it into the system would have been an enormous hassle involving Python and CLI setups, which I wanted to avoid.

So, I went with the older RM3 Pro model, which worked seamlessly with the plugin. From what I can see now, the RM4 devices are also supported, but that wasn’t the case about a year ago. Note: the “Mini” models only handle infrared signals, so they won’t work for radio-controlled blinds, even though they look tempting.

Getting started 🤔

So, we have the Broadlink device capable of learning and replicating radio signals (in my case, Broadlink RM3 Pro) and a Hoobs or Homebridge setup. You’ll need to download the appropriate Broadlink plugin. I tried several; some didn’t work or only partially worked. After some trial and error, I found the right one (Hoobs link here, Homebridge/GitHub link here).

Before installing the plugin, set up the Broadlink device with its iOS app to connect it to your Wi-Fi network. After that, you can proceed with installing the Hoobs/Homebridge plugin. Ideally, the plugin should automatically detect the device on your network, and you’ll see a “Scan Frequency” and a “Learn” button in the Default Room of the Home app. These buttons capture and replicate radio signals, which you’ll need for the configuration file.

home app default room thumb

Learning the radio signals 📻

To replicate the radio commands for controlling the blinds using the Broadlink device, we first need to capture these commands (and their corresponding Hex codes). These are the “up,” “down,” and “stop” commands. You also need to know the opening and closing times for each blind in seconds. The system will use this to calculate partial positions, like when the blinds are halfway open. So, get a stopwatch and measure how long each blind fully opens and closes. 😉

Next, open the Hoobs/Homebridge interface, go to the console, and have your phone with the Home app and the first blind remote nearby.

Press the ”Scan Frequency” button in the Home app, then hold down the first button on the blind remote (e.g., “up”) until you see in the console that it has found the frequency and timed out. Release the remote button, press “Learn” in the Home app, and immediately press the same button on the remote once. If the signal capture is successful, a long hexadecimal code will appear in the console after “learned hex:code”. Copy this code into a notepad and label it (e.g., “terrace blind up”). It should look something like this:

thumb hoobs scan learn rf

Repeat this process for all buttons on all remotes. The goal is to capture the Hex codes for all the commands, as you’ll need these for the configuration file.

The configuration file 📝

The plugin documentation provides helpful guidance on structuring the configuration file and detailing all the supported devices. Since we’re dealing with blinds, you’ll focus on the ”window-covering” type. Here is the full guide, and here is the window-covering specific part.

Here’s an example from my own config file. Since I know all the device codes, I’ve hidden the ”Scan Frequency” and ”Learn” buttons. The totalDurationOpen and totalDurationClose values are the times it takes for the blinds to fully open and close (in seconds). The ”open,” ”close,” and ”stop” parameters are filled with the Hex codes captured earlier:

{
    "platform": "BroadlinkRM",
    "hideScanFrequencyButton": true,
    "hideLearnButton": true,
    "hideWelcomeMessage": true,
    "accessories": [
        {
            "name": "Study Blinds",
            "type": "window-covering",
            "totalDurationOpen": 21,
            "totalDurationClose": 21,
            "data": {
                "open": "open-hexa",
                "close": "close-hexa",
                "stop": "stop-hexa"
            }
        },
        {
            "name": "Bedroom Blinds",
            "type": "window-covering",
            "totalDurationOpen": 21,
            "totalDurationClose": 21,
            "data": {
                "open": "open-hexa",
                "close": "close-hexa",
                "stop": "stop-hexa"
            }
        },
        {
            "name": "Balcony Blinds",
            "type": "window-covering",
            "totalDurationOpen": 29,
            "totalDurationClose": 29,
            "data": {
                "open": "open-hexa",
                "close": "close-hexa",
                "stop": "stop-hexa"
            }
        },
        {
            "name": "Living Room Left Blinds",
            "type": "window-covering",
            "totalDurationOpen": 21,
            "totalDurationClose": 21,
            "data": {
                "open": "open-hexa",
                "close": "close-hexa",
                "stop": "stop-hexa"
            }
        },
        {
            "name": "Living Room Center Blinds",
            "type": "window-covering",
            "totalDurationOpen": 22,
            "totalDurationClose": 22,
            "data": {
                "open": "open-hexa",
                "close": "close-hexa",
                "stop": "stop-hexa"
            }
        },
        {
            "name": "Living Room Right Blinds",
            "type": "window-covering",
            "totalDurationOpen": 22,
            "totalDurationClose": 22,
            "data": {
                "open": "open-hexa",
                "close": "close-hexa",
                "stop": "stop-hexa"
            }
        }
    ]
}

Once you’ve saved the configuration, the bridge service will restart on your Hoobs/Homebridge device, and the blinds will appear in the Default Room. Test each command to make sure everything works properly. If the hex codes weren’t captured correctly, you might need to redo the process.

If everything works, you can organize the blinds into their respective rooms in the Home app instead of leaving them in the Default Room.

Now, you can control the blinds manually with Siri, and long-pressing will allow you to set a specific percentage.

thumb home app balcony shades1

thumb home app balcony shades partially open

Potential pitfalls 😣

As mentioned earlier, this solution won’t work if your blinds use encrypted communication or don’t operate on 433 MHz.

Interference in your area might also make it hard to capture radio signals.

Lastly, choose the suitable Broadlink device and plugin, which is crucial for everything to work.

Experiences after 1 year 📅

After nearly a year of using this setup, everything works perfectly. Of course, if you lose internet access, you can’t control the blinds, but otherwise, everything functions smoothly. Automation and Siri commands work great (e.g., “Open the living room shades” or “Close the balcony blinds”). Ensure you measure the opening and closing times accurately, as this affects the system’s ability to control the blinds correctly. You can always tweak the config file if needed.


Írta és kalapálta Kovács Marcell. Facebook   Twitter