How to Connect Your Somfy Remote to Alexa With an ESP8266 to Control Your Motorized Blinds


Introduction: How to Connect Your Somfy Remote to Alexa With an ESP8266 to Control Your Motorized Blinds

As a home automation enthusiast, I wanted to find a way to use Alexa to open and close my motorized blinds. I looked on line to purchase a solution, but found that the offerings were expensive and had somewhat bad reviews. Not wanting to put out the money for a marginal solution, I started exploring options for connecting my existing remote to Alexa. I found several good resources, including some instructables, but no single step by step guide. Hopefully, you will find this instructable clear and easy to follow with most of the resources you need.

In this instructable, I show you how to control one channel of your remote and you can make one or multiple blinds go up and down in a group. Later I will provide an update for individually controlling multiple blinds.

Step 1: Pull All the Pieces Together

Here is the list of hardware and software you will need and where to find it:

  • Somfy remote, if you don't want to use your current one - Found here on Amazon
  • ESP8266. I used this one Found here on Amazon .
  • I assume you have some experience with Arduino and the Arduino IDE. If not you can download the Arduino IDE - Found here. If you are not familiar with the Arduino IDE, instructions and tutorials can be found on the same web site.
  • Install the Fauxmo and ESP WIFI librarys - Adafruit has a nice tutorial on loading the libraries and some great ESP8266 devices found here.

Step 2: Set Up the ESP8266 With the Arduino IDE

Connect the ESP8266 to your computer with the appropriate USB cable. Bring up the Arduino IDE.

Under file/preferences add "" in the Additional Boards Manager URLs: box. As shown in the 1st screen capture.

In the Arduino IDE, under "tools" select the board you are using. If you have a NodeMCU based board like mine, select NodeMCU as shown in the 2nd screen capture. Afterward your tools sub menu should look like the last screen capture.

Load this code to the ESP8266, and remember to change "your SSID" and "your Password" for your router.

** ** ESP8266WiFi functions to connect Window Shades to Alexa ** code modified from Adafruit website code based on fauxmo library ** Setup registers the device and in ISR routine call back returns state change for the device. ** ***********************************************************************************************/

#include <Arduino.h> #include <ESP8266WiFi.h> #include "fauxmoESP.h"

#define WIFI_SSID "Your SSID" #define WIFI_PASS "Your Password" #define SERIAL_BAUDRATE 115200 /*************************************************************************** ** NOTE: D1 through D10 are ESP defines that map the ESP GPIO pins to the ** correct pin noted on the ESP8266. Use these defines to map to the correct number ** you see on the package. *************************************************************************************/ #define DOWN D1 #define UP D2

fauxmoESP fauxmo;

// ----------------------------------------------------------------------------- // Wifi // -----------------------------------------------------------------------------

void wifiSetup() {

// Set WIFI module to STA mode WiFi.mode(WIFI_STA);

// Connect Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID); WiFi.begin(WIFI_SSID, WIFI_PASS); // Wait while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(100); } Serial.println();

// Connected! Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str()); } struct State // Struct to keep current state of device { bool state = 0; const char *device_name; uint8_t device_id; } Curstate;

void callback(uint8_t device_id, const char * device_name, bool state) { if (state == Curstate.state) return; Curstate.device_name = device_name; Curstate.state= state; Curstate.device_id = device_id; }

void setup() { // Init serial port and clean garbage Serial.begin(SERIAL_BAUDRATE); Serial.println("Alexa/ESP demo sketch"); Serial.println("After connection, ask Alexa/Echo to 'turn on' or 'off'");

// Wifi wifiSetup();

// Add device fauxmo.addDevice("Shades"); // One or all blinds - work on multiple individual shades later Serial.println();


pinMode(DOWN,OUTPUT); pinMode(UP,OUTPUT); digitalWrite(DOWN,HIGH); // Set UP and DOWN HIGH so the remote doesn't activate on start up digitalWrite(UP,HIGH);


void loop() { static bool state; fauxmo.handle(); if (state != Curstate.state) { state = Curstate.state; if (Curstate.state) { Serial.println("ON/DOWN"); digitalWrite(DOWN,LOW); delay(5000); digitalWrite(DOWN, HIGH); } else { Serial.println("OFF/UP"); digitalWrite(UP,LOW); delay(5000); digitalWrite(UP, HIGH); } } }

Step 3: Register Shades With the Alexa App

After your ESP8266 connects to your WIFI, go to the Alexa app and select "Smart Home".

Under "Your Devices" click on "Discover Devices". This should find your new device called "Shades". I used "Shades" instead of "Blinds" because Alexa seemed to occasionally confuse "blinds" with "lights".

Tell Alexa to "turn the shades off" and you should get "OFF/UP" on the Arduino serial monitor. "turn the shades on" should give you "ON/DOWN" on the serial monitor.

The ESP8266 is a little finicky and may take some time to connect. It's mostly reliable, but occasionally misses a command. Not sure if this is the ESP itself, or some of the libraries used.

Step 4: Program Your Somfy Remote

Check out these informational video's from Somfy on programming your duplicate remote:

This will allow you to copy and paste the programming from your current remote to a new duplicate remote.

Step 5: Connect ESP8266 to Somfy Remote

After programming the remote, open the case and pull the circuit board out. Remove the coin battery.

I've seen others connect the remote to the ESP8266 using relays, but if you power the remote from the 3.3v pin on the ESP8266 you can use the digital pins to simulate a button press by pulling the correct side of the button to ground.

Solder each connection as shown in the picture. 3.3v and ground from the ESP8266 to replace power from the coin battery and D1 and D2 to Down and Up respectively.

Be sure to set the correct channel for the blinds you want to control.

Step 6: Package in Project Box

Pick up a small project box like this one from Amazon. You may need to drill a small hole in one side and install USB power connector. Place the box within range of your blinds (mine seems to work at least 50 feet away).

If you try this instructable and have any issues, let me know and I'll update it. In the future I plan to update it with control for multiple individual blinds.

I changed my Alexa to respond the wake word "computer". I wanted to change the name of the shades to "Shields" so I could yell "Computer - Shields on!", but my wife didn't like it. Oh well.

Hope this helps.



    • Clocks Contest

      Clocks Contest
    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest

    20 Discussions

    hi, thank you for sharing this. Have you looked at incorporating into Home Assistant?

    7 replies

    Jerry, wanted to let you know I followed your instructions and got it working perfectly. After finishing the whole thing I tried saying "alexa close curtains" just out of curiosity and Alexa opened the curtains; then I said "alexa open curtains" and Alexa closed the curtains....:-)

    Went back to your sketch, replaced all the UPs with Downs and vice-versa, re-flashed and Voila!....

    Now it works intuitively: "Alexa open curtains" and it opens. Alexa close and it closes.

    Once again thank you very much . Produced two Alexa-enabled Somfy ESP/remotes for under USD80!

    Glad it worked for you. Thanks for the comments.

    Hi Jerry, update. I managed to produce a sketch using your sketch and other resources to control Somfy with Alexa and Home Assistant. Happy to share if of interest.

    Could you share this? I'd love to be able to connect directly to HASS.

    Can you kindly share how you were able to connect the fauxmo esp to home assistant, I am tryign to do the same.

    Do share the steps and code too.

    If I understand correctly, this must be connected to a computer to work, is that correct? Any easy way to make this standalone?

    1 reply

    No that is not correct. You need a computer to download the program to the Arduino, but it works standalone after that.

    njreid - I'm having issues connecting the ESP8266 with Alexia (Echo Gen 2), would appreciate if you can share a copy of your configuration please.


    Hi Tich1 - I wasn't able to get the Fauxmo library approach to work, so I adapted another bit of sample code I found.

    #include <ESP8266WiFi.h>

    #include <ESP8266WebServer.h>

    #include <WiFiUdp.h>

    #include <functional>

    #include "switch.h"

    #include "UpnpBroadcastResponder.h"

    #include "CallbackFunction.h"

    // prototypes

    boolean connectWifi();

    //on/off callbacks

    bool loungeShadesUp();

    bool loungeShadesDown();

    bool kitchenLightsOn();

    bool kitchenLightsOff();

    // Change this before you flash

    const char* ssid = "YOUR_WIFI_SSID";

    const char* password = "YOUR_WIFI_PASSWORD";

    boolean wifiConnected = false;

    UpnpBroadcastResponder upnpBroadcastResponder;

    #define UP D1

    #define DOWN D2

    Switch *lounge = NULL;

    Switch *kitchen = NULL;

    bool isloungeShadesUp = false;

    void setup()



    // Setup the control pins

    pinMode(DOWN, OUTPUT);

    pinMode(UP, OUTPUT);

    digitalWrite(DOWN, HIGH); // Set UP and DOWN HIGH so the remote doesn't activate on start up

    digitalWrite(UP, HIGH);

    // Initialise wifi connection

    wifiConnected = connectWifi();

    if (wifiConnected) {


    // Define your switches here. Max 10

    // Format: Alexa invocation name, local port no, on callback, off callback

    lounge = new Switch("Lounge Shades", 80, loungeShadesUp, loungeShadesDown);

    Serial.println("Adding switches upnp broadcast responder");





    void loop()


    if (wifiConnected) {






    bool loungeShadesUp() {

    Serial.print("Opening shades... ");

    digitalWrite(UP, LOW);


    digitalWrite(UP, HIGH);


    isloungeShadesUp = true;

    return isloungeShadesUp;


    bool loungeShadesDown() {

    Serial.print("Closing shades... ");

    digitalWrite(DOWN, LOW);


    digitalWrite(DOWN, HIGH);


    isloungeShadesUp = false;

    return isloungeShadesUp;


    // connect to wifi – returns true if successful or false if not

    boolean connectWifi() {

    boolean state = true;

    int i = 0;


    WiFi.begin(ssid, password);


    Serial.println("Connecting to WiFi");

    // Wait for connection

    Serial.print("Connecting ...");

    while (WiFi.status() != WL_CONNECTED) {



    if (i > 10) {

    state = false;





    if (state) {


    Serial.print("Connected to ");


    Serial.print("IP address: ");



    else {


    Serial.println("Connection failed.");


    return state;


    Appreciate the reply and configuration file, I managed to get the original file to work with my 'Echo Dot 2', I uninstalled the 'ESP8266' version 2.4.0 from 'Boards Manager', I then re-installed 'ESP8266' using version 2.3.0...after this did a discover and Alexa found the device first time! ;-)


    Thanks very much for your instructable.


    Thanks for sharing such project.
    Can we add one more remote in this code and how. looking for your response.

    Hi Jerry,
    I ordered the board you recommended and tried it out... After successfully loading the code to the ESP8266 I am not able to tell what's going on with it. Alexa doesn't recognize a device, and in my serial monitor window all I see is backwards question marks. Tried updating the firmware, different baud rates, etc. with same result.


    8 months ago

    Hi Jerry, thanks so much for this. I did it and it works. You got me started, so thanks for that. In my case I also have an urtsi and a gc-100 so I modified a bit and am now doing it without the remote. You did however, open my eyes to a whole host of possibilities where I have remotes controlling things that I can't otherwise. Like my fireplace, which will be next.

    One thing. I think I know why you are experiencing a bit of instability. It looks like you're using the test, if state=curstate.state to determine when to press a button. State can get out of sych with the actual state if someone raises or lowers the shades outside of this routine. I noticed this because my wife still uses the Somfy remote to close the shades at night. Then in the morning I'm asking Alexa to open them and she says Ok, but nothing happens. Then I ask her to lower them and then raise them (on and off) and finally it works. This is why:

    So, say you put the shades down with Alexa. State would be 1. Now say you put them up with a remote. State is still 1 but the shades are up so you'd naturally ask Alexa to turn them on to put them down again. Only state is still 1 and Curstate.state is 1 so the if statement does not get invoked.

    That's an issue I have anyway. Hope that helps.



    Oh, this is very nice! Congrats :-)

    Did you already manage to control multiple channels (multiple blinds)?


    Very nice! Thank you for this instructable!