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.