Skip to content
This repository was archived by the owner on Dec 8, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// Uncomment this if you are experiencing flickering
//#define FASTLED_ALLOW_INTERRUPTS 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been documented to trigger watchdog resets. Better way is to use this (https://github.com/coryking/FastLED) version of the fastled lib with esp8266 support (no serial support, maby add telnet debugging?)

#include "FastLED.h"
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
Expand Down Expand Up @@ -66,9 +68,9 @@ const int BUFFER_SIZE = JSON_OBJECT_SIZE(10);


/*********************************** FastLED Defintions ********************************/
#define NUM_LEDS 186
// Change These value according to your setup!
#define NUM_LEDS 100
#define DATA_PIN 5
//#define CLOCK_PIN 5
#define CHIPSET WS2811
#define COLOR_ORDER BRG

Expand Down Expand Up @@ -183,7 +185,7 @@ void setup() {

setupStripedPalette( CRGB::Red, CRGB::Red, CRGB::White, CRGB::White); //for CANDY CANE
gPal = HeatColors_p; //for FIRE

//setColor(255, 255, 255); // Uncomment this line if you want the strip ON on power-on
setup_wifi();
client.setServer(mqtt_server, mqtt_port);
client.setCallback(callback);
Expand Down Expand Up @@ -385,7 +387,7 @@ bool processJson(char* message) {
if (root.containsKey("color_temp")) {
//temp comes in as mireds, need to convert to kelvin then to RGB
int color_temp = root["color_temp"];
unsigned int kelvin = MILLION / color_temp;
unsigned int kelvin = 1000000 / color_temp;

temp2rgb(kelvin);

Expand Down Expand Up @@ -447,8 +449,7 @@ void reconnect() {
// Attempt to connect
if (client.connect(SENSORNAME, mqtt_username, mqtt_password)) {
Serial.println("connected");
client.subscribe(light_set_topic);
setColor(0, 0, 0);
client.subscribe(light_set_topic);
sendState();
} else {
Serial.print("failed, rc=");
Expand Down
4 changes: 2 additions & 2 deletions Example Home Assistant Configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ light:
optimistic: false
qos: 0

input_slider:
input_number:
porch_animation_speed:
name: Porch Animation Speed
initial: 150
Expand All @@ -50,7 +50,7 @@ automation:
hide_entity: False
trigger:
- platform: state
entity_id: input_slider.porch_animation_speed
entity_id: input_number.porch_animation_speed
action:
- service: mqtt.publish
data_template:
Expand Down