This is an alternative firmware for AI-Thinker RGBW LED bulbs which uses MQTT instead of the default Chinese mobile application. The bulb is a cheap (~12-18$) product available on sites like Aliexpress and eBay which can be easily reprogrammed as it is based on the popular ESP8266 Wi-Fi chip.
- Remote control over the MQTT protocol via JSON
- Supports brightness, RGB and white colors, color temperature and effects
- TLS support (uncomment
#define TLS
inconfig.h
and change the fingerprint if not using CloudMQTT) - Debug printing over Telnet or Serial (uncomment
#define DEBUG_TELNET
or#define DEBUG_SERIAL
inconfig.h
) - ArduinoOTA support for over-the-air firmware updates (enabled,
#define OTA
inconfig.h
) - Native support for Home Assistant, including MQTT discovery (enabled,
#define MQTT_HOME_ASSISTANT_SUPPORT
inconfig.h
)
The firmware will publish a MQTT Last Will and Testament at <chipID>/rgbw/status
.
When the device successfully connects it will publish alive
to that topic and when it disconnects dead
will automatically be published.
This firmware supports Home Assistant's MQTT discovery functionality, added in 0.40.
This allows for instant setup and use of your device without requiring any manual configuration in Home Assistant.
To get this working, discovery: true
must be defined in your mqtt
configuration in Home Assistant
configuration.yaml
mqtt:
broker: 'm21.cloudmqtt.com'
username: '[REDACTED]'
password: '[REDACTED]'
port: '[REDACTED]'
discovery: true
- Install the Arduino IDE and the ESP8266 core for Arduino
- Rename
config.example.h
toconfig.h
- Define your WiFi SSID and password (
#define WIFI_SSID "<SSID>"
and#define WIFI_PASSWORD "<password>"
inconfig.h
) - Define your MQTT settings (
#define MQTT_USERNAME "<username>"
,#define MQTT_PASSWORD "<password>"
,#define MQTT_SERVER "<server>"
and#define MQTT_SERVER_PORT <port>
) - Install the external libraries (PubSubClient, ArduinoJson and my9291)
- Define
MQTT_MAX_PACKET_SIZE
to512
instead of128
inArduino/libraries/pubsubclient/src/PubSubClient.h
- Solder wires from (bulb)
3V3
to3V3
(FTDI),GND
toGND
,RX
toTX
,TX
toRX
andรO0
toGND
- Flash the firmware (board
Generic ESP8266 module
, Upload Speed115200
and Flash Size1M (128K SPIFFS)
)
- Transitions
- Flash mode
- Individual MQTT topics instead of JSON
- More effects
- WiFiManager
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If you like the content of this repo, please add a star! Thank you!