Controlling an Velux Window via IR with ESPHome

Inspired by Jpsy`s Thread about “Faking an IR control using ESPHome” Link I started thinking about how to integrate my MJ2006 Velux Roofwindow GGL S06 integra which is equipped with an electrical Motor to open/close the window ans also has an electrical Sunblind.
The Window is controlled by an IR Remote ( Velux WLR 100 50 02 ) which you can no longer buy today and also I wanted to open/close the Sunblind.

So here is the BOM I needed for this project:

  • 1 D1 mini ESP8266 CH340 Ali
  • 1 IR transmitter Ali
  • 1 IR receiver Ali
  • 1 Power supply E*ay

Like @Jpsy wrote in his instruction, the IR Receiver is only needed to read and learn the IR Codes from the original Remote.

After that was done you can disconnect it and keep it for the next Project. :slight_smile:

The transmitter is connected to the ESP like this:

ESP – IR transmitter

D7 – DAT
5V – VCC
GND – GND

It took me a while to figure out which commands I have to replicate for the signals comming from the Remote, but here is the completed .yaml File for this intergration into HomeAssistant.
First I was trying with “pronto code” which didn’t work and after reading a lot I found out that I had to change to raw data.

Here’s my working yaml code

esphome:
  name: esp-velux
  friendly_name: ESP-Velux

esp8266:
  board: d1_mini

# Enable logging
logger:
#  level: verbose
  


# Enable Home Assistant API
api:
  encryption:
    key: "51234567s="

ota:
  password: "12ec2b"

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

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.100.100
    gateway: 192.168.100.254
    subnet: 255.255.255.0
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Velux Fallback Hotspot"
    password: "12345678"


remote_receiver:
  pin:
    number: D5
    inverted: true
  dump: raw

remote_transmitter:
  pin: D7
  carrier_duty_percent: 50%

button:
  - platform: template
    name: "Velux Fenster AUF"
    on_press:
      - remote_transmitter.transmit_raw:
         code: [466, -1256, 433, -1228, 1327, -366, 463, -1232, 461, -1229, 1324, -367, 445, -1252, 461, -1228, 464, -1230, 463, -1230, 1299, -390, 441, -1254, 439, -1253, 439, -1255, 439, -1254, 463, -1273, 439, -1255, 437, -1253, 440, -1253, 439, -1252, 1327, -365, 465, -1232, 436, -1254, 463]         
         repeat:
            times: 2
            wait_time: 16ms
         carrier_frequency: 38kHz
  - platform: template
    name: "Velux Fenster STOP"
    on_press:
      - remote_transmitter.transmit_raw:
         code: [1358, -370, 493, -1203, 1392, -336, 530, -1199, 530, -1200, 1358, -338, 527, -1202, 528, -1201, 529, -1199, 529, -1200, 1358, -338, 528, -1205, 524, -1201, 529, -1200, 528, -1167, 529, -1201, 528, -1201, 528, -1201, 530, -1198, 530, -1166, 529, -1200, 529, -1200, 1392, -337, 527]         
         repeat:
            times: 2
            wait_time: 16ms
         carrier_frequency: 38kHz       
  - platform: template
    name: "Velux Fenster ZU"
    on_press:
      - remote_transmitter.transmit_raw:
         code: [553, -1142, 1416, -313, 1416, -313, 552, -1178, 552, -1143, 1398, -331, 551, -1178, 528, -1201, 552, -1144, 528, -1201, 1415, -314, 552, -1177, 552, -1177, 552, -1144, 551, -1178, 551, -1178, 531, -1197, 552, -1178, 551, -1144, 551, -1178, 1390, -339, 1355, -374, 550, -1146, 1389]         
         repeat:
            times: 2
            wait_time: 16ms
         carrier_frequency: 38kHz
  - platform: template
    name: "Velux Rollo AUF"
    on_press:
      - remote_transmitter.transmit_raw:
         code: [552, -1177, 552, -1143, 1392, -337, 552, -1177, 1382, -348, 527, -1168, 552, -1160, 568, -1178, 551, -1178, 552, -1177, 1354, -342, 550, -1178, 552, -1178, 548, -1181, 551, -1177, 553, -1143, 552, -1177, 552, -1177, 552, -1177, 553, -1176, 1381, -314, 1415, -314, 552, -1178, 1380]         
         repeat:
            times: 2
            wait_time: 16ms
         carrier_frequency: 38kHz
  - platform: template
    name: "Velux Rollo STOP"
    on_press:
      - remote_transmitter.transmit_raw:
         code: [1381, -348, 553, -1143, 1416, -313, 552, -1177, 1356, -373, 551, -1145, 551, -1178, 552, -1177, 551, -1178, 527, -1202, 1380, -315, 529, -1201, 550, -1179, 551, -1177, 536, -1193, 489, -1207, 551, -1178, 551, -1179, 550, -1178, 526, -1203, 549, -1147, 1389, -339, 1389, -340, 1351]         
         repeat:
            times: 2
            wait_time: 16ms
         carrier_frequency: 38kHz       
  - platform: template
    name: "Velux Rollo ZU"
    on_press:
      - remote_transmitter.transmit_raw:
         code: [554, -1176, 1420, -308, 1389, -306, 556, -1180, 1378, -345, 548, -1181, 550, -1146, 554, -1177, 548, -1175, 529, -1203, 1355, -374, 521, -1176, 517, -1212, 525, -1203, 515, -1214, 516, -1214, 468, -1227, 469, -1260, 470, -1259, 469, -1260, 1303, -427, 435, -1261, 468, -1261, 468]         
         repeat:
            times: 2
            wait_time: 16ms
         carrier_frequency: 38kHz

The commands depend on the settings you have made at the DIP-switches inside the IR Remote.

The ESP and the IR Transmitter got packed in a small 3D printed case which is installed next to my distribution box where the power supply is installed.


2 meters away there’s the Velux IR Receiver and now I’m able to integrate my “old” Window to a HomeAssistant. :slight_smile: :slight_smile:

Velux_3

1 Like