Skip to content

Commit

Permalink
Rename files to suggest the new, unified sketch. Closes #36. (#38)
Browse files Browse the repository at this point in the history
* Rename files to suggest the new, unified sketch. Closes #36.

* Update README to explain the deprecated folder.
  • Loading branch information
corbanmailloux committed Dec 13, 2017
1 parent 798f6d9 commit 99bdf02
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 14 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 15 additions & 10 deletions README.md
@@ -1,4 +1,4 @@
# ESP8266 MQTT RGB LEDs Using JSON for Home Assistant
# ESP8266 MQTT RGB(W) Lights Using JSON for Home Assistant

This project adds an easy way to create DIY lighting for [Home Assistant](https://home-assistant.io/), an amazing, extensible, open-source home automation system.

Expand Down Expand Up @@ -38,7 +38,7 @@ To set this system up, you need to configure the [MQTT JSON light](https://home-
optimistic: false
qos: 0

# OR: RGB:
# RGB:
light:
- platform: mqtt_json
name: mqtt_json_light_2
Expand All @@ -51,7 +51,7 @@ To set this system up, you need to configure the [MQTT JSON light](https://home-
optimistic: false
qos: 0

# OR: RGBW
# RGBW:
light:
- platform: mqtt_json
name: mqtt_json_light_3
Expand All @@ -69,16 +69,21 @@ To set this system up, you need to configure the [MQTT JSON light](https://home-
3. Restart Home Assistant. Depending on how you installed it, the process differs. For a Raspberry Pi All-in-One install, use `sudo systemctl restart home-assistant.service` (or just restart the Pi).

### The Light Side
I'm using ESP8266-01 microcontrollers for my lights because they are so cheap and small. The downside of the size and price is that programming them can be a bit of a hassle. There are many sites that go into detail, so I won't do it here. You'll need an ESP set up to work with the Arduino IDE. See the readme [here](https://github.com/esp8266/Arduino) for instructions.
I'm using ESP8266-01 microcontrollers for my lights because they are so cheap and small. The downside of the size and price is that programming them can be a bit of a hassle. There are many sites that go into detail, so I won't do it here. You'll need an ESP set up to work with the Arduino IDE. See the readme [here](https://github.com/esp8266/Arduino) for instructions. Another good device to work with is the [Wemos D1 Mini](https://wiki.wemos.cc/products:d1:d1_mini), which has a built-in micro-USB port and is much easier to program.

1. Using the Library Manager in the Arduino IDE, install [ArduinoJSON](https://github.com/bblanchon/ArduinoJson/) and [PubSubClient](http://pubsubclient.knolleary.net/). You can find the Library Manager in the "Sketch" menu under "Include Library" -> "Manage Libraries..."
2. Open the appropriate folder for your lights. For an RGB light, use `mqtt_esp8266_rgb`. For a light that only supports brightness, use `mqtt_esp8266_brightness`, and for an RGBW light, use `mqtt_esp8266_rgbw`.
3. Update the `config-sample.h` file with your settings for pin numbers, WiFi settings, and MQTT settings.
4. Ensure that the `CONFIG_MQTT_CLIENT_ID` setting is a unique value for your network.
5. Set `CONFIG_MQTT_TOPIC_STATE` and `CONFIG_MQTT_TOPIC_SET` to match the values you put in your `configuration.yaml`.
6. Save the configuration file as `config.h`.
7. Open the `.ino` file in the Arduino IDE and upload to an ESP with the correct connections.
2. Open the `mqtt_esp8266_light` project in the Arduino IDE.
3. Update the `config-sample.h` file with your settings for LED type, pin numbers, WiFi settings, and MQTT settings.
1. Review the comments to help with the options. For the `CONFIG_STRIP` option, choose one of `BRIGHTNESS`, `RGB`, or `RGBW`.
2. Ensure that the `CONFIG_MQTT_CLIENT_ID` setting is a unique value for your network.
3. Set `CONFIG_MQTT_TOPIC_STATE` and `CONFIG_MQTT_TOPIC_SET` to match the values you put in your `configuration.yaml`.
4. Save the configuration file as `config.h`.
5. Open the `.ino` file in the Arduino IDE and upload to an ESP with the correct connections.

#### About the `DEPRECATED` Folder
Originally, there were separate Arduino sketches for each of the supported light types. This quickly became redundant and hard-to-maintain, so the new, unified sketch was created.

Please use this (`mqtt_esp8266_light`) sketch going forward. The deprecated sketches will not receive new features and will be removed from the project in the future.

#### Wiring
For an RGB LED strip using N-MOSFETs for control, you'll want to wire it similar to this:
Expand Down
Expand Up @@ -7,7 +7,7 @@

// Leave this here. These are the choices for CONFIG_STRIP below.
enum strip {
BRIGHTNESS, // only one color
BRIGHTNESS, // only one color/only white
RGB, // RGB LEDs
RGBW // RGB LEDs with an extra white LED per LED
};
Expand Down
@@ -1,12 +1,16 @@
/*
* ESP8266 MQTT Lights for Home Assistant.
*
* This file is a joined file for Brightness, RBG and RGBW lights.
* Created DIY lights for Home Assistant using MQTT and JSON.
* This project supports single-color, RGB, and RGBW lights.
*
* See https://github.com/corbanmailloux/esp-mqtt-rgb-led
* Copy the included `config-sample.h` file to `config.h` and update
* accordingly for your setup.
*
* See https://github.com/corbanmailloux/esp-mqtt-rgb-led for more information.
*/

// Set configuration options for pins, WiFi, and MQTT in the following file:
// Set configuration options for LED type, pins, WiFi, and MQTT in the following file:
#include "config.h"

// https://github.com/bblanchon/ArduinoJson
Expand Down

0 comments on commit 99bdf02

Please sign in to comment.