Automating Velux Blinds with Home Assistant

January 01, 2024

I have two Velux windows in my roof, each with a battery-powered blind, charged by a built-in solar panel. Each blind has its own Velux KL312 remote which has three buttons: blind up, blind down and stop. The remotes can’t be included in Home Assistant without an additional hub because they use the “iohomecontrol” protocol, which is encrypted. My goal is to automate the velux blinds, keeping the remotes usable whilst adding an integration with home assistant. This means that after ‘hacking’ the remote it will be possible to control the blinds with Home Assistant or by pressing the buttons on the remote and the original casing should remain usable.

Luckily the remote has a simple design and others have figured out how to ‘hack’ it and integrate it into Home Assistant. In my case, I’m going to ‘hack’ the remotes using an ESP32 board, running ESPHome integrated with Home Assistant. If you want to integrate Velux blinds into Home Assistant, I’ve outlined my process below.

Here’s the high-level process:

  • Open up the KLI312 remote (this process should also work for other KLI3XX remotes).
  • Find the soldering points and attach wires
  • Flash an ESP32 with ESPHome
  • Add configuration for two blinds
  • Connect the Velux remote to the ESP32
  • Add the ESP32 to Home Assistant
  • Now we have 3 switches per blind (up, down, stop), but this isn’t a ‘cover’ entity.
  • Add a cusom template cover in configuration.yaml to get a ‘cover’ entity in Home Assistant.

Let’s get started:

Open the KLI312 remote and locate soldering pads

Opening up the remote is straight-forward and doesn’t require any tools. A screwdriver will help though. There are two parts to the casing, a back panel and a middle panel. To let the wires pass through, I made a hole in the middle panel and removed the cut-out in the back panel. Once the board is exposed, I recommend marking the pads like I did below to ensure you solder onto the right ones. 

Testing the board

If you’d like to test the pads you’ll need a multimeter. Remove the batteries. Set the multimeter in continuity mode and touch the top left battery pad (silver in the diagram below). With the other probe, touch the other pads on the board. The multimeter will beep when you touch any pads with continuity to ground. It’s also possible to test the up, stop and down pads – although a little finicky. You’ll need to attach one probe of the multimeter on the top left battery pad (ground) and the other on the ‘up’ pad. Press the ‘up’ button on the front of the device and you should hear a beep from the multimeter. You can repeat this for the other two buttons.

Soldering the wires and closing the case

Five wires need to be soldered to the identified pads: +3V, ground, up, down and stop. I soldered the black ground wire and the red +3V wire to the battery pads.  The remaining three wires are soldered onto the small circular pads in the centre of the board. You won’t need batteries for the remotes anymore, they’ll be powered from the ESP32 board.

I recommend routing the wires through the hole at the top of the board and out through the battery compartment (see image below). I used thin wires from an 8-core alarm cable to ensure the case will close again.

Configuring ESPhome to control the Velux blinds

With the wires in place and the case closed, we can now prepare the ESP32 board. Flash the board with ESPHome and adopt it into Home Assistant. Add the configuration as follows:

esphome:
  name: velux-blinds

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "some_key"

ota:
  password: "some_password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Door-Sensors Fallback Hotspot"
    password: "fallback_password"

captive_portal:


#Blinds
switch:

#BLIND ONE
   
  - platform: gpio
    name: "Blind 1 Down"
    id: blind_1_down
    icon: "mdi:window-shutter"
    pin:
      number: GPIO12
      inverted: true
    on_turn_on:
     - delay: 500ms
     - switch.turn_off: blind_1_down
    interlock: [blind_1_up, blind_1_stop]
  
  - platform: gpio
    name: "Blind 1 Up"
    id: blind_1_up
    icon: "mdi:window-shutter-open"
    pin:
      number: GPIO14
      inverted: true
    on_turn_on:
     - delay: 500ms
     - switch.turn_off: blind_1_up
    interlock: [blind_1_down, blind_1_stop]
  
  - platform: gpio
    name: "Blind 1 Stop"
    id: blind_1_stop
    icon: "mdi:window-shutter-settings"
    pin:
      number: GPIO13
      inverted: true
    on_turn_on:
     - delay: 500ms
     - switch.turn_off: blind_1_stop
    interlock: [blind_1_down, blind_1_up]
  

#BLIND TWO

  - platform: gpio
    name: "Blind 2 Down"
    id: blind_2_down
    icon: "mdi:window-shutter"
    pin:
      number: GPIO25
      inverted: true
    on_turn_on:
     - delay: 500ms
     - switch.turn_off: blind_2_down
    interlock: [blind_2_up, blind_2_stop]
  
  - platform: gpio
    name: "Blind 2 Up"
    id: blind_2_up
    icon: "mdi:window-shutter-open"
    pin:
      number: GPIO27
      inverted: true
    on_turn_on:
     - delay: 500ms
     - switch.turn_off: blind_2_up
    interlock: [blind_2_down, blind_2_stop]
  
  - platform: gpio
    name: "Blind 2 Stop"
    id: blind_2_stop
    icon: "mdi:window-shutter-settings"
    pin:
      number: GPIO26
      inverted: true
    on_turn_on:
     - delay: 500ms
     - switch.turn_off: blind_2_stop
    interlock: [blind_2_down, blind_2_up]

The above ESPHome configuration adds switches for two remotes. You can adjust depending on the number of remotes you need to control and the number of GPIO pins you have available. 

Each blind has three switches defined: up, down and stop. The switches are ‘momentary’ switches meaning they don’t stay in the ‘on’ position. Turning the switch on for a moment is all that’s all that is required to trigger the remote and send a signal to the blinds. If you have questions about the configuration, send me an email.

Once the board is configured, connect the wires from your Velux remote to the ESP32 board. If you’re connecting two remotes, don’t forget to connect the +3V from both remotes to the +3V pin on the ESP32. Do the same for both GND wires.

Setting up Velux blinds as a ‘cover’ in Home Assistant

In Home Assistant we now have 3 new switches per blind (up, down, stop). The problem is, home assistant doesn’t know that these 3 switches represent a ‘cover’ entity and we can’t use a single card to show all 3 buttons. 

To solve this, we need to add a template cover by adding the following to the configuration.yaml file.

cover:
  - platform: template
    covers:
       blind_left:
          device_class: blind
          unique_id: "blind_left"
          friendly_name: "Blind Left"
          value_template: ""
          open_cover:
            service: switch.turn_on
            entity_id: switch.blind_1_up
          close_cover:
            service: switch.turn_on
            entity_id: switch.blind_1_down
          stop_cover:
            service: switch.turn_on
            entity_id: switch.blind_1_stop
       blind_right:
          device_class: blind
          unique_id: "blind_right"
          friendly_name: "Blind Right"
          value_template: ""
          open_cover:
            service: switch.turn_on
            entity_id: switch.blind_2_up
          close_cover:
            service: switch.turn_on 
            entity_id: switch.blind_2_down
          stop_cover:
            service: switch.turn_on
            entity_id: switch.blind_2_stop

Restart Home Assistant and you’ll see a new entity called ‘cover.blind’ or similar. Adding this to your dashboard using the tile card, you get three buttons to control the blind. I haven’t figured out how to display a state for the blind yet, so it shows as unknown. It may be possible to create an input_boolean helper and see if I can toggle it when the blinds go up and down. This can then be set as the ‘value_template’ in the above configuration to show a state in the UI, but I haven’t tested this yet. 

If you have two blinds, you can create a ‘group’ helper. This creates a new blind entity that can be used to control both blinds in one go. 

Et voilà 

Now you should have Velux blinds, controllable from Home Assistant. 

The rest is now up to your imagination. Here are a few automation ideas that you might like to try:

  1. Open the blinds at sunrise and close them at sunset
  2. Check temperature in the room during the day. If it gets too hot, close the blinds.
  3. Configure an IKEA remote to control the group of blinds. One remote for multiple blinds. This is cheaper than buying another velux remote and will maintain state in Home Assistant once we figure out how to add it. 
  4. Figure out how to use the up/down and stop buttons to open the blinds to 25%, 50% or 75%.

Sources:

Velux KLI3XX without a gateway, using Shelly Uni

Velux and ESP8266

Lolin S2 and Velux Remote

ESP8266 and KLI310 (in german)

By Chirag

I'm a Product Manager here on products like this. On this site, I share what I know about product management, technology (especially home automation), productivity and travel. I don’t claim to be an expert. Take what I say with a pinch of salt. I hope I can learn from you too. If you find a better way to think about or do something, please let me know!

Related Articles

Buying a 3D printer in 2024: Creality vs Prusa vs BambuLabs

Buying a 3D printer in 2024: Creality vs Prusa vs BambuLabs

I decided to buy a 3D printer to help me finish some projects at home. Buying a 3D printer requires some research, so I'm sharing mine here to help you. Why buy a 3D printer? If you've spoken to me over the past couple of years, you'll know I bought and renovated a...

read more
My top 5 home automation projects

My top 5 home automation projects

I've been automating my house since 2012. I started out with basic home 'automation' which turned the lights on and off at set times. Since I now spend a lot more time at home (thanks COVID!) I've implemented different home automations to help make life at home a...

read more

Like this post? I can email you when I post something new

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *