home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.66k stars 28.82k forks source link

Red RM Mini 3 does not work #30215

Closed tota-5 closed 4 years ago

tota-5 commented 4 years ago

The different (I don't know if it's new or not) RM Mini colored red does not work with broadlink component.

I used broadlink_cli to try to get it into learning mode and got the following:

AttributeError: device instance has no attribute 'enter_learning'

In home assistant, the commands just don't execute in the device, altho the buttons goes from on to off normally.

The firmware on this is 44057 Model: RM mini 3 FCC ID: 2ACDZ-RMMINI3-RM

On intelligent home center app from broadlink, the devices work as intended. It has no firmware upgrades available for it. On e-control app, it shows as unrecognized device, but shows.

Using broadlink manager gives the following: image

It seems that even tho it's looks like exactly the same model, it operates differently and has a different model number and api to authenticate and recieve learn and send signals.

probot-home-assistant[bot] commented 4 years ago

Hey there @danielhiversen, @felipediel, mind taking a look at this issue as its been labeled with a integration (broadlink) you are listed as a codeowner for? Thanks!

tota-5 commented 4 years ago

i have the devices, I can cooperate as much as needed to help integrate this aparentelly new device. I can get online to help figure out what's going on.

dennisadvani commented 4 years ago

Have a similar issue, I have more than one of the RM Mini 3's, the one running firmware v55 works fine with HA but the others running 44057 aren't responding to HA but work with the Broadlink app. HA doesn't error out with send commands but the 44057 units don't seem to be receiving them or responding to them.

felipediel commented 4 years ago

This issue should be addressed to https://github.com/mjg59/python-broadlink, since all the communication with the device is being handled there.

tota-5 commented 4 years ago

Dennis, my red rm mini runs this exact same firmware, so I'm guessing it has nothing to do with the model, but the firmware.

Felipe, how do we proceed in moving the issue?

tota-5 commented 4 years ago

Felipe, I would be happy to lend my time and try to get this older firmware responding to ha broadlink component

felipediel commented 4 years ago

I don't have this device, so it is difficult for me to contribute to this topic, but I encountered some open issues involving the Broadlink RM 3 Mini and the Broadlink API. Perhaps you can help them find a solution, which will be reflected here.

https://github.com/mjg59/python-broadlink/issues/274 https://github.com/mjg59/python-broadlink/issues/307 https://github.com/mjg59/python-broadlink/issues/308

dennisadvani commented 4 years ago

Hey @ariel-madril as @felipediel mentioned earlier, this is not an issue for home assistant to fix. Home assistant uses the python-broadlink module to interact with the devices. I'm watching the three issue threads mentioned above hoping for someone to solve this.

From what I understand, there are a number of variations of RM Mini 3's, the international versions run the v55 firmware and work with python-broadlink out of the box. The Chinese variants can still be discovered but they come up with different types (0x5f36) and run the 44057 firmware however, they cannot send or receive codes successfully, even after adding the 0x5f36 type to the module. Below is an extract of the two discovered types, top one being the working international version that I have.

###########################################
RM2
# broadlink_cli --type 0x2737 --host 192.168.xxx.xxx --mac 164248xxxxxx
Device file data (to be used with --device @filename in broadlink_cli) : 
0x2737 192.168.xxx.xxx 164248xxxxxx
temperature = 0.0

###########################################
RM2
# broadlink_cli --type 0x5f36 --host 192.168.xxx.xxx  --mac 7d4f7axxxxxx
Device file data (to be used with --device @filename in broadlink_cli) : 
0x5f36 192.168.xxx.xxx 7d4f7axxxxxx
temperature = False
felipediel commented 4 years ago

Here are some steps that may be helpful for someone who has this device and is willing to solve the problem:

  1. Create a venv and install https://github.com/mjg59/python-broadlink.
  2. Find a way to control the device through your computer. Try using Broadlink Manager. If it doesn't work, you will need to install an Android emulator on your computer and run e-Control (the next step probably won't work with IHC because it is cloud based).
  3. Install Wireshark and analyze the communication between the application and the device. Check the packages that authenticate, send and receive commands. Are they different from the packages collected from a supported device?
  4. Try to understand communication patterns and replicate them. If you understand what is being done different, you can extend the 'rm' class at https://github.com/mjg59/python-broadlink/blob/master/broadlink/__init__.py to support the device.
  5. PR the solution, many people are waiting for it.
felipediel commented 4 years ago

Here you can find some clues to identify where the problem is: https://github.com/home-assistant/home-assistant/issues/23566.

wchkcn commented 4 years ago

Seems Broadlink and ihc apps config devices differently. Couldn't get HA / Broadlink Manager work with my RM3 mini set up using BL but ihc is ok. Hope it helps.

QuadrifoglioVerde commented 4 years ago

Hi, same problem, but found solution, RM3 Mini 44xxx FW, reset device by long press until led rapidly flash, use BroadLink app to connect to WiFi (keep phone close to RM). AND STOP!! Do nothing more, dont't add anything more, quit app and now everything in HA works! ha... funny right?

dennisadvani commented 4 years ago

Hey @QuadrifoglioVerde and @wai00cheung, I've tried the long reset and configured wifi using the Broadlink e-control app, the new Broadlink app as well as the IHC app. I've also tried re-configuring the wifi using python-broadlink and in all cases, I can't send or receive from the python-broadlink CLI or from HA.

QuadrifoglioVerde commented 4 years ago

@dennisadvani I use ?newer? Broadlink app (not e-control) for configure WiFi , HA and Broadlink manager works, when i configure some device in Broadlink app then nothing works (HA can't connect, Broadlink Manager not responding to learn).

dennisadvani commented 4 years ago

Thanks for confirming @QuadrifoglioVerde are you able to share your firmware number and Device type? I'll try a few more times with the Broadlink app.

goose2600 commented 4 years ago

@QuadrifoglioVerde did you mean the Broadlink app (blue icon and white dots) or Ihc for EU? Do you use in in HA as remote or as switch? Is the FCC ID 2ACDZ-RMMINI3-RM? Can you share your device type?

I tried a couple of times, also creating a new broadlink account, but still not working for me.

QuadrifoglioVerde commented 4 years ago

@dennisadvani and @goose2600 I used this app: https://play.google.com/store/apps/details?id=cn.com.broadlink.econtrol.international and my device is RM mini 3, 2ACDZ-RMMINI3-RM, FW 44057 (my exact steps is remove all configured devices in this app > reset RM, configure WIFi > remove app, and now everything works), there is 2 methods of reset, first long press (rapid flash, ?configure over bluetooth?), and second long press (slow flash, AP mode)) HA code:

switch:
  - platform: broadlink
    host: IP
    mac: 'mac'
    type: rm_mini
    timeout: 15
    friendly_name: Broadlink
wchkcn commented 4 years ago

-mine fw 44059 -cleared everything from the Broadlink mobile app then set up using ihc non-eu and both HA and Broadlink Manager works -suggest to use BL Manager to test the connection first -not sure it might be a region/country specific solution

goose2600 commented 4 years ago

@QuadrifoglioVerde @wai00cheung

Mine (copied from "device info" menu in the android app): Firmware: v44057 Iot Cloud: World Data Cloud: Europe

Python-broadlink discovery cli cannot find any device. BL Manager for Windows find an unknown device and cannot connect to it.

My exact steps are:

I added a switch like @QuadrifoglioVerde but learnig is not working from HA (led is not blinking) and I guess also sending commands is not working.

Siytek commented 4 years ago

Here are some steps that may be helpful for someone who has this device and is willing to solve the problem:

  1. Create a venv and install https://github.com/mjg59/python-broadlink.
  2. Find a way to control the device through your computer. Try using Broadlink Manager. If it doesn't work, you will need to install an Android emulator on your computer and run e-Control (the next step probably won't work with IHC because it is cloud based).
  3. Install Wireshark and analyze the communication between the application and the device. Check the packages that authenticate, send and receive commands. Are they different from the packages collected from a supported device?
  4. Try to understand communication patterns and replicate them. If you understand what is being done different, you can extend the 'rm' class at https://github.com/mjg59/python-broadlink/blob/master/broadlink/__init__.py to support the device.
  5. PR the solution, many people are waiting for it.

I got as far as capturing some traffic in Wireshark, dumps available to download here if anyone wants to take a look.

goose2600 commented 4 years ago

@Siytek I have a couple of questions: Is your mini discoverable via Python-broadlink cli (broadlink_discover)? And what about Broadlink Manger for Windows? The mine is not discoverable via cli (finding no devices). And regarding broadlink manager, looks exactly like the picture in the first post (unknown device).

I am still looking for a way to find the device type for my Mini! I think it is 0x5f36 because the old broadlink plugin for tasker find a 0x5f36 device, anyway I am not sure.

tota-5 commented 4 years ago

@goose2600 I managed to get broadlink manager to pick up my device, but it just shows errors when it does...usually it picks up the other ones I have that works properly. I wanted to post a pic of the error, but I'm trying to get it to connect to the red one, and it doesnt...

I hate how it doesnt let me pick up from a known device list instead of having to rely on the "scan" button...

I would turn the others off, but they are mounted on the ceilling and opening the sockets would mean breaking some of the holder and redoing it latter...

QuadrifoglioVerde commented 4 years ago

@goose2600 do not add device to room, stop at this step, when led stops blinking then quit. btw i choose Czech Republic if that helps. Screenshot_20200203-174551

Siytek commented 4 years ago

@Siytek I have a couple of questions: Is your mini discoverable via Python-broadlink cli (broadlink_discover)? And what about Broadlink Manger for Windows? The mine is not discoverable via cli (finding no devices). And regarding broadlink manager, looks exactly like the picture in the first post (unknown device).

I am still looking for a way to find the device type for my Mini! I think it is 0x5f36 because the old broadlink plugin for tasker find a 0x5f36 device, anyway I am not sure.

@goose2600 yes I can set up my device in Broadlink Manager using my Windows laptop. Once it is on the network I am able to discover it with Python-broadlink cli via my Ubuntu server...

$ sudo ./broadlink_discovery 
Discovering...
###########################################
Unknown
# broadlink_cli --type 0x5f36 --host 192.168.1.121 --mac xxxxxxxxxxxx
Device file data (to be used with --device @filename in broadlink_cli) : 
0x5f36 192.168.1.121 xxxxxxxxxxxx

I have added device ID 0x5f36 to _ init _.py prior to running Broadlink_discovery, not sure if it makes a difference here as I did not try it without the edit. However I am unable to learn commands from any platform other than the Broadlink app.

goose2600 commented 4 years ago

Thanks to everybody.

@QuadrifoglioVerde Now my Mini is configured like yours. Is your device discoverable via Python-broadlink cli? Here is still undiscoverable.

Broadlink manager for Windows keeps discovering an unknown device. In the program log the discovered device type is 24374 (converted to hex is 5f36).

Siytek commented 4 years ago

Thanks to everybody.

@QuadrifoglioVerde Now my Mini is configured like yours. Is your device discoverable via Python-broadlink cli?

Did you try adding 5f36 to __init__.py?

Also when you reset it to discovery mode, is the LED flashing intermittently or quickly/consistently?

QuadrifoglioVerde commented 4 years ago

@goose2600 my device (?PID?) is 3727, and works in all apps, include python-broadlink. If i configure something more in android app then python-broadlink return auth error, HA says connection error, and manager see device but can't establish connection (hangs on connecting... message).

goose2600 commented 4 years ago

Before to test I modified the init.py and while in discovery mode the led is blinking quickly/consistently (I am not in AP mode). Could you please check the python broadlink lib version (mine is 0.12)?

QuadrifoglioVerde commented 4 years ago

@goose2600 i have 0.12

Siytek commented 4 years ago

Before to test I modified the init.py and while in discovery mode the led is blinking quickly/consistently (I am not in AP mode). Could you please check the python broadlink lib version (mine is 0.12)?

Also 0.12, are you running it in venv?

goose2600 commented 4 years ago

Also 0.12, are you running it in venv?

I am not in venv. You?

Siytek commented 4 years ago

Also 0.12, are you running it in venv?

I am not in venv. You?

Yes, I read before that there can be problems otherwise. Try to install it in venv and I think it will work for you

felipediel commented 4 years ago

Based on the operational data provided by @Siytek and the workaround identified by @QuadrifoglioVerde, I am led to believe that this device comes from factory with the ability to operate both locally and via cloud, but, once connected to the cloud, it loses its local capabilities and starts accepting only commands from the cloud (but you can still reset it and choose again).

It looks like Broadlink created a layer of security to prevent malicious users connected to the local network from sending commands to the device. So now you must connect to the cloud with a username and password to send the commands. But python-broadlink API was developed to communicate locally, without any intermediation process. This triangulation does not allow the API to control the device.

If this is confirmed, this is a feature of Broadlink's firmware and I don't think the problem can be easily solved within Home Assistant or python-broadlink API. Therefore, the only solution at this point is to use @QuadrifoglioVerde's workaround: you must reset everything and finish setup after the device is connected to your local network, but before the device is connected to the cloud.

Siytek commented 4 years ago

@goose2600 my device (?PID?) is 3727, and works in all apps, include python-broadlink. If i configure something more in android app then python-broadlink return auth error, HA says connection error, and manager see device but can't establish connection (hangs on connecting... message).

@QuadrifoglioVerde any chance you could confirm if your device ID is --type 0x5f36? It is given in hex on successful discovery using ./broadlink_discovery...

$ sudo ./broadlink_discovery 
Discovering...
###########################################
Unknown
# broadlink_cli --type 0x5f36 --host 192.168.1.121 --mac xxxxxxxxxxxx
Device file data (to be used with --device @filename in broadlink_cli) : 
0x5f36 192.168.1.121 xxxxxxxxxxxx

@felipediel I think you are correct with everything regarding your clear explanation of the situation, however I did try the workaround mentioned by @QuadrifoglioVerde and it did not work for me and also I think @goose2600 also mentioned no success. I will try it again this evening just to be sure though.

QuadrifoglioVerde commented 4 years ago

@Siytek my device is 0x2737, also is visible as PID in broadlink app (if is configured in cloud)

dennisadvani commented 4 years ago

Hey @felipediel , Just wanted to let you know that I have my RM Mini's on a separate Wifi network with no internet access. With the Broadlink App my phone needed internet connection to setup a "remote" on Broadlink, once a remote was setup, both the RM Mini and Phone could be without internet (but must be on the same wifi) and I was able to successfully send IR commands. It looks like the 0x5f36/44057 unit can operate 100% offline even after it has been configured via the broadlink app. I have a feeling that maybe they've changed a key or something around the handshake in this new version.

Siytek commented 4 years ago

Hey @felipediel , Just wanted to let you know that I have my RM Mini's on a separate Wifi network with no internet access. With the Broadlink App my phone needed internet connection to setup a "remote" on Broadlink, once a remote was setup, both the RM Mini and Phone could be without internet (but must be on the same wifi) and I was able to successfully send IR commands. It looks like the 0x5f36/44057 unit can operate 100% offline even after it has been configured via the broadlink app. I have a feeling that maybe they've changed a key or something around the handshake in this new version.

It’s very interesting @dennisadvani and it means it should be theoretically possible to use the device with 3rd party once authentication has been completed.

I think the longer dump I posted shows communication between the App and OpenResty server. Therefore I wonder if both devices obtain a key from OpenResty and then use them to communicate with each other.

I think then it is perhaps possible to capture the handshake between the app and OpenResty to understand how this works. I can certainly capture the packets adding a device to the app if it helps.

KonTiki1957 commented 4 years ago

Hey @felipediel , Just wanted to let you know that I have my RM Mini's on a separate Wifi network with no internet access. With the Broadlink App my phone needed internet connection to setup a "remote" on Broadlink, once a remote was setup, both the RM Mini and Phone could be without internet (but must be on the same wifi) and I was able to successfully send IR commands. It looks like the 0x5f36/44057 unit can operate 100% offline even after it has been configured via the broadlink app. I have a feeling that maybe they've changed a key or something around the handshake in this new version.

Hi all, very strange ... I tried in a similar manner (FW 44057): inhibited web connection of the RM mini3 through teh router immediately after it connected to the wifi LAN with the broadlink app; but no packets sent from HA were executed afterward. I returned it to amazon today anyway while continuing to normally use the older one :-(

lampy2 commented 4 years ago

I was able to use the Broadlink app, and just learn the Amplifier my codes. Afterwards go to: Nokia 8\Internal shared storage\Android\data\cn.com.broadlink.econtrol.international\cache\let\ircode and see the codes there with the corresponding buttons.

Device details: 2ACDZ-RMMINI3-RM Firmware: v44057 Iot Cloud: World Data Cloud: Europe

not able to use the broadlink manager: 'Writing compatible device not detected!'

felipediel commented 4 years ago

Things are starting to get weird. Device type 0x2737 should be naturally supported by the API. And QuadrifolioVerde's solution did not work for device type 0x5f36. Therefore, we are dealing with two different problems here, which may or may not be related.

I think that there may be an authentication error due to a change in the encryption module. Could someone help me to discard this possibility and test a possible solution?

Steps:

  1. Download and run this file.
  2. Wait 5 seconds.
  3. If you see the learning light on the remote, capture a code.
  4. A file called debug.txt will be created.
  5. Download and run this file and repeat the process above.
  6. A file called "test_solution.txt" will be created.
  7. Send me the files.
felipediel commented 4 years ago

Hey @felipediel , Just wanted to let you know that I have my RM Mini's on a separate Wifi network with no internet access. With the Broadlink App my phone needed internet connection to setup a "remote" on Broadlink, once a remote was setup, both the RM Mini and Phone could be without internet (but must be on the same wifi) and I was able to successfully send IR commands. It looks like the 0x5f36/44057 unit can operate 100% offline even after it has been configured via the broadlink app. I have a feeling that maybe they've changed a key or something around the handshake in this new version.

Interesting. This is great news. Can devices operate locally even after a reboot? Or do they need the cloud to authenticate again? Would you mind sending me a Wireshark report containing a local authentication?

bbreton09 commented 4 years ago

@felipediel The led not blink.

debug.txt test_solution.txt

Siytek commented 4 years ago

@felipediel also didn't blink

https://www.dropbox.com/s/k89wzk1cqqxyok2/debug.txt?dl=0 https://www.dropbox.com/s/zc9dca9rto9zpw9/test_solution.txt?dl=0

Siytek commented 4 years ago

Hey @felipediel , Just wanted to let you know that I have my RM Mini's on a separate Wifi network with no internet access. With the Broadlink App my phone needed internet connection to setup a "remote" on Broadlink, once a remote was setup, both the RM Mini and Phone could be without internet (but must be on the same wifi) and I was able to successfully send IR commands. It looks like the 0x5f36/44057 unit can operate 100% offline even after it has been configured via the broadlink app. I have a feeling that maybe they've changed a key or something around the handshake in this new version.

Interesting. This is great news. Can devices operate locally even after a reboot? Or do they need the cloud to authenticate again? Would you mind sending me a Wireshark report containing a local authentication?

Adding the device in the app: https://www.dropbox.com/s/3j10fgn9m5gh5mn/Broadlink%20Add%20Device.pcapng?dl=0

Siytek commented 4 years ago

Hey @felipediel , Just wanted to let you know that I have my RM Mini's on a separate Wifi network with no internet access. With the Broadlink App my phone needed internet connection to setup a "remote" on Broadlink, once a remote was setup, both the RM Mini and Phone could be without internet (but must be on the same wifi) and I was able to successfully send IR commands. It looks like the 0x5f36/44057 unit can operate 100% offline even after it has been configured via the broadlink app. I have a feeling that maybe they've changed a key or something around the handshake in this new version.

@dennisadvani are you sending commands with the app? Mine won't learn or send commands if its not connected to the internet.

felipediel commented 4 years ago

Based on the debug data, authentication is working perfectly on device type 0x5f36. It looks like it can be operated locally without the need for a cloud. These are great news. If this is confirmed the problem can be solved in the API.

The error appears to be in the content of the communication. The flag for entering learning mode is different. This device speaks another language, which we will have to learn by sniffing and decoding the messages exchanged in Wireshark.

bbreton09 commented 4 years ago

@felipediel a remote access can help you ?

dennisadvani commented 4 years ago

Hey @Siytek, Yes I was sending commands via the broadlink app. Doesn't work via python. @felipediel, I'll send some TCP dumps shortly. I spent a couple of nights working on it previously but couldn't get a good capture. My Wifi APs support forwarding packets to wireshark but it comes through as a raw data stream with no protocol categorisation so it's hard to read. I tried setting up an Android Virtual Device but the Broadlink app is unavailable for AVDs and even a downloaded APK refuses to install. I tried wireshark on the Wifi but unsurprisingly I only got ARP requests. Best I can do is the raw packet capture which I'll send through when I get in front of my computer. I'll also restart phone and device and confirm it continues to work after a reboot with no internet.

dennisadvani commented 4 years ago

Hi @felipediel,

I've confirmed that restarting the device and phone/Broadlink App with no internet connection on both still allows full local sending of codes.

Here is a link to the capture files. I've done both v55 working from HA and v44057 from HA and the Broadlink app so you have a few references. Thanks.

felipediel commented 4 years ago

@dennisadvani The communication model you captured differs from the model captured by @Siytek.

Even v55 communication is different than usual. The data must start with hexadecimal values 55 5A A5 AA 55, but yours starts with 5E 3E 02, and the destination port is usually 80, but yours is 5555.

Are you using some kind of intermediary device that may be altering the content of messages?