Open scobby opened 8 years ago
If you can read perl code have a look at WifiLight for FHEM. The command sequences you have sniffed match the LD382 device in their code https://github.com/herrmannj/wifilight/blob/master/FHEM/32_WifiLight.pm (May be check also FHEM source for newer version as code should be part of FHEM code base now). Search for WifiLight_RGBWLD382_Checksum - may be it is applicable for your case. If you need help on understanding this perl mumbo jumbo we can collaborate on this. I think it would be nice to support more variants of these cheapo LED devices :) I have also found some JS code but it does not look right to me https://github.com/psi-4ward/ld382.js/blob/master/lib/index.js
sub
WifiLight_RGBWLD382_Checksum(@)
{
my ($ledDevice, $msg) = @_;
my $c = 0;
foreach my $w (split //, $msg)
{
$c += ord($w);
}
$c %= 0x100;
$msg .= sprintf("%c", $c);
return $msg;
}
that looks good, but i cant read perl that good to transform that to my bash script ;-) Also i would love to see that directly in the pimatic-led-light. Currently i develop all my addons for pimatic in bash ;-) its the fastest way for me.
ok have found a way to create the checksum:
sum all parts of the HEX COMMAND in decimal without the checksum and modulo % 256 After that convert to HEX
example: 31 fe 00 00 00 00 0f 3e
CHECKSUM is = 3e (62)
HEX = DECIMAL
31 = 49 fe = 254 00 = 0 00 = 0 00 = 0 0f = 15 SUM = 318
MODULO = SUM % 256
318 modulo 256 = 62
and 62 in hex is 3e
ready!
can anyone add this to the plugin?
Yes, I'll have look.
any progress with this? need help?
@mwittig can you implement that fix for wifi370? my bash script doesnt have a backchannel, so the lights always resets in the pimatic installation. Would be fine if this would work with the default pimatic-led-light. If you need any tester, i am here to test the fix!
Hello Everyone,
bought 3x times a wifi370 but they have Firmware 4.02.11T.zj0.1 and that wont work with the standard protocol or i didnt get it running.
I already got some of the commands from wireshark, but i am stuck with the color selection. In theory i know which brackets are for each color. But there is also a fourth bracket with a matching code. I dont know the formula to get each color combination to work. maybe someone have an idea. I attached a file with all combinations i got from wireshark (not complete).
R is RED, G is GREEN, B is BLUE and X is the unknown factor ... Already sorted and calculated to integer 0-255. cleaned_up_sorted.txt
Example for Color: 31 RED GREEN BLUE 00 00 0f MATCHING CODE other codes:
ON: 71 23 0f a3
OFF: 71 24 0f a4
RED: 31 fe 00 00 00 00 0f 3e
GREEN: 31 00 fe 00 00 00 0f 3e
BLUE: 31 00 00 fe 00 00 0f 3e
YELLOW: 31 fe ff 00 00 00 0f 3d PINK: 31 fe 00 ff 00 00 0f 3d
SMOOTH COLOR FADING: 61 25 10 0f a5