How to Connect Your Somfy Remote to Alexa With an ESP8266 to Control Your Motorized Blinds : 6 Steps - Instructables
Technology

How to Connect Your Somfy Remote to Alexa With an ESP8266 to Control Your Motorized Blinds : 6 Steps – Instructables

connect the esp8266 to your computer with the appropriate usb cable. show the arduino ide.

in file/preferences add “http://arduino.esp8266.com/stable/package_esp8266com_index.json” in the additional board manager url box:. as shown in the first screenshot.

Reading: How to connect somfy to alexa

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 second screenshot. then the tools submenu should look like the last screenshot.

Load this code into the esp8266 and remember to change “your ssid” and “your password” for your router.

/*************************************************** ***** ************************************************ * * esp8266wifi functions to connect window blinds to alexa ** modified code from adafruit website code based on fauxmo library ** setup registers device and in isr routine callback returns state change for the device. ************************************************** **** ********************************************** // p>

#include <arduino.h> #includes <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 definitions that map the gpio esp pins to the correct ** pin noted on the esp8266. use these definitions to assign the correct number ** that you see on the package. ************************************************** ** ***********************************/ #set bottom d1 #set top d2

See also: Learn How to Integrate Stripe with WooCommerce in 4 Steps

fauxmoesp fauxmo;

// – // Wi-Fi // –

override wifisetup() {

// set the 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); } string.println();

See Also:  How do I connect my Android device to my NETGEAR or Orbi network? | Answer | NETGEAR Support

// connected! serial.printf(“[wifi] station mode, ssid: %s, ip address: %sn”, wifi.ssid().c_str(), wifi.localip().tostring().c_str()); } struct state // structure to hold the current state of the device { bool state = 0; const char *device_name; uint8_t device_id; } cure;

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; }

See also: 4 Tips for Connecting an Optical Audio Cable to Your Receiver | DoItYourself.com

void setup() { // initialize the serial port and clean up the garbage serial.begin(serial_baudrate); serial.println(“alexa/esp demo sketch”); serial.println(“after connection, ask alexa/echo to ‘turn on’ or ‘turn off'”);

// wifi wifisetup();

// add device fauxmo.adddevice(“shades”); // one or all shades – work on multiple individual shades later serial.println();

fauxmo.onmessage(callback);

pinmode(down,exit); pin mode (up, out); digital writing (down, up); // set and lower high so that the remote does not activate on startup digitalwrite(up,high);

}

void loop() { static boolean state; fauxmo.handle(); if (state != current state.state) { state = current state.state; if (curstate.state) { serial.println(“on/down”); digital writing (down, down); lag(5000); digital writing (down, up); } else { serial.println(“off/up”); digital writing (up, down); lag(5000); digital writing (up, stop); } } }

See also: RV Sway Control Basics for Travel Trailers – Togo RV

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button