Last active
October 31, 2020 14:52
-
-
Save LeoDJ/62aeebd158d12f389d050ad172e229ed to your computer and use it in GitHub Desktop.
MagicHome ESPHome RGB Strip Effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: led_strip | |
platform: ESP8266 | |
board: esp01_1m | |
wifi: | |
ssid: "" | |
password: "" | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "" | |
password: "" | |
captive_portal: | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
ota: | |
interval: | |
- interval: 1s | |
then: | |
lambda: |- | |
if(id(led_strip).get_effect_name().compare("Rainbow") == 0) { | |
id(led_strip).set_gamma_correct(1.0); | |
} | |
else { | |
id(led_strip).set_gamma_correct(2.0); | |
} | |
light: | |
- platform: rgbw | |
name: "LED Strip" | |
id: "led_strip" | |
red: red_channel | |
green: green_channel | |
blue: blue_channel | |
white: white_channel | |
gamma_correct: 2.0 | |
on_turn_on: | |
- lambda: |- | |
id(led_strip).set_gamma_correct(2.0); | |
effects: | |
- lambda: | |
name: Rainbow | |
update_interval: 5s | |
lambda: |- | |
static int state = 0; | |
auto call = id(led_strip).turn_on(); | |
call.set_transition_length(5000); | |
id(led_strip).set_gamma_correct(1.0); | |
if (state == 0) { | |
call.set_rgb(1.0, 0.0, 0.0); | |
} else if (state == 1) { | |
call.set_rgb(0.0, 1.0, 0.0); | |
} else if (state == 2) { | |
call.set_rgb(0.0, 0.0, 1.0); | |
} | |
call.set_publish(false); | |
call.perform(); | |
state += 1; | |
if (state == 3) | |
state = 0; | |
- strobe: | |
name: "RGB Jump" | |
colors: | |
- red: 100% | |
green: 0% | |
blue: 0% | |
duration: 364ms # 165 BPM (Caramelldansen) | |
- red: 0% | |
green: 100% | |
blue: 0% | |
duration: 364ms | |
- red: 0% | |
green: 0% | |
blue: 100% | |
duration: 364ms | |
- flicker: | |
- random: | |
name: "Fast Random Colors" | |
transition_length: 4s | |
update_interval: 5s | |
# Pinout: https://tasmota.github.io/docs/devices/MagicHome-LED-strip-controller/ | |
output: | |
- platform: esp8266_pwm | |
id: red_channel | |
pin: GPIO14 | |
- platform: esp8266_pwm | |
id: green_channel | |
pin: GPIO5 | |
- platform: esp8266_pwm | |
id: blue_channel | |
pin: GPIO12 | |
- platform: esp8266_pwm | |
id: white_channel | |
pin: GPIO13 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment