openshwprojects / OpenBK7231T_App

Open source firmware (Tasmota/Esphome replacement) for BK7231T, BK7231N, BL2028N, T34, XR809, W800/W801, W600/W601, BL602 and LN882H
https://openbekeniot.github.io/webapp/devicesList.html
1.45k stars 269 forks source link

Easy way to identify sm2135 mapping? #716

Open lmcd opened 1 year ago

lmcd commented 1 year ago

Is there a non-invasive way of determining the sm2135 mapping of a bulb? The default mapping kinda works, but the colours are in the wrong order, and the LED temperature is backwards.

Would be nice if the firmware provided a way of brute forcing combinations until it looks right to the user

openshwprojects commented 1 year ago

Well, if you know that temperature is backwards, then the only possible solution is to swap C and W channels. If you then know that for example, blue and red are swapped, you also know 1:1 what to do... There is no need for guessing. If you know a current map (and you can know it, because u can always start with 0 1 2 3 4), then you will just need one more guess (or should I say attempt) to get it right. Just set red, blue, green, etc and observe what lights up.

lmcd commented 1 year ago

Yeah I thought that, and tried swapping these numbers around in many combinations, but didn't get an accurate result :(

openshwprojects commented 1 year ago

Okay, then... maybe I could add an automatic mechanism for that to Web App. That way it will work but it won't take much space in the firmware itself on the IoT device.

lmcd commented 1 year ago

So I've noticed when the last 2 digits are 4 3, the temperature and the brightness work correctly.

For the first 3 digits, I've tried all these combinations, but the colours still aren't lining up correctly

I've also noticed that the brightness of any given colour appears to be around 50% of what the bulb looks like using the Smart Life app.

lmcd commented 1 year ago

Actually, I've noticed that this is because the web ui is not sending the correct colours for red/blue/green (at least on a Mac). Red is sending as #ff2600 and not #ff0000, and when there's any mixing of channels going on, you get weird results. Maybe a hue rotate is probably better for these bulbs than a full rgb colour picker.

Also, the brightness is still way off - I'm guessing we're not sending the right current value to the SM2135. It looks ok-ish at first glance, then you compare to an identical Smart Life-controlled bulb and the brightness is at least double.

lmcd commented 1 year ago

Also, SM2135_Current only seems to affect CW. The command for me has no effect on RGB at all. For example, setting SM2135_Current 0 0, disables LED temperature altogether, but RGB is unaffected. Boosting this value has a noticeable impact on temperature brightness, but RGB remains unchained.

Edit: submitted separate bug report here: https://github.com/openshwprojects/OpenBK7231T_App/issues/729