Controlling Velux Remote with ESP8266 and ESPHome

Hello Everyone,

I want to automate my Velux roof blinds and I didn’t want to invest to Velux bridge over 100ish euros.

So I googled a bit and I saw a couple of posts (first_one, second and third(German) )
So I thought I can do this too, but it doesn’t work indeed.
My YAML file looks as follows(see below), and I think my problem is my momentary switch configuration but I can’t find the problem. Beside that controlling the switch is also a bit laggy. If anyone have any ideas I will be glad. Thank you!

esphome:
  name: veluxremote
  friendly_name: VeluxRemote

esp8266:
  board: nodemcuv2

# Enable logging
logger:

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

ota:
  password: "passw"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Veluxremote Fallback Hotspot"
    password: "rpassw"

captive_portal:

switch:
  - platform: gpio
    id: velux_down
    pin: D5
    inverted: yes

  - platform: gpio
    id: velux_stop
    pin: D6
    inverted: yes

  - platform: gpio
    id: velux_up
    pin: D7
    inverted: yes

cover:
  - platform: template
    name: Fernbedienung
    open_action:
      # Cancel any previous action
      - switch.turn_off: velux_down
      # Turn the OPEN switch on briefly
      - switch.turn_on: velux_up
      - delay: 0.1s
      - switch.turn_off: velux_up
    close_action:
      - switch.turn_off: velux_up
      - switch.turn_on: velux_down
      - delay: 0.1s
      - switch.turn_off: velux_down
    stop_action:
      - switch.turn_off: velux_down
      - switch.turn_off: velux_up
      - switch.turn_on: velux_stop
      - delay: 0.1s
      - switch.turn_off: velux_stop
    optimistic: true
    assumed_state: true    

I’m using this ESP8266:


This is what I did to make it work:

1 Like

Thanks for that, Ive just replicated it to operate my Velux window (Not blind). Works perfectly. I’m just 3d printing a box for the Esp32. I routed the cables slightly differently, but still exiting at the rear.

1 Like

Glad it worked! I’m 3D printing a box that houses the two remotes and the esp32

I was looking at this:

as a case extension, not convinced the idea to connect would be reliable.
I have had a few issues where my USB doesnt seem to deliver enough power and the esp32 doesnt work, that caught me out and made me suspect dodgy soldering!

That’s neat. I already did all of my wiring, so I’m going to make a box that houses two of those remotes and has a space for the ESP + wiring too.

I made mine to replace the back panel entirely, put it on a pcb and also added sense wires so the ESP can report state back when you press the physical buttons.

Using the time_based cover also lets me control the position with surprising accuracy.

Printables page here

CAD files here
Edit: updated links

1 Like

Nice project @thorou, will have to add to my to do list. Means ordering a PCB and brushing up on my SMD skills.

Thanks!

The gerbers in the Github release are ready to order; you can get them incredibly cheap at JLCPCB (6€ shipped for 5 pcs) with really nice finish.

Do shoot me a message or open a Github issue if you need a bill of materials.

Ordered 5 the other day, hopefully on a slow boat from China :grinning:

Hi,
Thank you for sharing it @thorou this looks neat!

I have a question is there a way to get this PCB wit all the the components already soldered except the ESP?

I have 2 ESP12F at home but there is no way that I can solder the other components to the PCB and I never designed or ordered a PCB before.

JLCPCB and similar have PCBA services, so they will just ship you a finished board with components on it. You can use the zipped gerbers for the PCB, but as for component placement you’ll have to figure that out yourself as I’ve never tried it before.

But if you’re just scared of the tiny parts, it’s actually not too difficult to hand-solder them. The 0603 resistors are the smallest parts on the board, and these are just big enough to grab them with tweezers and solder them down without much difficulty, even with a large tip.

You can pick up an SMD practice kit off AliExpress for cheap if you want to give it a go.

Hi thorou,
thanks for your board and the files :slight_smile: Today i finished the board with soldering all parts by myself :slight_smile:
Now the problem is, that i cant programm the ESP… the 3,3 volts are there, also RX and TX, i use a FT232 board and esp home from HA. But i didtn connect. Can you explain me how to programm the esp? Thank you!

There isn’t really anything special about the board, you should be able to flash it over UART like any other ESP.

You can try flipping RX/TX, using a different serial adapter, different flashing program (flashing from your browser only works in chrome, brave, edge etc). You can also try holding down BOOT while plugging the board into power, if it’s not booting into download mode properly that might fix it.

Also check if you can flash a different ESP module using your serial adapter.

Hi thorou,
thanks! Now it worked so far! Nice One, only stop Button doesn‘t work… have to Check the wires!

Can you maybe change the Board to work with Micro USB or Type C usb ?

Unlike the newer ESP32 modules, the ESP8266 can’t be flashed directly over USB, you need something in the middle to translate to UART (this is what your FT232 does).

You would need to put an extra port, chip and some passives on the board for it to be programmable over USB, which doesn’t make much sense for a board you’ll likely only flash once (and then use OTA).

No, i mean as power supply for the board.

Most have USB cables and power supplies at home.

If you’re already soldering up a board it’s not too much trouble to also solder up a cable. The board-side connectors for barrel plugs also have much larger pins and are easier to hand-solder to.

If you really wanted to you could adapt the design to USB micro B or USB C fairly easily; just open it up in KiCad, replace the connector footprint and re-route a couple traces.