|
1 | 1 | # esp8266-yeelight-switch |
2 | | -Arduino project for controlling an Yeelight bulb using an ESP8266 MCU |
| 2 | +Arduino project for controlling an Yeelight bulb using an ESP8266 MCU and a push button. |
| 3 | + |
| 4 | +Program features: |
| 5 | +* Use of local API, meaning nearly instantaneous light switching; |
| 6 | +* Support for Yeelight devices discovery on the network; |
| 7 | +* Visible user feedback using the ESP8266's built-in LED; |
| 8 | +* Support for Wi-Fi network reconfiguration; |
| 9 | +* Web interface with mDNS support to configure the switch; |
| 10 | +* Support for turning the bulb on or off via web interface, including a direct URL for toggle; |
| 11 | +* Storing of the user-selected device in EEPROM (survives power off); |
| 12 | +* No hardcoded or entered bulb IP addresses; |
| 13 | +* Detailed diagnostics sent over serial interface. |
| 14 | + |
| 15 | +Current known limitations: |
| 16 | +* Only one bulb at a time is supported; |
| 17 | +* The bulb has to be online when the switch boots, otherwise the switch will start unlinked; |
| 18 | +* No power-saving optimisations have been made; the switch will not last long on a battery source. |
| 19 | + |
| 20 | +Usage: |
| 21 | + 1. review the configuration settings at the top of the program; compile and flash your ESP8266; |
| 22 | + 1. boot with the push button pressed, connect your computer to the Wi-Fi network "ybutton1", password "Yeelight", enter and save your Wi-Fi network credentials; |
| 23 | + 1. in your Wi-Fi network, go to http://ybutton1.local, run the Yeelight scan and link the switch to the bulb found; |
| 24 | + 1. use the push button to control your bulb manually; |
| 25 | + 1. access to http://ybutton1.local/flip to toggle the bulb from a script. |
| 26 | + |
| 27 | + LED response to the button: |
| 28 | + * 1 blink - bulb flip OK; |
| 29 | + * 1 + 2 blinks - the bulb did not respond; |
| 30 | + * 2 blinks - button not linked to a bulb; |
| 31 | + * 1 long blink - Wi-Fi disconnected. |
| 32 | + |
| 33 | + Prerequsites: |
| 34 | + 1. Hardware: |
| 35 | + 1. ESP8266 |
| 36 | + 1. Push button connected to GPIO and pulled high; |
| 37 | + 1. Software: |
| 38 | + 1. Arduino IDE, https://www.arduino.cc/en/main/software |
| 39 | + 1. ESP8266 core for Arduino, https://github.com/esp8266/Arduino |
| 40 | + 1. WiFiManager library for Arduino, https://github.com/esp8266/Arduino |
| 41 | + |
| 42 | + If you have an ESP with an onboard button, such as Witty Cloud Development board, the program can be used out of the box. Otherwise you need to wire the button and update the GPIO number in the source. |
0 commit comments