raulgbcr / lednetwf_ble

Home Assistant custom integration for LEDnetWF devices
MIT License
25 stars 3 forks source link

LED strip controller working only partially #24

Open lucsansag opened 3 months ago

lucsansag commented 3 months ago

Hello, I have bought a LED strip from Amazon, it comes with a Bluetooth+IR controller that shows up on the Zengge app as a LEDnetWF device. I have tried adding it to Home Assistant with this integration, and I can switch it on and off, but changing the brightness doesn't work (it says on the debug log "Effect Unknown not supported or effect off called") and when changing the color it sets it to ones that are completely different from the ones I choose. Upon initial discovery it says on the debug log that it reports a LED count of 15, but they are actually 177 (they were originally 180 but a section of it became damaged so I cut and re-soldered it). Setting the count manually makes no difference, nor does changing the color mode (it's set to RGB by default, but both the controller and Zengge app say it's GRB). Any specific details I could share to try and pinpoint the issue? Thanks in advance.

8none1 commented 3 months ago

It's possible this is another new type of controller, but it's more likely this is simply a bug in the re-configuration section. I'm going to see if I can work out what's going on.

In the meantime, can you provide a link to the lights you bought?

8none1 commented 3 months ago

I did see some odd behaviours when reconfiguring the color ordering on my test device. The settings got out of sync for a short while, but changing the colours in the colour picker then fixed it.

8none1 commented 3 months ago

Can you provide the device info from this screen:
image

lucsansag commented 3 months ago

Can you provide the device info from this screen: image

Here you go:

Screenshot_2024-07-27-14-49-28-646_io homeassistant companion android-edit

These are the lights: https://www.amazon.es/gp/aw/d/B0CQYMSKNF?psc=1&ref=ppx_pop_mob_b_asin_image

8none1 commented 3 months ago

Wow! OK, so these are indeed a new light that I haven't seen before, and it looks like they have yet another different protocol. I'll get hold of a set and see if I can add support.

This will likely take a while. If you're interested in attempting to add support yourself you will need to capture the bluetooth packets sent from the app. On Android you can enable bt snoop logging to help. It's pretty involved though.

8none1 commented 3 months ago

Found a set on UK Amazon with 50% off :) Ordered.

lucsansag commented 3 months ago

Thanks! I'll share some initial discoveries for now (I've only used your zengge_lednetwf repo's README as a reference, not any actual code):

00 04 80 00 00 0d 0e 0b 3b 23 00 00 00 00 00 00 00 00 00 00 5e 00 52 80 00 00 0d 0e 0b 3b 24 00 00 00 00 00 00 00 00 00 00 5f

The only difference are those zero valued bytes instead of "32" but it's obvious it's not too relevant.

81 08 23 61 23 0D 00 FF 00 00 03 00 F0 2F (green max. brightness)

It seems the second to last byte is always F0 when it's on and 0F when it's off, but that would be redundant considering it's already reporting that in the third byte, wouldn't it?

00 05 80 00 00 08 09 0b 31 00 ff 00 00 00 0f be (green)

Anything you want me to check for the time being?

8none1 commented 3 months ago

That’s a good start, thanks. I’ve got the device now so I will play around and see what I can work out. I’m on vacation for a few weeks so bear with me.

8none1 commented 3 months ago

image

Looks like I got yet another version. Hopefully it speaks the same protocol as yours though.

raulgbcr commented 3 months ago

I'm kinda late to this party, but if there is anything I can do feel free to ping me! 😄

8none1 commented 2 months ago

@lucsansag can you confirm something; are you lights individually addressable?

i.e. can you specify a different colour for each LED? The ones I got (which I finally started looking at today) are NOT addressable.

lucsansag commented 2 months ago

Mine are not addressable either.

8none1 commented 2 months ago

Ok, that explains why setting the LED count doesn't work. For these types of non-addressable LEDs you can't configure the LED count - it's all or nothing. If some of your LEDs aren't working, I suspect that it's due to the damage.

The modes on these are more basic, so I should be able to get that working.

And I think I will be able to get the LED colour ordering working too.

I'll work on it over the coming weeks on my LED strips and hopefully it will work with yours too.

manu5007 commented 1 week ago

Hi all !

I have this one image

https://www.amazon.fr/gp/product/B0CQT8K14X/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1

The LED strip shows in the integration and is discovered as "lednet":

image

On/off is working, but changing the color doesn't work (I've tried all configurations included in the integration).

I just needed to turn it on/off with only the yellow color.

Capturing the command sent from the mobile app for yellow at 100% brightness shows the value

000480000008090b31**ffff00**00000f3e

so for me

yellow_command = bytearray([0x00, 0x04, 0x80, 0x00, 0x00, 0x08, 0x09, 0x0b, 0x31, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x3e])

power_on_command = bytearray( [0x00, 0x04, 0x80, 0x00, 0x00, 0x0d, 0x0e, 0x0b, 0x3b, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x90]) power_off_command = bytearray( [0x00, 0x5b, 0x80, 0x00, 0x00, 0x0d, 0x0e, 0x0b, 0x3b, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x91])

That's all I needed, so I modified the integration to just turn on with yellow and turn off, and removed other entities such as effect and speed control.

From my side, everything works well for my specific need. I'm sharing this information in case someone else finds it useful.

8none1 commented 2 days ago

I've worked out most of the functions on my device:

Single colour strip

Initial set up

Tx

00018000000203072222 - seems to be a "get info" packet 00028000000c0d0b1014180b110c370107000fb2

Rx

046d8000008a8b077b22636f6465223a302c227061796c6f6164223a7b224d41434944223a2231353946373443313435383539324435222c224d4143223a22453439384242353141353937222c224d4944223a22414b3030312d5a4a32313538222c226c766572223a2236325f303030385f32355f3035222c2274696d65223a373537362c224349444c697374223a307d7d

0000   04 6d 80 00 00 8a 8b 07 7b 22 63 6f 64 65 22 3a   .m......{"code":
0010   30 2c 22 70 61 79 6c 6f 61 64 22 3a 7b 22 4d 41   0,"payload":{"MA
0020   43 49 44 22 3a 22 31 35 39 46 37 34 43 31 34 35   CID":"159F74C145
0030   38 35 39 32 44 35 22 2c 22 4d 41 43 22 3a 22 45   8592D5","MAC":"E
0040   34 39 38 42 42 35 31 41 35 39 37 22 2c 22 4d 49   498BB51A597","MI
0050   44 22 3a 22 41 4b 30 30 31 2d 5a 4a 32 31 35 38   D":"AK001-ZJ2158
0060   22 2c 22 6c 76 65 72 22 3a 22 36 32 5f 30 30 30   ","lver":"62_000
0070   38 5f 32 35 5f 30 35 22 2c 22 74 69 6d 65 22 3a   8_25_05","time":
0080   37 35 37 36 2c 22 43 49 44 4c 69 73 74 22 3a 30   7576,"CIDList":0
0090   7d 7d                                             }}

{"code":0,"payload":{"MACID":"159F74C1458592D5","MAC":"E498BB51A597","MID":"AK001-ZJ2158","lver":"62_0008_25_05","time":12674,"CIDList":0}

Tx

000380000004050a818a8b96

On/Off

00148000000d0e0b3b240000000000000032000091 00158000000d0e0b3b230000000000000032000090 00188000000d0e0b3b240000000000000032000091 00198000000d0e0b3b230000000000000032000090

               0019 800000 0d 0e 0b 3b 23 000000000000003200 0090
    counter ---^^^^ |    | |---------| || |                | |  |
    800000 ---------^^^^^^ |         | || |                | |  |
    something -------------^^^^^^^^^^^ || |                | |  |
    on 23 / off 24 --------------------^^ |                | |  |
    something ----------------------------^----------------^ |  |
    probably checksum ---------------------------------------^^^^ 

RGB

000580000008090b31ff000000000f3f
000680000008090b310000ff00000f3f
000780000008090b310000ff00000f3f
000780000008090b310000ff00000f3f
000880000008090b3100ff0000000f3f
0005 800000 08 09 0b 31 ff00000000 0f3f
0006 800000 08 09 0b 31 0000ff0000 0f3f
0008 800000 08 09 0b 31 00ff000000 0f3f

red 000c 800000 08 09 0b 31 ff0000 00000f3f green 0014 800000 08 09 0b 31 00ff00 00000f3f blue 0016 800000 08 09 0b 31 0000ff 00000f3f

red 50% 002e 800000 08 09 0b 31 800000 00000fc0 red 25% 0050 800000 08 09 0b 31 410000 00000f81 red 100% 0061 800000 08 09 0b 31 ff0000 00000f3f

No brightness setting, just scales the colours.

             0005 800000 08 09 0b 31 ff0000 0000 0f3f
counter -----|  | |    | |         | |    | |  | |  |
800000------------^^^^^^ |         | |    | |  | |  |
something ---------------^^^^^^^^^^^ |    | |  | |  |
RGB ---------------------------------^^^^^^ |  | |  |
something ----------------------------------^^^^ |  |
probably checksum -------------------------------^^^^

Effects

                   fx1 "6689","163.475315","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000680000005060b38250164c2","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
                   fx2 "7521","181.970576","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000780000005060b38260164c3","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
                   fx3 "7991","192.591128","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000880000005060b38270164c4","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
                   fx4 "8442","202.940888","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000980000005060b38280164c5","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"

Fx 4 Bri 50%           "9502","227.106233","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000a80000005060b3828013394","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
Fx4 Bri 25%           "11156","264.591803","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000d80000005060b382801197a","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
Fx4 Bri 25% Speed 50% "12402","292.852346","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000e80000005060b3828101989","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
Fx4 Bri 25% Speed 25% "13174","310.357713","Master_0xaf9a93d4","Slave_0xaf9a93d4","ATT","46","000f80000005060b3828181991","Sent Write Command, Handle: 0x0017 (Unknown: Unknown)"
                           0006 800000 05060b38 25 01 64 c2
                           0007 800000 05060b38 26 01 64 c3
                           0008 800000 05060b38 27 01 64 c4
                           0009 800000 05060b38 28 01 64 c5
                           000a 800000 05060b38 28 01 33 94
                           000d 800000 05060b38 28 01 19 7a
                           000e 800000 05060b38 28 10 19 89
                           000f 800000 05060b38 28 18 19 91
counter etc ---------------^^^^^^^^^^^ |      | || || || ||
effects mode --------------------------^^^^^^^^ || || || ||
effect number ----------------------------------^^ || || ||
speed?  see below ---------------------------------^^ || ||
brightness -------------------------------------------^^ ||
checksum?------------------------------------------------^^

Speed

Speed ranges from 0x1F (d31) to 0x01 (d1). 0x1F is slowest and 0x01 is fastest. Strange.

Candle effect

Candle low 100% 100% : 0010 800000 09 0a 0b 39 d1 ff 00 00 01 64 01 6f Candle High 100 100: 0011 800000 09 0a 0b 39 d1 ff 00 00 01 64 03 71 Candle High 50ish 100: 0012 800000 09 0a 0b 39 d1 ff 00 00 01 2e 03 3b Candle High bri50 speed25: 0013 800000 09 0a 0b 39 d1 ff 00 00 18 2e 03 52

                             0013 800000 09 0a 0b 39 d1 ff 00 00 18 2e 03 52
counter etc -----------------^^^^ ^^^^^^ |            | |      | || || || ||
candle mode stuff -----------------------^^^^^^^^^^^^^^ |      | || || || ||
rgb? ---------------------------------------------------^^^^^^^^ || || || ||
speed (as above 0x01 fast 0x1F slow) ----------------------------^^ || || ||
brightness 0x01 to 0x64 (1-100%) -----------------------------------^^ || ||
high 03 / med 02 / low 01 ---------------------------------------------^^ ||
checksum? ----------------------------------------------------------------^^