esp8266-yeelight-switch icon indicating copy to clipboard operation
esp8266-yeelight-switch copied to clipboard

Controlling Brightness and colour

Open rp1231 opened this issue 4 years ago • 4 comments

I wonder if it would be possible to add support for controlling brightness and colour by adding two potentiometers or encoders?

rp1231 avatar Feb 08 '21 01:02 rp1231

Yeelight protocol allows this. Exposing these controls via web server is a good portion of coding, but nothing extraordinary. What concerns hardware controls, ESP8266 has got only one ADC input, so it is possible but with one potentiometer + some kind of selector switch. Proper color selection is also something difficult to achieve with one-dimensional control.

Unfortunately, I am busy with other projects now, so I cannot promise this anytime soon. But pull requests are welcome :-)

denis-stepanov avatar Feb 10 '21 20:02 denis-stepanov

Aah ok, I understand. I am new to mcu's and coding in general so it would be out of my skillset... But glad to know that it's possible. Also just wanted to ask if this code would work on an esp32? As that is what I have. Thanks

rp1231 avatar Feb 11 '21 07:02 rp1231

The fork from MateuszKukiela has a second branch called "brightness_and_temp_controll" where the additional Interfaces for controlling the color, brightness, night mode etc. of the bulb have been implemented. There is also code for including two Encoders to control these Settings. I have stripped down that code and am using it now with a ToF Sensor and a motor to open and close my Ikea Death Star and change it's color accordingly.

Mar5in avatar Feb 11 '21 10:02 Mar5in

Thanks @Mar5in; this is an interesting piece of code, even though I personally would not go that far.

I just gave it a quick try with ESP32 Arduino; it does not compile. I believe the Yeelight-specific code should work okay with little-to-no modifications, but some headers are different and some libraries that are used (such as WiFiManager) do not support ESP32. Nevertheless, it should be doable; I'll open a separate issue to track this.

denis-stepanov avatar Feb 11 '21 22:02 denis-stepanov