|
1 | | -Fork of [sidoh's great work](https://github.com/sidoh/esp8266_milight_hub) to fix some things and hopefully pushing the boundaries of MiLights possibilities. |
2 | | -The following text is his original README (just replaced some links for consistency): |
| 1 | +# esp8266_milight_hub [](https://github.com/bombcheck/esp8266_milight_hub/releases/latest) |
| 2 | +Fork of [sidoh's great work](https://github.com/sidoh/esp8266_milight_hub) to fix some things and hopefully pushing the boundaries of MiLights possibilities. The following text is his original README (just replaced some links for consistency): |
3 | 3 |
|
4 | | - |
5 | | -# esp8266_milight_hub |
6 | 4 | This is a replacement for a Milight/LimitlessLED remote/gateway hosted on an ESP8266. Leverages [Henryk Plötz's awesome reverse-engineering work](https://hackaday.io/project/5888-reverse-engineering-the-milight-on-air-protocol). |
7 | 5 |
|
8 | 6 | [Milight bulbs](https://www.amazon.com/Mi-light-Dimmable-RGBWW-Spotlight-Smart/dp/B01LPRQ4BK/r) are cheap smart bulbs that are controllable with an undocumented 2.4 GHz protocol. In order to control them, you either need a [remote](https://www.amazon.com/Mi-light-Dimmable-RGBWW-Spotlight-Smart/dp/B01LCSALV6/r?th=1) ($13), which allows you to control them directly, or a [WiFi gateway](https://www.amazon.com/BTF-LIGHTING-Mi-Light-WiFi-Bridge-Controller/dp/B01H87DYR8/ref=sr_1_7?ie=UTF8&qid=1485715984&sr=8-7&keywords=milight) ($30), which allows you to control them with a mobile app or a [UDP protocol](http://www.limitlessled.com/dev/). |
@@ -44,7 +42,7 @@ Both modules are SPI devices and should be connected to the standard SPI pins on |
44 | 42 |
|
45 | 43 | ##### NRF24L01+ |
46 | 44 |
|
47 | | -[This guide](https://www.mysensors.org/build/connect_radio#nrf24l01+-&-esp8266) details how to connect an NRF24 to an ESP8266. I used GPIO 16 for CE and GPIO 15 for CSN instead. These can be configured later. |
| 45 | +[This guide](https://www.mysensors.org/build/esp8266_gateway) details how to connect an NRF24 to an ESP8266. I used GPIO 16 for CE and GPIO 15 for CSN. These can be configured later. |
48 | 46 |
|
49 | 47 | ##### LT8900 |
50 | 48 |
|
@@ -93,14 +91,14 @@ The HTTP endpoints (shown below) will be fully functional at this point. You sho |
93 | 91 |
|
94 | 92 | ## REST endpoints |
95 | 93 |
|
96 | | -1. `GET /`. Opens web UI. |
| 94 | +1. `GET /`. Opens web UI. |
97 | 95 | 1. `GET /about`. Return information about current firmware version. |
98 | 96 | 1. `POST /system`. Post commands in the form `{"comamnd": <command>}`. Currently supports the commands: `restart`. |
99 | 97 | 1. `POST /firmware`. OTA firmware update. |
100 | 98 | 1. `GET /settings`. Gets current settings as JSON. |
101 | 99 | 1. `PUT /settings`. Patches settings (e.g., doesn't overwrite keys that aren't present). Accepts a JSON blob in the body. |
102 | 100 | 1. `GET /radio_configs`. Get a list of supported radio configs (aka `device_type`s). |
103 | | -1. `GET /gateway_traffic(/:device_type)?`. Starts an HTTP long poll. Returns any Milight traffic it hears. Useful if you need to know what your Milight gateway/remote ID is. Since protocols for RGBW/CCT are different, specify one of `rgbw`, `cct`, or `rgb_cct` as `:device_type`. The path `/gateway_traffic` without a `:device_type` will sniff for all protocols simultaneously. |
| 101 | +1. `GET /gateway_traffic(/:device_type)?`. Starts an HTTP long poll. Returns any Milight traffic it hears. Useful if you need to know what your Milight gateway/remote ID is. Since protocols for RGBW/CCT are different, specify one of `rgbw`, `cct`, or `rgb_cct` as `:device_type. The path `/gateway_traffic` without a `:device_type` will sniff for all protocols simultaneously. |
104 | 102 | 1. `PUT /gateways/:device_id/:device_type/:group_id`. Controls or sends commands to `:group_id` from `:device_id`. Accepts a JSON blob. The schema is documented below in the _Bulb commands_ section. |
105 | 103 | 1. `GET /gateways/:device_id/:device_type/:group_id`. Returns a JSON blob describing the state of the the provided group. |
106 | 104 | 1. `POST /raw_commands/:device_type`. Sends a raw RF packet with radio configs associated with `:device_type`. Example body: |
@@ -227,16 +225,6 @@ irb(main):007:0> puts client.get.inspect |
227 | 225 |
|
228 | 226 | **Make sure that `mqtt_topic_pattern`, `mqtt_state_topic_pattern`, and `matt_update_topic_pattern` are all different!** If they are they same you can put your ESP in a loop where its own updates trigger an infinite command loop. |
229 | 227 |
|
230 | | -##### Customize fields |
231 | | - |
232 | | -You can select which fields should be included in state updates by configuring the `group_state_fields` parameter. Available fields should be mostly self explanatory, with the possible exceptions of: |
233 | | - |
234 | | -1. `state` / `status` - same value with different keys (useful if your platform expects one or the other). |
235 | | -1. `brightness` / `level` - [0, 255] and [0, 100] scales of the same value. |
236 | | -1. `kelvin / color_temp` - [0, 100] and [153, 370] scales for the same value. The later's unit is mireds. |
237 | | -1. `bulb_mode` - what mode the bulb is in: white, rgb, etc. |
238 | | -1. `color` / `computed_color` - behaves the same when bulb is in rgb mode. `computed_color` will send RGB = 255,255,255 when in white mode. This is useful for HomeAssistant where it always expects the color to be set. |
239 | | - |
240 | 228 | ## UDP Gateways |
241 | 229 |
|
242 | 230 | You can add an arbitrary number of UDP gateways through the REST API or through the web UI. Each gateway server listens on a port and responds to the standard set of commands supported by the Milight protocol. This should allow you to use one of these with standard Milight integrations (SmartThings, Home Assistant, OpenHAB, etc.). |
|
0 commit comments