corbanmailloux / esp-mqtt-rgb-led

MQTT RGB LEDs Using JSON for Home Assistant
MIT License
270 stars 74 forks source link

Flash improvement and added colorfade effect #14

Closed citruz closed 7 years ago

citruz commented 7 years ago

I added a small feature so that the light can be used with the flash effect from Home Assistant out of the box. Instead of looking only for the key "flash" in the JSON payload, it will now also check if there is a key called "effect" with the content "flash". Now you can just add

effect: true
effect_list: [flash]

to your light configuration in HA. The number of flashes can be configured in config.h.

citruz commented 7 years ago

I also added the colorfade_slow and colorfade_fast effect which will cycle between 7 colors. The transition times can be configured in config.h. The state is also shown correctly in HA. It is possible to adjust the brightness when in this mode and you can also trigger a flash and it will go back to fading afterwards.

corbanmailloux commented 7 years ago

Hey, @citruz. Thank you for the contribution! I'll try to make time this week to review and test this code, and then I'll merge it in. (I just didn't want you to think I forgot about it.)

citruz commented 7 years ago

Did you already have time to review my changes?

corbanmailloux commented 7 years ago

Hi @citruz. Sorry for the delays, but I got a chance to review your changes and merge them in. I extended the feature a bit to support the new RGBW lights as well. If you get a chance to try out the updated version, please let me know.

Thanks for adding this feature!