mob41 / broadlink-java-api

A clean Broadlink API for Java
MIT License
22 stars 25 forks source link

Problem with sending a command #15

Open deadeye-flint opened 6 years ago

deadeye-flint commented 6 years ago

Hi,

first, thanks for your effort. Cool stuff.

Looks like, sending my command isn't working. I'm doing the following: RM2Device rm2 = new RM2Device(rmip, new Mac(b)); rm2.auth(); rm2.enterLearning(); // this gives me a success and led is on Thread.sleep(10000); // during that time, I press the button on my remote and led goes off byte[] command = rm2.checkData(); rm2.sendCmdPkt(new SendDataCmdPayload(command));

I'd expect that my command is sent again. Or am I doing something wrong? I have a RM pro, I think. It's this one: https://www.amazon.de/Urant-Universal-Intelligent-Controller-Automation-RF-Fernbedienung-Funktioniert-Smart-Remote-Control/dp/B06XKPFBMP/ref=sr_1_4?ie=UTF8&qid=1513372563&sr=8-4&keywords=rm+pro

The same command works when I use the Broadlink app.

Thanks for your help.

mob41 commented 6 years ago

Are you trying to learn a RF remote code? This won’t work currently because this library does not implement sweep frequency for RF, so as Python’s one.

https://github.com/mjg59/python-broadlink/issues/87

Can you try with IR one? It should work

deadeye-flint commented 6 years ago

Hi mob41,

I'm trying with IR. So, the code, I posted should work correctly? Any idea what I could do to find the problem?

Also, is there a way to check, if a new command was learned? Because, I'd assume Thread.sleep for 10 seconds isn't the best way to learn new commands.

Thanks

deadeye-flint commented 6 years ago

I did some other tests. I wanted to try the python version. But I had troubles to let it run. Then, I installed Home Assistant which also has Broadlink support. With this, I can learn and send commands properly. It's interesting. When sending commands with the java api, the led not even turns on. So, it looks like, it's not sending at all. Any ideas? Not sure, if this is important, I'm running the api with java 9 on macOS.

Can you give me the hex code of a proper IR command? I just want to check, if the led turns on when I use a command that works for you.

such a command looks like that: 0000000000000000000000008619052708AD8E80E9210642BAFB6A9FE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4CE27657B1A0FAE00253709E9A7D3A3F4C

Can you approve that this should work? byte[] command = rm2.checkData(); rm2.sendCmdPkt(new SendDataCmdPayload(command));

Also, is it usual, that checkData() always returns data? Or should it only return data, when something was learned? Because in my case checkData() always returns something.

Thanks for your help.

mob41 commented 6 years ago

Hi, I still don't have enough time to test out the results. I will reply you asap!

checkData() will return null if no data is received or error occurred in RM Pro. In my knowledge, once enterLearning() is called, the data in RM Pro is cleared.

deadeye-flint commented 6 years ago

Hi,

no problem. I don't expect a quick reply for a project, you most likely work in your spare time. I actually was surprised that I got a reply so quickly.

Also, I'm now considering using an Harmony Hub instead, because then I also can control my PS3. Unfortunately, then I can't use it for my fan.

Cheers, Hannes

bwssytems commented 6 years ago

This has been resolved with the 1.0.1-SNAPSHOT version that was just merged.

mob41 commented 4 years ago

Have this got resolved? I am gonna to close this and mark it as completed.