/esphome-milight

This is a replacement for a Milight/LimitlessLED remote/gateway hosted on an ESP8266 based on the work of Henryk Plötz, sidoh, and hencou

Primary LanguageC++MIT LicenseMIT

MiLight Library for ESPhome

This is a fork of Sidoh's Milight Hub: https://github.com/sidoh/esp8266_milight_hub/

This library is used with ESPHome, see the custom component in this repo: https://github.com/hencou/esphome_components

Below the original text of Sidoh's Milight Hub with slight modifications:

esp8266_milight_hub/switch

This is a replacement for a Milight/LimitlessLED remote/gateway hosted on an ESP8266. Leverages Henryk Plötz's awesome reverse-engineering work.

Milight bulbs are cheap smart bulbs that are controllable with an undocumented 2.4 GHz protocol. In order to control them, you either need a remote ($13), which allows you to control them directly, or a WiFi gateway ($30), which allows you to control them with a mobile app or a UDP protocol.

This guide on my blog details setting one of these up.

Why this is useful

  1. Both the remote and the WiFi gateway are limited to four groups. This means if you want to control more than four groups of bulbs, you need another remote or another gateway. This project allows you to control 262,144 groups (4*2^16, the limit imposed by the protocol).
  2. This project exposes a nice ESPHome API to control your bulbs.

Supported remotes

The following remotes can be emulated:

Support has been added for the following bulb types:

Model # Name Compatible Bulbs
FUT096 RGB/W
  1. FUT014
  2. FUT016
  3. FUT103
FUT005
FUT006
FUT007
CCT
  1. FUT011
  2. FUT017
  3. FUT019
FUT098 RGB Most RGB LED Strip Controlers
FUT020 RGB Some other RGB LED strip controllers
FUT092 RGB/CCT
  1. FUT012
  2. FUT013
  3. FUT014
  4. FUT015
  5. FUT103
  6. FUT104
  7. FUT105
  8. Many RGB/CCT LED Strip Controllers
FUT091 CCT v2 Most newer dual white bulbs and controllers
FUT089 8-zone RGB/CCT Most newer rgb + dual white bulbs and controllers

Other remotes or bulbs, but have not been tested.

What you'll need

  1. An ESP8266. I used a Wemos D1 Mini.
  2. A NRF24L01+ module (~$3 on ebay). Alternatively, you can use a LT8900.
  3. Some way to connect the two (7 female/female dupont cables is probably easiest).
  4. 10 uF capacitor between power supply and NRF24L01+
  5. HLK-PM03 3V3 Power supply, or HLK-PM01 5V to support RCWL-0516 radar sensor (optional)

Installing

Connecting GPIO

I used a Wemos D1 mini because it's very small to fit behind a wall switch.

  • Use free GPIO inputs as input from wall switch to control groups 1-3. LOW is active state. Use a push switch or touch sensor like TTP223, solder jumper A on TTP223 to achieve active LOW output.
  • Use free GPIO input for a DS18B20 temperature sensor, or RCWL-0516 radar sensor

Connect the NRF24L01+ / LT8900

This project is compatible with both NRF24L01 and LT8900 radios. LT8900 is the same model used in the official MiLight devices. NRF24s are a very common 2.4 GHz radio device, but require software emulation of the LT8900's packet structure. As such, the LT8900 is more performant.

Both modules are SPI devices and should be connected to the standard SPI pins on the ESP8266.

NRF24L01+

This guide details how to connect an NRF24 to an ESP8266. By default GPIO 4 for CE and GPIO 15 for CSN are used.

On a Wemos D1 mini:

Wemos GPIO NRF24 Color
GND GND Black
3V3 VCC Red
D2 GPIO4 CE Orange
D5 GPIO14 SCK Green
D6 GPIO12 MISO Violet
D7 GPIO13 MOSI Blue
D8 GPIO15 CSN Yellow
  • Do not mount the NRF24 and ESP12 antennas against each other. This will cause bad performance and crashes

Image source: MySensors.org

LT8900

Connect SPI pins (CE, SCK, MOSI, MISO) to appropriate SPI pins on the ESP8266. With default settings, connect RST to GPIO 0, PKT to GPIO 16, CE to GPIO 4, and CSN to GPIO 15. Make sure to properly configure these if using non-default pinouts.

Setting up the ESP

The goal here is to flash your ESP with the firmware. This should be done with ESPHome.

  • Create a yaml file with the example provided.

Pair Bulbs

If you need to pair some bulbs, how to do this is described in the wiki.

  • When the ESPHome module is deployed in "DEBUG" mode, it will log received and decoded packets to determine Device and Group id's from your existing remotes