davorf / BlackBeanControl

BlackBeanControl - Broadlink RM 3 Mini (aka Black Bean) control script
230 stars 55 forks source link

Encode and send NEC and samsung48 IR protocol #24

Closed merlokk closed 6 years ago

merlokk commented 7 years ago
merlokk commented 7 years ago

maybe lets merge?

davorf commented 6 years ago

Hello!

Firstly, sorry for such a big delay, I am really preoccupied last few months and haven't had an hour of free time. I've merged your commits, but haven't tested anything because I don't have NEC/Samsung remote. If some kind of problem comes up, I'll try to fix it, but I hope you'll be able to help me with NEC/Samsung part. Thank you for your contribution.

Best regards, Davor

merlokk commented 6 years ago

Hi,

I have tested it and it works in my smarthome. so it must be OK )

Xavier38330 commented 6 years ago

Can you give an example of NEC command and Samsung command ?

I failed to make it work, I always get the error "Command must be 4-byte hex number." or "Command must be 6-byte hex number.".

Thanks.

davorf commented 6 years ago

Hello!

Since I don't have NEC nor Samsung remote, @merlokk would be the right person to answer your question.

Best regards, Davor

merlokk commented 6 years ago

It depends on device's model. It needs to grab it and then send command right for your device. as sample: my samsung

off
   01001101 10110010 11011110 00100001 00000111 11111000 4D B2 DE 21 07 F8
cool
17 01001101 10110010 11111101 00000010 00000000 11111111 4D B2 FD 02 00 FF
...
28 01001101 10110010 11111101 00000010 00000001 11111110 4D B2 FD 02 01 FE
29 01001101 10110010 11111101 00000010 00000101 11111010 4D B2 FD 02 05 FA
30 01001101 10110010 11111101 00000010 00001101 11110010 4D B2 FD 02 0D F2
heat
30 01001101 10110010 11111101 00000010 00111101 11000010 4D B2 FD 02 3D C2
29 01001101 10110010 11111101 00000010 00110101 11001010 4D B2 FD 02 35 CA

last 6 byte HEX data - data to send, before it - data in binary format

merlokk commented 6 years ago

there are too many byte's meaning. so you need to grab and reverse engineer code(

Xavier38330 commented 6 years ago

Sorry, I'm not sure I understand how to use it I have the following NEC sequence to send : 0xCFBB then 0x25. How should I write the BlackBean command ?

merlokk commented 6 years ago

here encoding

D:\py\BlackBeanControl>samsung.py -n 4DB2FD023DC2
hex command=4DB2FD023DC2
bin command=101100100100110110111111010000001011110001000011
2600ca009494143414141434143414141414143414141414143414141414143414341414143414341414143414341434143414341434141414341414141414141414141414141434141414341434143414341414141414141434141414141414141414341434149494941434141414341434141414141434141414141434141414141434143414141434143414141434143414341434143414341414143414141414141414141414141414341414143414341434143414141414141414341414141414141414143414341400072a000d05

and this bin command needs to put into BlackBeanControl.ini

c24 = 2600ca009494143414141434143414141414143414141414143414141414143414341414143414341414143414341434143414341434141414341414141414141414141414141434141414341434143414341414141414141434141414141414141414341434149494941434141414341434141414141434141414141434141414141434143414141434143414141434143414341434143414341414143414141414141414141414141414341414143414341434143414141414141414341414141414141414143414341400072a000d05
merlokk commented 6 years ago

If you want - you just can implement sending command from parts of code in samsung.py and blackbeancontrol.py