From ffe75cd2633fe952b632e934ffb4c270f33a04db Mon Sep 17 00:00:00 2001 From: lance36 Date: Tue, 2 Jan 2018 19:29:15 +0100 Subject: [PATCH 1/2] Various fixes - added disable interrupts - commented some code - turn led on on power - MILLION fix --- ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino b/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino index e1624b8..a6b0a94 100644 --- a/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino +++ b/ESP_MQTT_Digital_LEDs/ESP_MQTT_Digital_LEDs.ino @@ -23,6 +23,8 @@ #include #include #include +// Uncomment this if you are experiencing flickering +//#define FASTLED_ALLOW_INTERRUPTS 0 #include "FastLED.h" #include #include @@ -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 @@ -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); @@ -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); @@ -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="); From 227e0d59aa5a384ffb7c762b1a62bda69a5a6d85 Mon Sep 17 00:00:00 2001 From: lance36 Date: Tue, 2 Jan 2018 19:34:19 +0100 Subject: [PATCH 2/2] Slider replaces number --- Example Home Assistant Configuration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Example Home Assistant Configuration.yaml b/Example Home Assistant Configuration.yaml index fedca29..7c2b636 100644 --- a/Example Home Assistant Configuration.yaml +++ b/Example Home Assistant Configuration.yaml @@ -36,7 +36,7 @@ light: optimistic: false qos: 0 -input_slider: +input_number: porch_animation_speed: name: Porch Animation Speed initial: 150 @@ -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: