I put this quick and dirty proof of concept together to familiarize myself with the ESP8266 platform and add it to my arsenal of embedded tools.
ESP runs a websocket server and a webserver. The webserver exposes a terse API that takes one GET parameter, the RF code and emits that using 433 MHz modules (I used these). To learn/sniff the codes, you can visit http://esp8266rc/learn
that makes use of a minimal HTML page + Websockets (hence the websockets server) to in real-time display (woot!) sniffed codes.
As a bonus, the HTTP GET request to send a RF code, thereby turning the switch on/off can be done from the Smartthings hub. This means, I have cetral control of these cheap RF switches and can make them part of my routines, automations and other scripts.
- 1X ESP8266
- 1X 433 Mhz Pair
- 1X Cheap RF Switches
- Couple Dupont Jumper wires
- Breadboard
WebsocketRC.ino
is flashed onto ESP8266. I am using this NodeMCU v1.0.esp8266_rcSwitch.groovy
is the custom device handler on Smartthings. Once installed, add a new device from dev web UI and selectESP8266 - RCSwitch
as the device handler type. Complete setup of device on your phone.http://<esp_ip_address>/learn
to sniff RF codeshttp://<esp_ip_address>/switch?code=<code>
to manually send a RF codewebsocketClient.html
is minified and copied as a String variable inWebsocketRC.ino
. This static page is served when one visits the RF learning page.
ESP8266NodeMCU | 433MHz RX
D6 <-> DOUT
ESP8266NodeMCU | 433MHz TX
D1 <-> DATA
VCC/GND as appropriate. I connected all modules to VIN (5V).