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:
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.
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!
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.
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.
This issue should be addressed to https://github.com/mjg59/python-broadlink, since all the communication with the device is being handled there.
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?
Felipe, I would be happy to lend my time and try to get this older firmware responding to ha broadlink component
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
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
Here are some steps that may be helpful for someone who has this device and is willing to solve the problem:
Here you can find some clues to identify where the problem is: https://github.com/home-assistant/home-assistant/issues/23566.
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.
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?
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.
@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).
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.
@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.
@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:
-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
@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.
Here are some steps that may be helpful for someone who has this device and is willing to solve the problem:
- Create a venv and install https://github.com/mjg59/python-broadlink.
- 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).
- 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?
- 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.
- 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.
@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 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...
@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.
@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.
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).
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?
@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).
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)?
@goose2600 i have 0.12
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?
Also 0.12, are you running it in venv?
I am not in venv. You?
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
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.
@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.
@Siytek my device is 0x2737, also is visible as PID in broadlink app (if is configured in cloud)
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.
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.
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 :-(
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!'
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:
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?
@felipediel The led not blink.
@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
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
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.
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.
@felipediel a remote access can help you ?
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.
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.
@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?
Okay, we are getting close. Here's what I've found so far by analyzing the data you gave me:
Device type 0x5F36 needs different values for 0x24 and 0x25 in data packets. The other models respond to 0x2A and 0x27, respectively, but this model needs 0x36 and 0x5F.
Here is a possible solution, which may be incomplete, but it is at least half the way.
Would you mind helping me test it?
Steps:
Here is what this test script discovers on my network (2 "0x5F36" there, both having the same issue). Hope this helps!
I had to update the rm_5f36 init method to:
class rm_5f36(device):
def __init__(self, host, mac, devtype):
device.__init__(self, host, mac, devtype)
self.type = "RM Mini 3"
Nope, not even close. Sorry guys, that was the only part of the message that I was able to access. From 0x38 onwards it is encrypted and I don't have the primary key. We need to extract it somehow, so that we can replicate the data in the API. I'll let you know if I succeed.
Hey @felipediel,
Thanks for looking into it. Yes, I'm using my Wifi APs to stream the data to wireshark via port 5555 hence the discrepancy. I wasn't able to capture the Wifi to Wifi traffic any other way. I'll be able to test your new code in a couple of hours, thanks!
@dennisadvani No need to test, it doesn't work. But thanks anyway.
Nope, not even close. At least now we know that those hexa are probably related to encryption and doesn't need to be changed (they were different because the keys were different).
Sorry guys, that was the only part of the message that I was able to access. From 0x33 onwards it is encrypted and I don't have the primary key. We need to extract it somehow, so that we can replicate the data in the API. I'll let you know if I succeed.
@felipediel great work and seems like good progress. Thank you! Would the expect the key to change hands during the handshake? If so, can we just extract it with Wireshark?
Hey @felipediel,
In case you need to verify the payload when you crack the encryption, the code I was sending in the successful send from Broadlink app to v44057 unit in the wireshark capture was:
26001c000c0b09160b0916140a0b161315150b0a0b09141616090a160a000d05000000000000000000000000
Base64: b'JgAcAAwLCRYLCRYUCgsWExUVCwoLCRQWFgkKFgoADQUAAAAAAAAAAAAAAAA='
I am having a problem as well. My broadlink rm mini 3 (firmware v55) i have it as a switch , see code, it works with climate component i have set up but i see the following logs:
Setup of switch platform broadlink is taking over 10 seconds.
8:31 PM __main__.py (WARNING)
Failed to connect to device
8:31 PM components/broadlink/switch.py (ERROR)
- platform: broadlink
host: 192.168.1.4
mac: "C8:F7:42:17:53:DD"
timeout: 30
type: rm_mini
Any ideas how to fix that? I can connect to the device from Broadlink manager on my Windows computer and in general it works fine in my HA i just want to get rid of these warning/error from my logs
@Stefos13 v55 is supported. Make sure the device is connected to the local network and the IP address is correct.
@Stefos13 v55 is supported. Make sure the device is connected to the local network and the IP address is correct.
It is connected. As i said, i can connect to the device from my windows laptop using broadlink manager. I can also connect to the device through the android device I have and also the climate component in HA it uses the broadlink just fine so i can send commands from HA. I can also ping it without any problems. That's why is confusing for me..
@Stefos13 That's weird. I can have a look later. Would you mind opening a new issue as it is a different problem? In the meantime, you can try the remote platform. It is best suited for learning and sending commands (if you don't want a switch).
@Stefos13 Just out of curiosity, are you using more than one Broadlink platform? Perhaps this is the problem. When this integration was developed, it was not expected that there would be multiple platforms operating together (and controlling the same device). So maybe one authentication is blocking the other.
We definitely need some refactoring to better integrate the platforms and make this integration behave as a unit, but as we have more urgent problems this will have to be postponed.
@Stefos13 That's weird. I can have a look later. Would you mind opening a new issue as it is a different problem? In the meantime, you can try the remote platform. It is best suited for learning and sending commands (if you don't want a switch).
Once I'm have time i will open one.. I tried remote as well and i'm getting the same error.
@Stefos13 Just out of curiosity, are you using more than one Broadlink platform? Perhaps this is the problem. When this integration was developed, it was not expected that there would be multiple platforms operating together (and controlling the same device). So maybe one authentication is blocking the other.
We definitely need a refactoring to better integrate the platforms and make this integration behave as a unit, but as we have more urgent problems this will have to be postponed.
No, I have only one Broadlink RM Mini 3, nothing else.
@Stefos13 I meant a platform, like 'switch', 'cover' and 'remote'. Are you using more than one? Or maybe some custom component? How are you controlling the climate?
Now, back to 0x5F36. Yesterday I developed a module to completely hack the Broadlink protocol. Heavy artillery. I managed to intercept the key and decrypt all communication. Now I just have to analyze the data and modify the API. As soon as I finish it, I'll put it here for testing.
@Stefos13 I meant a platform, like 'switch', 'cover' and 'remote'. Are you using more than one? Or maybe some custom component? How are you controlling the climate?
No, i have only that one.. I'm just using it for my climate component to control my AC. I don't recall settting it up for anything else.
I am using SmartIR to controll my AC. I have set up a switch for the broadlink RM, and In my climate config i had to setup the "controller_data" with the IP from the broadlink RM. Do you think that setting up a switch and also providing the IP of the broadlink for the climate data_controller is trying to connect twice?
@Stefos13 Yes, that is definitely the problem. Choose one for now, but don't waste too much time on it. I am developing a much better climate control component, which is compatible with this integration. Coming soon.
@Stefos13 Yes, that is definitely the problem. Choose one for now, but don't waste too much time on it. I am developing a much better climate control component, which is compatible with this integration. Coming soon.
I just removed the climate component and i left only the switch but i got the same error so i don't think that this is the problem.
I will check again all my configuration files to see if i have antyhing else and if not i will open another issue.
Now, back to 0x5F36. Yesterday I developed a module to completely hack the Broadlink protocol. Heavy artillery. I managed to intercept the key and decrypt all communication. Now I just have to analyze the data and modify the API. As soon as I finish it, I'll put it here for testing.
Great news @felipediel, happy to be one of the test pilots once it’s ready
Now, back to 0x5F36. Yesterday I developed a module to completely hack the Broadlink protocol. Heavy artillery. I managed to intercept the key and decrypt all communication. Now I just have to analyze the data and modify the API. As soon as I finish it, I'll put it here for testing.
Great news @felipediel, happy to be one of the test pilots once it’s ready
Same here! lets figure this out!
Just an update. Somewhere in one of my yaml files there was one configuration for broadlink platform, which also had wrong IP, removed it and no more annoying warnings..
I have already identified the problem with 0x5f36. There is a communication failure due to a poor implementation of the QUIC protocol in the API. There is no Python module to handle the legacy version of this protocol, so I am studying its documentation to reimplement it. It will be a lot of work, don't hold your breath.
Are there known ways to downgrade the Broadlink firmware on those units? That would be a way to work around this issue...
This can be done in the official app, but honestly, I don't recommend you to try it.
Changing the firmware is an invasive operation. If something goes wrong, you may end up bricking the device.
This firmware is ok, we can work with it. I'm working on a solution that will be simpler for you, I just need some time.
I also got an RM Mini 3 with -unfortunately- 44057 firmware installed in it. Following QuadrifoglioVerde's workaround i am able to successfully register the device in HA, but the learning service fails to capture any IR code.
When starting the learn command service, i observe the following:
1) i get back a 2020-02-21 14:24:32 ERROR (MainThread) [homeassistant.components.broadlink.remote] Failed to learn 'Turn on/television': no signal received
2) No red light on the device flashes (i've read somewhere that it shall)
3) Using a python debugger, i see that the device responds to the "enter_learning" command with the hex below. Not sure what it means - the response isn't verified anywhere in the code.
4) I start pushing the button of the remote and keep watching what happens in the IDE. There is some sort of polling towards the device via the "check_data" api, Multiple responses come, all mapped to an 65531 error. Not sure again what it means - googling didnt help.
5) Not sure that it matters - the device isnt recognized by the Broadling Manager, i get back a:
Found device : Unknown [192.168.2.163]
Writing compatible device not detected!
Any ideas? Using Is the workaround of QuadrifoglioVerde, has anyone managed to successfully use the learning service? Is the interface to the device somewhere documented?
Enter_Learning response:
b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb7\xd3\xfb\xff*'\xee\x03L\xa7$\xdf\xa7z\x9ay\x01\x00\x00\x00\xaf\xbe\x00\x00\xce\xf1_\x15\x05\xf3R\xbfk\x7fSb\xb9,\xbb\xbd"
Hi,
Kindly ask for updates on this topic. I am trying to integrate HA and Broadlink RM-Pro using the latest version of the ihc
. I am going to try using older app versions, could it a workaround? Thanks.
No luck using broadlink CLI so far. But I was able to find a fair workaround for now:
ihc
, remove ihc
.@tsdaemon can you please provide more details ? which firmware are you in? is your device 0x5f36?
Hi, any updates on a solution for @dlavrantonis issue? I have the same firmware (v44057) and have been unable to connect my RM Mini 3 to HA as well as Broadlink Manager (keep getting the error 'Writing compatible device not detected!'). I have tried configuring the device to connect to Wi-Fi via both the IHC and Broadlink apps (using both AP and Bluetooth modes), to no avail.
Hi guys. Sorry for the delay.
I just solved some problems with the encryption algorithm.
Would you mind helping me test a possible solution?
Steps:
@Siytek would you mind helping with this test?
Even if this solution does not work completely, with your debug data I will be able to obtain your device key and decrypt the Wireshark captures you sent to us.
@felipediel here it is, hope it helps. No lights for me.
debug.txt
23:51:46,783 root INFO Broadlink API Debug
23:51:46,783 __main__ DEBUG Starting discovery...
23:51:46,788 __main__ DEBUG [Request]
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\xfb\xff\xff\xff\xe4\x073\x17\x14\x02\x19\x02\x00\x00\x00\x00\xc0\xa8V I\xc2\x00\x00\xfc\xc6\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00')
23:51:46,894 __main__ DEBUG [Response]
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\xfb\xff\xff\xff\xe4\x073\x17\x14\x02\x19\x02\x00\x00\x00\x00\xc0\xa8V I\xc2\x00\x00\xa4\xd4\x00\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x006_$V\xa8\xc0X%{\xa7\xdf$\xe6\x99\xba\xe8\x83\xbd\xe9\x81\xa5\xe6\x8e\xa7\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x01')
23:51:51,788 __main__ DEBUG [Device 0]
23:51:51,788 __main__ DEBUG Host: ('192.168.86.36', 80)
23:51:51,788 __main__ DEBUG Mac: 58257ba7df24
23:51:51,788 __main__ DEBUG Type: 0x5f36
23:51:51,788 __main__ DEBUG Starting authentication...
23:51:51,788 __main__ DEBUG [Request]
bytearray(b'Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x006\xf7\x00\x00*\'e\x00_\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xa1\xc4\x00\x00E4R\xe7\xf9.\xda\x95\x83D\x93\x085\xef\x9am\xfbi-\xc3p\xb9\x04C\xac\\xd6?\xbbS\xad\xfa\x08\x81L\xa7\xf8\xcfAq\x002\x8eW\x0c;\x86\xc9M\x05p\x84I\xa3\x89\xe2\x9a\xe1\x04T6\xa0[\xdd\xdc\x02\xc1a\xaf\x13%\xe8~\x19\xb0\xf7\xd1\xce\x06\x8dB\xe2\xd6\xde\x8d\xd8\xe9\xca"I\x08\x81[s\xbe&')
23:51:51,799 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\xca\xff\xff*'\xe9\x03_\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xaf\xbe\x00\x00", ('192.168.86.36', 80))
23:51:51,799 __main__ DEBUG Authentication error.
23:51:51,799 __main__ DEBUG Entering learning mode...
23:51:51,799 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00w\xd8\x00\x00*\'j\x00`\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb2\xbf\x00\x00\xe8o\xednHl\x04N\x89\xf2\xe9\xa0\xca\x9c\x00$\x8f\xd6DcB\x83.J\xc8\xda\xf8\xe6\x97\x97Q\x01")
23:51:51,810 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00g\xca\xf9\xff*'\xee\x03`\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb2\xbf\x00\x00", ('192.168.86.36', 80))
23:51:51,810 __main__ DEBUG Checking for data...
23:51:51,810 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xd4\x00\x00*\'j\x00a\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:51,818 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00i\xca\xf9\xff*'\xee\x03a\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:52,819 __main__ DEBUG Checking for data...
23:51:52,819 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcb\xd4\x00\x00*\'j\x00b\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:52,828 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00j\xca\xf9\xff*'\xee\x03b\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:53,828 __main__ DEBUG Checking for data...
23:51:53,828 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcc\xd4\x00\x00*\'j\x00c\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:53,842 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00k\xca\xf9\xff*'\xee\x03c\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:54,842 __main__ DEBUG Checking for data...
23:51:54,842 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcd\xd4\x00\x00*\'j\x00d\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:54,852 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00l\xca\xf9\xff*'\xee\x03d\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:55,853 __main__ DEBUG Checking for data...
23:51:55,853 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\xd4\x00\x00*\'j\x00e\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:55,877 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00m\xca\xf9\xff*'\xee\x03e\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:56,877 __main__ DEBUG Checking for data...
23:51:56,877 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcf\xd4\x00\x00*\'j\x00f\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:56,885 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00n\xca\xf9\xff*'\xee\x03f\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:57,885 __main__ DEBUG Checking for data...
23:51:57,885 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\xd4\x00\x00*\'j\x00g\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:57,894 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00o\xca\xf9\xff*'\xee\x03g\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:58,895 __main__ DEBUG Checking for data...
23:51:58,895 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\xd4\x00\x00*\'j\x00h\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:58,904 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00p\xca\xf9\xff*'\xee\x03h\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:51:59,905 __main__ DEBUG Checking for data...
23:51:59,905 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd2\xd4\x00\x00*\'j\x00i\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:51:59,928 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00q\xca\xf9\xff*'\xee\x03i\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:52:00,928 __main__ DEBUG Checking for data...
23:52:00,928 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\xd4\x00\x00*\'j\x00j\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00:\x01\x13s\x00\xdcq- \xb6\x13_\x84\xdd\xe1}Og\x0c\xd8%\xdaQh\x97\x1c\xa6\xb6\xaaN\'\x1e")
23:52:00,938 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00r\xca\xf9\xff*'\xee\x03j\x0fX%{\xa7\xdf$\x00\x00\x00\x00\xb3\xbf\x00\x00", ('192.168.86.36', 80))
23:52:01,938 __main__ DEBUG Failed to learn: no code received.
@felipediel
I shared my experience.
My rm mini3 is v44061 buy from china jd.com
SDK version show: China.
Broadlink Manager doesn't work, home-assistant too.
But After I upgrade HA from 0.993 to 1.05x.
It works very well.
I have another device, rm pro plus.
This device buy from taobao, SDK version show Japan and version is v052
It could be scanned by Broadlink Manager.
I could only use rm pro plus to learn the code and assign it to rm mini3
@nickollasaranha I just fixed a silly mistake I made in the previous file. Would you mind downloading the new file and trying again?
Everyone is invited to test. I think we are close to the solution.
@tideteam Thanks for the report.
@felipediel I will try it later! Thanks for your dedication lets finish this 👍
Hey @felipediel,
Thanks again for your efforts and persistence. The learning light came up for the v55 but with the 44057 firmware, learning light didn't come on. debug.txt
@Siytek would you mind helping with this test?
Even if this solution does not work completely, with your debug data I will be able to obtain your device key and decrypt the Wireshark captures you sent to us.
Yes sure thing @felipediel sorry for the delay, think it’s different time zones and only just saw the messages here. Will take a look as soon as I’m back from work later.
@felipediel
Thank you for your persistence and for helping us!
It didn't work for me either. The light did not come on.
My Broadlink was not found on the network. I only kept what has a problem connected ... On IHC works normally.
Hi guys. Thanks for the debug data.
There's definetly a padding problem on encryption. Let's try ANSIX923 for CBC mode padding.
Steps:
@jhonathas I think your firewall is blocking discovery on your computer, but this is another problem
@felipediel still no lights on this latest file.
@nickollasaranha Thanks!
Okay, at least now we know exactly where the problem is. We need to find out which CBC mode padding algorithm is being used by Broadlink. It is neither PKCS7 nor ANSIX923, although it looks a bit like this.
No more tests for now. I will keep you informed.
@felipediel thanks for your effort. Let me know if you need any help with tests :)
@Siytek my device is 0x2737, also is visible as PID in broadlink app (if is configured in cloud)
New (latest) Broadlink app for iOS shows PID 3727 for me.
Simone
Same here, no light sadly
debug.txt
@Siytek Your debug.txt would still be interesting for me to decrypt your Wireshark captures and analyze how the device is controlled by the official app. This is the file I need you to run.
Sorry for the insistence, but your captures are really good and decrypting them is the best chance we have.
@bbreton09 I don't think it would be useful at this point. Captures need to be made in Wireshark while controlling the device with the official app running on an Android emulator. It's a very tricky step that has already been completed by @Siytek, I just need to intercept his device key to decrypt the communication. But thanks for your promptness.
I don't know if it helps, but for me, in the version that Broadlink doesn't work with HA (44057), it also doesn't work with Broadlink Manager. Broadlink that runs with HA (44059) also works in Broadlink Manager.
Hey @jhonathas, when you say 44059 works in HA, you can set it up the RM Mini 3 as a switch and send and learn codes using Home Assistant natively?
Only code sending works. The learn part does not work on any version.
Strange, I did have an option to upgrade a few weeks ago but I held off to avoid adding variables to the work being done in this thread but I don't seem to have the option anymore. 44057 seems to be the latest version according to both the Broadlink and IHC apps. What's everyone else finding?
CC: @jhonathas
@dennisadvani I wish I had the option to update because my last version is 44057, and the 3 broadlinks that I have in this version, don't work. Since what I have in version 44059 can control the devices, the learning mode just doesn't work.
Hi guys. I just packaged the tools I've developed to hack the Broadlink protocol. They still don't have documentation, but I left some examples for you to understand how they work. Now you can easily decrypt, filter and analyze the messages exchanged by the device, whether they come from Wireshark or the debugging tool that I have already made available. Make good use of it and I hope someone can come up with a solution.
Some clues to solve 0x5f36's problem:
The best way to solve this problem is to access a COMMAND_REQUEST from the official app and understand what is going on.
@felipediel, I have wireshark on board of my Fritzbox router, so maybe I can help.
Let me know what I can do and I'll go for it.
My device (info from mobile app):
Model: RM MINI 3
FCC ID: 2ACDZ-RMMINI3-RM
Company: Hangzhou Gubei Electronics Technology Co. Ltd.
Made: China
PID: 3727
IoT Cloud: 10.197.219.180
Firmware: v44057
Data Cloud: China
SDK: 2.13
One more info: Broadlink Manager was not working until I did a reset and reconfigured the device with the oldest app, E-Control.
Simone
@chemelli74 Sure, any capture from the official app is welcome now. Just make sure to run this file and send me the debug.txt so I can intercept the key and decrypt the packets.
I have decrypted, filtered and tabulated all the captures we have done so far. If anyone wants to take a look, it's all here, including the test files. Maybe with more people looking at the problem we will be able to solve it faster.
We still need a capture in which the device is being controlled locally by the official app. I was unable to decrypt @Siytek's captures because there is a cloud in the middle, so I need to intercept his key in another way (debug.txt). I was also unable to decrypt @dennisadvani's captures because the router scrambled the data.
Been away for a couple of days but finally got round to it! Hope there is something useful in there for you @felipediel
@Siytek This debug comes from test_solution4.py. I need a debug coming from this file.
Hey @felipediel,
I had another go at the packet capture, this time with wireshark's monitor mode to capture packets. The RM Mini 3's MAC ends with 3e:ba and I was using IHC to send commands. Link to the capture here.
@chemelli74 Sure, any capture from the official app is welcome now. Just make sure to run this file and send me the debug.txt so I can intercept the key and decrypt the packets.
Which of the 3 officlal apps you want me to use ?
Simone
@dennisadvani Scrambled :( How about running the app on BlueStacks?
@Siytek I couldn't extract your key because your device failed to authenticate. But I found something interesting that confirms my first hypothesis.
So the last byte is evil and we need to get rid of it. If this byte is set, your device won't authenticate locally. My guess is that when you add the device to the new Broadlink App and select a cloud, your device loses it's local capabilities and this byte is set. The only way to rollback the process is by resetting the device and doing the workaround proposed by @QuadrifoglioVerde.
Would you mind confirming it by doing the workaround and running the debug tool again?
@chemelli74 Preferably e-Control app running on BlueStacks.
@dennisadvani Scrambled :( How about running the app on BlueStacks?
@Siytek I couldn't extract your key because your device failed to authenticate. But I found something interesting that confirms my first hypothesis.
- Here is a HELLO_RESPONSE coming from @bbreton09's device. Last byte is zero and bytes 48 to 51 carry some information. This device authenticated successfully.
- Here is a HELLO_RESPONSE coming from your device. Same device, same firmware, but check the last byte. Last byte is set and bytes 48 to 51 are empty. This device failed to authenticate.
So the last byte is evil and we need to get rid of it. If this byte is set, your device won't authenticate locally. My guess is that when you add the device to the new Broadlink App and select a cloud, your device loses it's local capabilities and this byte is set. The only way to rollback the process is by resetting the device and doing the workaround proposed by @QuadrifoglioVerde.
Would you mind confirming it by doing the workaround and running the debug tool again?
@chemelli74 Preferably e-Control app running on BlueStacks.
Very interesting @felipediel! I can confirm that resetting the device back to AP pairing mode and then using Broadlink Manager to configure it gave me a debug file with successful authentication. Let me know what you think, grab the file here.
Great! The authentication problem is solved.
Now we need to send a COMMAND_REQUEST that works.
I was unable to decrypt your captures with your local key. The cloud is triangulating the authentication, so the keys are different. But one thing I noticed is that the payload of the COMMAND_REQUEST is half the size of the payload being sent by the API.
So let's play with CBC mode padding algorithm again. Here's the test file.
Hi, my debug for the test solution 5. No blink led.
Hey @felipediel, I was able to get the Broadlink apps working in BlueStacks but unfortunately BlueStacks creates a NAT network of its own preventing it from properly communicating directly with the RM Mini 3. It can talk to the internet, just not to the device. Couldn't find a way to bridge the network.
@felipediel glad it helped but sadly not surprising that the cloud is triangulating the key as my device ceases to function even with the official app when I disconnect the internet.
Here's my latest debug output: debug5.txt
I did some reading and am wondering if I can capture the triangulated key with a Kali Linux based router setup on a RPi. If I successfully captured the traffic between the RM Mini and the cloud by running Wireshark on the router, would the dump give you what you need?
@dennisadvani if you have an iOS device you can use rvictl with Wireshark to capture the traffic on the iOS device (running Broadlink app) - it's Mac based but I found this for windows/linux
@felipediel glad it helped but sadly not surprising that the cloud is triangulating the key as my device ceases to function even with the official app when I disconnect the internet.
Here's my latest debug output: debug5.txt
I did some reading and am wondering if I can capture the triangulated key with a Kali Linux based router setup on a RPi. If I successfully captured the traffic between the RM Mini and the cloud by running Wireshark on the router, would the dump give you what you need?
I don't think I would be able to decrypt those messages, since the cloud controls the keys. It would be more difficult to trick her into handing over the key, which is the method I am using for local communications.
Let's wait for @dennisadvani, maybe he can capture a local communication.
@dennisadvani if you have an iOS device you can use rvictl with Wireshark to capture the traffic on the iOS device (running Broadlink app) - it's Mac based but I found this for windows/linux
I can confirm that the second option works gracefully on Windows. If you are using Linux Mint, however, you will have a hard time installing libimobiledevice, as this distribution uses another library for interacting with iOS and libimobiledevice is not available in the default repository.
I discarded previous tests that did not pass the authentication step and I created a new test with things that may be worth testing again. Hope it works.
I discarded previous tests that did not pass the authentication step and I created a new test with things that may be worth testing again. Hope it works.
Still nothing from the illusive white LED... debug6.txt
Okay, I just found something interesting.
This is the payload of the COMMAND_REQUEST being sent by the API:
>>> payload = b'\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
This is the payload checksum:
>>> checksum = bytes([0xb2, 0xbe])
Let's convert it to integer as little endian:
>>> checksum = int.from_bytes(checksum, 'little')
Then we subtract the magic number 0xbeaf:
>>> checksum = checksum - 0xbeaf
The result is 3, which matches the sum of the payload.
>>> checksum
3
>>> checksum == sum(payload)
True
This is the payload checksum of the COMMAND_REQUEST being sent by the official app:
>>> checksum = bytes([0xb4, 0xbe])
Now let's repeat the above process. The result is 5. So there are only two extra bits that we need to find out their position.
The payload could be in this list, for example:
>>> some_possibilities = [
b'\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00',
b'\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01',
b'\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
]
So we can use brute force to find out the right combination. There are only 15504 ways to group 5 bits in 16 places. I am creating a program that will take at most 4h18 to find the answer. I will keep you informed.
Hey @felipediel, @Siytek,
Good news, managed to get a clean capture directly. You can find it here. I used the Broadlink app to send commands to a 44057 based RM Mini 3. In the end I used the Memu emulator which supports bridge mode networking. Let me know if you need any other captures.
Edit: Forgot to mention that the emulator and RM Mini 3 didn't have access to the internet but I temporarily provided internet to the emulator to login and configure a remote in Broadlink.
@felipediel @dennisadvani some great progress!
More than happy to run the brute force on my Linux server when it’s ready.
@dennisadvani Great! Captures are very clean. I'm gonna try to decrypt them right now. I don't know if I am happy or sad, because I was really excited about a brute force script that I just finished. Well, maybe if I can't decrypt your messages it will serve as a last resource.
@dennisadvani I don't have your key on my files. Please run this file and send me the debug.txt. The evil byte must be disabled.
Here you go @felipediel.
We did it! Here is the local communication. Make sure to disable line wrap to get a good view of it.
The communication model is quite different. What were you doing during these captures?
Hey @felipediel, I setup a random TV set top box and was pressing the power toggle a couple of times. Happy to capture some specific scenarios and remotes if it helps.
Great! Now that we know how to access the messages, we need to capture the device:
If you can provide the codes, it will help the analysis.
@dennisadvani Great! Captures are very clean. I'm gonna try to decrypt them right now. I don't know if I am happy or sad, because I was really excited about a brute force script that I just finished. Well, maybe if I can't decrypt your messages it will serve as a last resource.
Definitely a bit sad that the brute force is not required, I was looking forward to beating the bits out of Broadlink 🤣 but amazing news that you cracked it, well done!
Hey @felipediel, @Siytek,
Sorry about crashing your brute force party 😃 I've managed to run a few captures and sends using a Samsung TV Remote. First I've captured the codes using a 0x2737 based RM Mini 3 and put the captures into a text file as a reference.
I've then switched to a 0x5f36 based device and used the Broadlink App to learn the same 3 codes from the Samsung remote and then the app then asks to test what it has just learnt so I've done a test send straight after. I've then done 3 more captures with just a send without learning through the app.
Files here.
Great! Everything decrypted here.
This solution might work.
Great! Everything decrypted here.
This solution might work.
Yes led blink ! I can register code ! Bravo !
Tonight I will do a pull request.
Thanks to everyone who contributed to the solution!
Awesome work @felipediel, thank you!
Congratulations, @felipediel, @dennisadvani and everyone who contributed. Great job.
Great job guys @felipediel @dennisadvani and everyone else! Now I will finally be able to learn some codes
great work guys! Im sorry i couldnt contribute more! Im happy that it got worked out!
As soon as the pull request is done, ill notify people on my groups that have been asking about this issue!
Thank you so much for your hard work!
I have same device but when I try to run solution7 I have the following error
_LOGGER.debug("Mac: %s", device.mac.hex())
AttributeError: 'bytearray' object has no attribute 'hex'
Any help? @felipediel thanks
@luisfosoares, try using python3
So, is there a specific requirement for initializing that firmware release of RM Mini 3 so that it is compatible with this code? Specific Broadlink app, or just the python CLI ?
@elafargue You need to ensure the local capabilities of the device:
Please let me know if you have any problems after doing this.
Hi guys. I've made some changes to keep the code clean. Can we do a final test?
Hey @felipediel, here you go:
dennis@ubuntu:~/Desktop$ python3 debug.py
Traceback (most recent call last):
File "debug.py", line 1026, in <module>
device.send_data(code)
File "debug.py", line 610, in send_data
packet += data
TypeError: can't concat NoneType to bytearray
@felipediel, here is (learning power on code for Samsung TV):
debug.txt
Here is another one if needed.
Wow this is awesome! Just caught up on the thread. Will give the latest code a test when I get home.
@elafargue You need to ensure the local capabilities of the device:
- Remove the device from the official app
- Reset the device
- Add the device to your local network
- Do not set up a cloud
Please let me know if you have any problems after doing this.
Just to add further, for anyone wanting to test the code; if you reset your device back to ap mode and then use Broadlink Manager to add it to your network, I think it should work ok.
Command sending is not working.
This update should do the trick.
Do you guys confirm that the code is being sent after learning?
For me both both test 8 and the previous (debug.py) seem to send the code after learning.
I test with a led strip remote on and off function.
This is the file from test 8:
debug.txt
@felipediel
Tested now, it learn and send code (power toggle on Samsung TV).
debug.txt
Is there a way to test it in home assistant?
Excellent. This issue is solved. The solution is tested and waiting to be merged.
@SpyrosKyriazos The debug is working because I changed the file for new tests. Sorry about that.
@goose2600 I don't think it's necessary because we haven't modified the interface. But if you want to do it anyway, feel free to copy the modified file in the PR and paste it into the local python-broadlink folder.
I did a test with home-assistant. (I run it with docker in unraid)
I placed the __init__.py file from the pull request in "
/usr/local/lib/python3.7/site-packages/broadlink" inside the docker (Here is the file in case I got it wrong).
After restarting home-assistant I got the following in the logs:
2020-03-06 01:28:03 ERROR (MainThread) [homeassistant.components.switch] Error while setting up broadlink platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 148, in setup_platform
broadlink_device.auth()
File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 207, in auth
response = self.send_packet(0x65, payload)
File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 237, in send_packet
packet[0x24] = self.devtype & 0xff
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
I can't do any more tests right now, I'll try again tomorrow.
@SpyrosKyriazos Thanks! I just realized that Home Assistant does not initialize this value correctly, so I decided to keep a default value to avoid problems with the code that is already working. Could anyone check if the problem is solved now?
What is the correct path for Broadlink folder in Hassio raspberry?
@felipediel
I got the same error of @SpyrosKyriazos
Just made a test with the new version and the error is gone!
Edit: tested the remote.learn_command in home assistant and looks likes is not working (no blinking led and log says no signal received).
Also tried to send a command and the led does not blink (no errors shown in the log).
@luisfosoares I don't know if you can do it on Hassio.
@goose2600 Weird. The API is working correctly. This seems to be another problem. I will take a look.
I just found the problem. It is related to the problem we just solved. Tomorrow I will put the solution here for testing.
I think this PR will finish the job. Could you help me to test it? Don't forget to add the device type in the configuration file.
Good morning @felipediel, thank you again for your work!
Should I change also the remote.py to test it?
@goose2600 Yes.
Unfortunately I am testing from my mobile. Could @felipediel or someone else give me the links to the right raw files? Thanks
Edit:
If someone wants to test, these should be the files:
https://raw.githubusercontent.com/mjg59/python-broadlink/0ef417a6c73890f69a084e02e392dd2056745f58/broadlink/__init__.py
Edit: I can confirm both learn and send command are working in Home Assistant!
Tested with the files @goose2600 linked and with the following config:
remote:
- platform: broadlink
name: RM
host: 192.168.1.16
mac: '24:df:a7:7a:dd:ff'
type: 0x5f36
Both remote.learn_command and remote.send_command work correctly.
Nice solution @felipediel. Thanks again for your effort.
Great! We are done!
The update is coming soon.
And who doesn't want to wait, do it like @goose2600 and @SpyrosKyriazos.
Thanks guys! It was really cool to work with you on this solution!
Might be doing something dumb here @felipediel, but when I try to use the updated code in the config/custom_components/
directory, I get the following error...
Platform error remote.broadlink - cannot import name 'DOMAIN' from 'custom_components.broadlink' (/config/custom_components/broadlink/__init__.py)
I dropped the Broadlink files from Home Assistant Core into custom_components/broadlink
and then replaced the __init__.py
and remote.py
files with the raw files linked by @goose2600. This should override the internal broadlink integration with the files in the custom_components
directory.
I didn't try replacing the files directly in docker yet so might give this a go. But thought I would just mention this incase it is something that needs looking at. Other than that I am happy just to wait for the official update.
Finally I will say congratulations @felipediel you did a superb job! It was great to work with you and everyone else on this and I am very glad we found a solution, as I have two of these newer RM Mini devices and I don't need any more paperweights! 😂
Hey @felipediel,
Just letting you know that the changes to the Broadlink python module might also break the Broadlink Home assistant integrations for sensor and switch. I use "Switch" because I use another HA helper called SmartIR which only supports "Switch" type integration of the RM Mini and it crashed because it wouldn't except "None" as a device type. Maybe the default type of 0x272A should be put in the python module or alternatively, the Switch and Sensor files need to be uplifted to support a default type as well. I've done a dirty fix by editing the switch.py:
RM_TYPES_0x5f36 = [
"rm_mini_0x5f36",
]
SWITCH_TYPES = RM_TYPES + RM_TYPES_0x5f36 + SP1_TYPES + SP2_TYPES + MP1_TYPES
if switch_type in RM_TYPES:
broadlink_device = broadlink.rm((ip_addr, 80), mac_addr, **0x272A**)
hass.add_job(async_setup_service, hass, ip_addr, broadlink_device)
switches = []
for object_id, device_config in devices.items():
switches.append(
BroadlinkRMSwitch(
object_id,
device_config.get(CONF_FRIENDLY_NAME, object_id),
broadlink_device,
device_config.get(CONF_COMMAND_ON),
device_config.get(CONF_COMMAND_OFF),
retry_times,
)
)
elif switch_type in RM_TYPES_0x5f36:
broadlink_device = broadlink.rm((ip_addr, 80), mac_addr, **0x5f36**)
hass.add_job(async_setup_service, hass, ip_addr, broadlink_device)
switches = []
for object_id, device_config in devices.items():
switches.append(
BroadlinkRMSwitch(
object_id,
device_config.get(CONF_FRIENDLY_NAME, object_id),
broadlink_device,
device_config.get(CONF_COMMAND_ON),
device_config.get(CONF_COMMAND_OFF),
retry_times,
)
)
Hi guys. Thanks for the tests. I just added 0x5f36 to switch.py. You can grab the file here.
The configuration of the switch is a little different because I kept the syntax that was already being used.
switch:
- platform: broadlink
host: 192.168.0.12
mac: 34:EA:36:B2:44:C3
type: 'rm_mini3_5f36'
switches:
tv_phillips:
friendly_name: "Phillips Tv Power"
command_on: 'JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA='
command_off: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA='
@felipediel
To use do I need to install anything new in the Home Assistant? Or do I need to download a file and include it in a Home Assistant directory?
@Siytek I think you put the __init__.py
file in the wrong folder. If you are using a virtual envinronment the folder is venv/lib/python3.7/site-packages/broadlink
.
You can also use Git to pull these files from my repositories, I just didn't want to make it even more complicated for those who don't know the tool.
@jhonathas The solution will come out-of-the-box, but if you don't want to wait you can download the files and replace them.
Hey @felipediel
Thank you for your amazing work. I added the patched files to my own hass instance and connecting and learning commands through cli works fine. Unfortunately, when I try to learn a command through Hass, the RM Mini 3 won't turn on to do anything. After a few seconds Hass times out and returns: "[homeassistant.components.broadlink.remote] Failed to learn 'Turn on/television': no signal received"
@kgorszczyk Did you replace __init__.py
in the folder I mentioned above? Replaced switch.py
and remote.py
in the integration folder? Did you put the correct device type in the configuration file?
Just to be safe I redownloaded all files. The type is the same I used with the cli learning (python broadlink_cli --type 0x5f36 --host 192.168.178.40 --mac ......a7df24 --learn):
remote:
- platform: broadlink
name: Broadlink
host: 192.168.178.40
mac: '24:DF:A7: ....'
type: 0x5f36
Unfortunately still no response from the RM Mini 3.
@felipediel, I use it on a Raspberry pi and installed it via docker (https://www.home-assistant.io/hassio/installation/#preparation). In that case do you know where I should overwrite? I looked here and didn't find it. Is it possible to do the procedure with the environment installed via docker?
How to test it on your computer?
cd YOUR_TEST_FOLDER
git clone -b devtype https://github.com/felipediel/home-assistant.git
cd home-assistant
python3.7 -m venv venv
source venv/bin/activate
script/setup
pip install git+git://github.com/felipediel/python-broadlink.git@patch-1
mkdir config
hass -c config
Finally figured it out. I'm using pyenv to manage several Python Versions and I thought, that Hass would use the globally installed site-packages and use Hass specific packages from the config folder. Well, it's the other way around. Now everything works perfectly. Thanks!
Hey All,
For those who are having some trouble with implementing this change in HA (I'm using HassIO) I've shared the steps I've used:
Placing the broadlink folder in the custom_components folder will override the built in HA integration once you restart HA. It's a much easier way to temporarily override the integration until it's included natively in HA. There's no temporary way to override the python-broadlink module however as far as I know.
Hey All,
For those who are having some trouble with implementing this change in HA (I'm using HassIO) I've shared the steps I've used:
- First get Dev SSH access with instruction here.
- Access the shell with "login" first then "docker exec -it homeassistant /bin/bash"
- Replace the python-broadlink module by first backing up /usr/local/lib/python3.7/site-packages/broadlink/init.py (I'm using HassIO, path may vary).
- Put the updated init.py in its place from here.
- If you want to copy the file, assuming you have the samba-share addon installed, copy the new python-broadlink to your /config folder via the share, then move it after alternatively just paste it into the SSH shell via VI.
- That updates the python Broadlink module, you now need to update the HA Broadlink integration. I suggest downloading HA's source from @felipediel branch here and copy the core-83b1e6e4055471939f9b8470d767ee77c596f968.zip\core-83b1e6e4055471939f9b8470d767ee77c596f968\homeassistant\componentsbroadlink folder to your /config/custom_components folder in the HA container or via samba: \hassio\configcustom_components
Placing the broadlink folder in the custom_components folder will override the built in HA integration once you restart HA. It's a much easier way to temporarily override the integration until it's included natively in HA. There's no temporary way to override the python-broadlink module however as far as I know.
Superstar @dennisadvani! Yes I was being dumb, of course python-broadlink needed replacing as well as the HA integration in custom_components
. I am super-pleased to report that learning and sending codes now works for me in Home Assistant!! 🎉🥳
@dennisadvani Dude, you are hero, I have to thank you again.
The headers I found in your captures enabled me to extend our support to the entire RM4 series.
, is the RM3 integration also broken?, im asking because i cant connect to my mini after an update . tks
@gnkarn You may be experiencing this issue, which is different from the one we just solved here.
I still need to do some tests to understand this new problem that came up with the update. But it has nothing to do with this issue. This case is closed. Go to the right place and I will be glad to help you.
Hi guys
What is the status today? Are the PRs merged? Any ETA if not ?
@luisfosoares I think it will take a while because we still need to approve the PR in the API. If you're in a hurry, don't hesitate to follow @dennisadvani's walkthrough.
@felipediel I would like to follow it but im unable
i don't have the folder python3.7 in the path /usr/local/lib
I can find a the folder site-packages inside the "lib" folder but not in "local" . And my python is not 3.7, its 3.8! - so I have the path /usr/lib/python3.8/site-packages
Inside of it there is no "Broadlink"
I find it weird, I tried all folders but can't find it
Im using lates version of Hassio os raspberry pi4
Thanks
Hi guys. Sorry to be bothering you again, but I've made some updates to improve code maintenability and improve Home Assistant support for API changes. So we will not need to approve two PRs in the future. Things will happen faster. Could you test these updates? I tested it on my venv with a RM Pro and it worked well, but I would like to make sure that your devices are also working.
@luisfosoares What system are you using? I can't help you find this folder right now because I'm working on a venv. My folder is at /venv/lib/python3.7/site-packages/broadlink
. So you replace venv with your folder, I don't know where it is.
If I wanted to install the latest version of the API here I would use the following command:
pip install git+git://github.com/felipediel/python-broadlink.git@patch-1
I don't know if you can use this command on your system. If you want to try make sure to stop Home Assistant first. Ah, you may need to use sudo
before the command.
Hi @felipediel, thank you again for your effort.
I am running my home assistant into a docker container and I should install git in order to test the patch. Could you please link the raw file?
@goose2600 __init__.py
@felipediel im running hassio hassos v3.12 on raspberry pi 4 with homeassistant v 0.106.6
@luisfosoares Go the the root directory and type:
find . -name broadlink
Nothing is found...weird!
I tried any other folder that i know exists and it works
@luisfosoares If you have python-broadlink installed this folder exists somewhere. Maybe you don't have access to it. Did you try pip? pip install git+git://github.com/felipediel/python-broadlink.git@patch-1
(or the sudo
variation).
You can also try to create the folder /usr/lib/python3.8/site-packages/broadlink
with the __init__.py
inside.
@felipediel
Unfortunately my home assistant stops working, I reinstalled it and now I get an error related to some variables missing in broadlink constant.py.
Tomorrow I will reinstall and will try your new __init__.py
@goose2600 What variables?
The variables are DEFAULT_PORT, DEFAULT_RETRY, DEFAULT_TIMEOUT.
I tried to set them and I get this error:
2020-03-14 01:20:31 ERROR (MainThread) [homeassistant.components.remote] Error while setting up broadlink platform for remote
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/src/homeassistant/homeassistant/components/broadlink/remote.py", line 107, in async_setup_platform
hass.async_add_executor_job(api.auth), remote.async_load_storage_files()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 211, in auth
response = self.send_packet(0x65, payload)
File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 277, in send_packet
self.cs.sendto(packet, self.host)
TypeError: an integer is required (got type str)
Maybe I just need to make a fresh install
@goose2600 You helped me find an error, wait a second, I will fix it.
Done (I replaced the files not in the custom_componets folder, but in /usr/src/homeassistant/homeassistant/components/broadlink/ as before home assistant stops working).
Now I get this error:
`Platform error: remote
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 752, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 277, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
File "
File "
File "
File "
File "
File "
File "
File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 17, in
from .const import CONF_PACKET, DOMAIN, SERVICE_LEARN, SERVICE_SEND
ModuleNotFoundError: No module named 'homeassistant.components.broadlink.const'
`
EDIT: @felipediel Ok, I wait here for the fix you are talking about
@goose2600 I updated the files above. Could you try again? Please make sure you are doing everything right. Everything is working perfectly here.
Replaced all the files again, and still get an error.
`Platform error: remote
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 752, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 277, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
ModuleNotFoundError: No module named 'homeassistant.components.broadlink.remote'
`
I think I am doing right.
Download init.py in /usr/local/lib/python3.7/site-packages/broadlink/ and the other files in /usr/src/homeassistant/homeassistant/components/broadlink/
EDIT: wait, maybe I found the my error, now I do not get any errors. Let me test if sending command is working
EDIT: It works. Thanks again!
@goose2600 Great! Thank you!
How to test it on your computer?
- Prepare your envinronment
- Open the terminal and type:
cd YOUR_TEST_FOLDER git clone -b devtype https://github.com/felipediel/home-assistant.git cd home-assistant python3.7 -m venv venv source venv/bin/activate script/setup pip install git+git://github.com/felipediel/python-broadlink.git@patch-1 mkdir config
- Put your stuff into the config folder (don't forget to specify the device type for 0x5f36)
- Run Home Assistant.
hass -c config
@felipediel tested with above steps you suggested (type 0x5f36). It works without problems.
Thanks a lot.
PS this new type is very strange, I added it using Broadlink app the first time, then I reset it and I was not able to add it in the app anymore. I can connect it to WiFi using AP mode but after that an error occur and it does not show up in the app. Luckily your new integration version works!
@luisfosoares If you have python-broadlink installed this folder exists somewhere. Maybe you don't have access to it. Did you try pip?
pip install git+git://github.com/felipediel/python-broadlink.git@patch-1
(or thesudo
variation).
You can also try to create the folder/usr/lib/python3.8/site-packages/broadlink
with the__init__.py
inside.
Finally I did it .. Thanks
Perfect!
@luisfosoares I have the same problem like you. Could you pls show me how to fix it. I tried the both way above. I created the folder /usr/lib/python3.8/site-packages/broadlink , but after restarted the server, the folder gone.
@thangdktd Take the sd card out of your pi and plug it into a linux system, then on the data partition do a search for broadlink, replace the __init__.py file and you're done
Hello, I' ve the home assistant update to 0.107.5 but the rm mini 3 44057 doensn't work, so could you explain me hoe to resolve it ( i've home assistant installed in docker on my raspberry p3b+).
thanks
@luisfosoares I have the same problem like you. Could you pls show me how to fix it. I tried the both way above. I created the folder /usr/lib/python3.8/site-packages/broadlink , but after restarted the server, the folder gone.
Sorry for late answer .. I found that I was not following the procedure correctly
In your terminal you must run first the command
docker exec -it homeassistant /bin/bash
After you should be able to find the correct folders
Let me know if it worked
I pluged SD card into Ubuntu, replaced the __init__.py, have the following warning and RM3 still not work
Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:252
Integration: recorder (documentation, issues)
First occurred: 3:47:33 PM (1 occurrences)
Last logged: 3:47:33 PM
Ended unfinished session (id=2 from 2020-03-23 08:36:53.970346)
I pluged SD card into Ubuntu, replaced the init.py, have the following warning and RM3 still not work
Logger: homeassistant.components.recorder
Source: components/recorder/init.py:252
Integration: recorder (documentation, issues)
First occurred: 3:47:33 PM (1 occurrences)
Last logged: 3:47:33 PMEnded unfinished session (id=2 from 2020-03-23 08:36:53.970346)
This error is not coming from BroadLink but from recorder component!
Thanks for all your great support.. i stuck in a step, i copied all files to broadlink folder in custom_components, how i could update the broadlink component now?
Broadlink devices completely disappointed me. I decided to completely abandon the Broadlink-SC1-Switches and Broadlink-S1c-KIT Alarms. I can never be sure that HomeAssistant sees real status of this devices, and if it does, it’s not a fact that they will be reliably managed. Broadlink is just a garbage can in conjunction with HomeAssistant.
I completely switched to using ESPHome. Yes, it takes a lot of soldering and a lot of programming, but compared to broadlink it’s just fantastic.
i can't see rm4 pro in init.py
rm4: [0x51da, # RM4b
0x5f36, # RM Mini 3
0x610e, # RM4 mini
0x610f, # RM4c
0x62bc, # RM4 mini
0x62be # RM4c
i have rm4 pro, how i can check my device code?
A question for everyone who has the Broadlink RM Mini 3 type 0x5f36 device. Is the device a Red Bean?
A question for everyone who has the Broadlink RM Mini 3 type 0x5f36 device. Is the device a Red Bean?
Nope, mine is black
@fedebruni84 Could you provide me a link to where you bought the device? Or do you remember the model name at the time of purchase (ex: Red Bean)?
@sagitt No device discovered. Please make sure that the devices are turned on and connected to the network. You may also need to disable your firewall.
i copied the file in the config folder, from host docker exec -it homeassistant /bin/bash, done python3 /config/debug.py. device are online and in the newtork. what firewall? is local. broadlink manager see the device but can't connect to it. done agian debug.py.. no device found.
@sagitt Something is blocking discover. It is probably a firewall. Try to run the program in your computer (disable your firewall first). You also may want to check your router options, some routers come with a built-in firewall. What type of device appears in Broadlink Manager?
@sagitt Something is blocking discover. It is probably a firewall. Try to run the program in your computer (disable your firewall first). You also may want to check your router options, some routers come with a built-in firewall. What type of device appears in Broadlink Manager?
@sagitt Run debug.py in the same device you are running Broadlink Manager.
@sagitt Run debug.py in the same device you are running Broadlink Manager.
Windows 7 on VM works :D
debug.txt
@sagitt I updated the file to support your device. Please debug again to check if it worked.
@sagitt I just extended the library support to your device. But you need to disable the cloud in order to use it with Home Assistant. Follow these steps:
Run debug.py again and send me the file so I can check if it worked.
@fedebruni84 Could you provide me a link to where you bought the device? Or do you remember the model name at the time of purchase (ex: Red Bean)?
I bought on amazon.it
I bought another one from the same link 2 years ago but it stopped working a few months ago (it wasn’t able to connect to WiFi anymore... before that it worked without problems in home assistant). So, instead of repair It under warranty, they provided me with a coupon for the same link, but it was 0x5f36.
@fedebruni84 Great! Thank you!
@sagitt I just extended the library support to your device. But you need to disable the cloud in order to use it with Home Assistant. Follow these steps:
- Remove the device from the official app (you must be connected to the internet)
- Reset the device
- Add the device to your local network
- Do not set up a cloud (not now, not ever)
Run debug.py again and send me the file so I can check if it worked.
i configured wifi with IHC without adding it to the app. check. During debug i used a remote.
@felipediel And what my brand new RM3 mini which is also not supported ("Writing compatible device not detected")? I am very sad because i spend money and my device is still useless.. Please help.
@felipediel Hi Felipe, I installed the update, following these instructions here. I have rewritten the __init__.py file in python broadlink and put the updated HA component files in custom_components/broadlink, however now the remote shows as unavailable.
This is my config in HA:
remote:
- platform: broadlink
host: 10.10.1.25
mac: XX-XX-XX-XX-XX-XX
name: "Living Room Broadlink"
do I have to set the type aswell? type: 0x5f36
As we tested earlier with your python test file, this should be the correct type, however when I check the config it says that type is not an allowed option. Is the problem that HA is not loading the custom component but using the original one from HA? My current HA version is 0.108.3
Invalid config for [remote.broadlink]: [type] is an invalid option for [remote.broadlink]. Check: remote.broadlink->type. (See ?, line ?).
__EDIT__: I copied the component directly to /usr/src/homeassistant/homeassistant/components/broadlink/
, now I can use the 'type' config, however it still doesn't work. I even tried installing the python-broadlink using pip install git+git://github.com/felipediel/python-broadlink.git@patch-1
and not using the init.py from the instructions, and also using component file from this PR, but that also didn't help. It was working before on HA 0.107.0, but now on 0.108.3 it is not.
It works! My RM3 mini works! What i did:
i find "0x5f36" string in source file of broadlink component, this line: "devtype = 0x5F36 if switch_type == "rm_mini3_5f36" else 0x272A"
so i put this into HA switches config:
- platform: broadlink
host: 192.x.x.x
mac: 24:xx:xx:xx:xx:xx
type: rm_mini3_5f36
and ... IT WORKS! Note - without "type" field it did NOT work!
It is good to check led. If it is datk after "learn" service call it is bad. If it is white it is good.
Now i can learn codes and codes really work!
Hi. I had to make some changes and they haven't been tested yet. Could someone help me to debug again? Just download the file, open the folder in the terminal and type:
python3 debug2.py
Send me debug.txt.
@sagitt The new debug is a test to see if I can make your life a little easier for now.
I have no idea where this <!DOCTYPE html>
tag came from. Are you sure you have the correct file at /usr/local/lib/python3.7/site-packages/broadlink/__init__.py
? Try replacing it by this file.
@sagitt The new debug is a test to see if I can make your life a little easier for now.
I have no idea where this<!DOCTYPE html>
tag came from. Are you sure you have the correct file at/usr/local/lib/python3.7/site-packages/broadlink/__init__.py
? Try replacing it by this file.
Solved. Bad init download
@felipediel I have run your debug2.py
file. Here is the debug:
Without learning a code: here
With learning a code: here
Now using your debug I found out that it is detected as 0x272a
but my RM mini 3 is actually 0x5f36
,
__EDIT__: Hmm interesting thing now looking at the python-broadlink init.py with the list of these types, the 0x272a
corresponds with RM2 Pro Plus. I also tried running again your previous test file we tested few weeks ago called test_solution4.py
and this detects it correctly as 0x5f36. Debug here
Here's the debug.txt for a 0x5f36
RM Mini 3 device. Since the device wanted to learn a code as part of the tests, I did send it a remote control button press. Hope this helps!
debug.txt
@elafargue I see your Device Type is detected as 0x272a in the debug file aswell, so it is something about the python script.
Well yeah, the python test script hardcodes the device type to 0x272a
:) Looks like @felipediel has found something interesting about the actual meaning of those two bytes...
Right, looking at the actual code helps, I should do it more often haha, didn't realize it is hardcoded now.
Anyways I just got it working with HA aswell now. I don't know what I did differently, just started from scratch using the files I got here (python init.py + component) and it started working.
it's actually great news, it probably means that what the "devtype" that was used all along is actually... not the device type? Probably more like a protocol version, and can be the same on all devices? I'll read the code a bit more to understand when I have a minute. Nice job as always @felipediel . These Broadlink devices are so handy!
The device type is like a version negotiation. We can use an older version, as I did in the test. I will leave it this way temporarily, so that users do not need to find out the device type. As soon as I implement discover() we will get the correct type from the device in order to improve communication.
@felipediel - I use your custom source code for broadlink component and it works. A have "rm_mini3_5f36" model.
This extra source will be custom forever or you will put it into HA oficial sources?
Hi! i tried to debug and i get 0x272a.
debug.txt
If I understand correctly i need to put rm_mini3_5f36 in configuration right? Because when i run debug i can get codes, but from homeassistant services broadlink.send or learn still not working.. Am i doing something wrong? Thanks
It works! My RM3 mini works! What i did:
- connect device to wifi using Broadling app, quit app just after wifi connection
- add custom init.py and broadlink custom component using this post: #30215 (comment)
- download debug.py from this post: #30215 (comment)
- install required library using this post: https://stackoverflow.com/questions/39180609/importerror-no-module-named-cryptography
- run debug.py - in output i see device type "main DEBUG Type: 0x5f36"
- i find "0x5f36" string in source file of broadlink component, this line: "devtype = 0x5F36 if switch_type == "rm_mini3_5f36" else 0x272A"
- so i put this into HA switches config:
- platform: broadlink host: 192.x.x.x mac: 24:xx:xx:xx:xx:xx type: rm_mini3_5f36
and ... IT WORKS! Note - without "type" field it did NOT work!
It is good to check led. If it is datk after "learn" service call it is bad. If it is white it is good.
Now i can learn codes and codes really work!
Hello I following instructions above referenced and if I run debug 1 and 2, th rm mini 3 led chnge color and learn a remote button, but the broadlink.leran in home assistant doen't work (led black). Attach the debugs file. Could someone tell me why in HA 0.108.3 doesn't work?
thanks
debug1.txt
debug2.txt
It works! My RM3 mini works! What i did:
- connect device to wifi using Broadling app, quit app just after wifi connection
- add custom init.py and broadlink custom component using this post: #30215 (comment)
- download debug.py from this post: #30215 (comment)
- install required library using this post: https://stackoverflow.com/questions/39180609/importerror-no-module-named-cryptography
- run debug.py - in output i see device type "main DEBUG Type: 0x5f36"
- i find "0x5f36" string in source file of broadlink component, this line: "devtype = 0x5F36 if switch_type == "rm_mini3_5f36" else 0x272A"
- so i put this into HA switches config:
- platform: broadlink host: 192.x.x.x mac: 24:xx:xx:xx:xx:xx type: rm_mini3_5f36
and ... IT WORKS! Note - without "type" field it did NOT work!
It is good to check led. If it is datk after "learn" service call it is bad. If it is white it is good.
Now i can learn codes and codes really work!Hello I following instructions above referenced and if I run debug 1 and 2, th rm mini 3 led chnge color and learn a remote button, but the broadlink.leran in home assistant doen't work (led black). Attach the debugs file. Could someone tell me why in HA 0.108.3 doesn't work?
thanks
debug1.txt
debug2.txt
Me too! Exactly the same problem.. Thanks for your support
@giangi007 , @Berto93 I recently got it working on HA 0.108.3, first question is if even HA will let you set the type
in the config file. If you check configuration before reboot, does it say any error or the check passes? In my case it failed, saying that type
in remote (not talking about the switch) config is not allowed. For some reason my HA wasn't loading the custom_components folder, so I had to manually copy the component files to /usr/src/homeassistant/homeassistant/components/broadlink/
, don't forget to make a backup of your old files. I only replaced these files: remote.py
, switch.py
, and sensor.py
, left the rest untouched, including __init__.py
(not to be confused with the python-broadlink one).
So my process was this:
docker exec -it homeassistant /bin/bash
cd /usr/local/lib/python3.7/site-packages/broadlink
__init_.py
with this filecd /usr/src/homeassistant/homeassistant/components/broadlink/
remote:
- platform: broadlink
host: YOUR_IP
mac: 'XX:XX:XX:XX:XX:XX' #Your MAC
name: "Living Room Broadlink"
type: 0x5f36
@InToSSH const.py is also required. Could you help me testing the new version?
Copy these files to /usr/src/homeassistant/homeassistant/components/broadlink
:
const.py
remote.py
sensor.py
switch.py
It is no longer necessary to modify the library, as it is already updated in Home Assistant.
remote:
- platform: broadlink
host: YOUR_IP_ADDRESS
mac: YOUR_MAC_ADDRESS
name: bedroom
type: rm_mini3_redbean
Everyone is invited to try this updated version. Tests of the sensor platform would be appreciated.
@felipediel I will try it out, thanks for the update.
I suppose I should revert to the original __init__.py
for the python-library to test if it works with the 0.13.0 that shipped with the HA, right?
Also I see you are no longer using the hex type values, so in my case, I should use one of the RM4_TYPES from the const.py (for sake of correctness, specifically the rm_mini3_newblackbean, since my 0x5f36 is black :)
__EDIT__: I just noticed there is an update to 0.108.6, which has the lib updated to 0.13.1, so I will update my HA first to be on the latest release.
I confirm - my RM mini3 type "rm_mini3_5f36" is black. Brand new piece from aliexpress..
@felipediel Tested the updated component and I can confirm that it works nicely. Used the 0.13.0 lib (default from 0.108.5), since the HA update 0.108.6 with 0.13.1 lib is not yet available for me, but I suppose it will work aswell.
I used the type: rm_mini3_newblackbean
Thank you
@felipediel I have a RM4b according to my debug.txt file, cross referenced against the python-broadlink __init__.py file:
18:15:47,17 __main__ DEBUG Type: 0x51da
This doesn't appear in the Broadlink component const.py, and setting type as rm4_mini doesn't work.
Any suggestions?
@felipediel Tested the updated component and I can confirm that it works nicely. Used the 0.13.0 lib (default from 0.108.5), since the HA update 0.108.6 with 0.13.1 lib is not yet available for me, but I suppose it will work aswell.
I used thetype: rm_mini3_newblackbean
Thank you
Hello! i also have problem with the broadlink mini. Now that the library has been integrated into the update, does the configuration change? could you post your config?
What is the newblackbean?
@achille858 don't confuse python lib and component. The python lib is integrated. You still need to update the component in HA. Then depending on your Broadlink mini type you now set the type from the arrays in const.py file.
you now set the type from the arrays in const.py file.
Lol! Unless you can't find it there...
@achille858 I just followed the bouncing ball for the two linked posts below. Install the new integration as a custom component, and identify what RM you have using debug.py. The new python-broadlink libraries required are in HA since .108
https://github.com/home-assistant/core/issues/30215#issuecomment-614774503
https://github.com/home-assistant/core/issues/30215#issuecomment-615078343
I am little bit lost. I have custom source code of broadlink component downloaded from some branch of HA code. And i repeat my RM3 mini works. BUT! What about clean version of HA? I cloned head of HA repo (i see tag 108.6) and in broadlink directory i don't see any "rm_mini3_newblackbean" nor "0x5f36" and what more nor something like "rm 3 mini".
Please explain me again - how about support of new RM3 mini in HA now? It is in 108.6 or not or.. ? I don't understand..
@achille858 don't confuse python lib and component. The python lib is integrated. You still need to update the component in HA. Then depending on your Broadlink mini type you now set the type from the arrays in const.py file.
Yes, I know. Where can I download files should I replace in custom component? And what is the configuration in config?
you now set the type from the arrays in const.py file.
Lol! Unless you can't find it there...
@achille858 I just followed the bouncing ball for the two linked posts below. Install the new integration as a custom component, and identify what RM you have using debug.py. The new python-broadlink libraries required are in HA since .108
Where Can I download the debug.py?
@InToSSH const.py is also required. Could you help me testing the new version?
Instructions
Copy these files to
custom_components/broadlink
:
const.py
remote.py
sensor.py
switch.pyIt is no longer necessary to modify the library, as it is already updated in Home Assistant.
Example in configuration.yaml
remote: - platform: broadlink host: YOUR_IP_ADDRESS mac: YOUR_MAC_ADDRESS name: bedroom type: rm_mini3_redbean
Everyone is invited to try this updated version. Tests of the sensor platform would be appreciated.
I tried the new component as switch (replacing files in custom_components/broadlink folder) and doesn't work for me. Service broadlink.learn or broadlink.sent are not available anymore (disappeared from services list), launching debug.py device is discovered as 0x5f36 and can learn codes.
Device RM mini 0x5f36 is redbean or newblackbean? (personally mine is black)
With the previous version of component, services "learn" and "send" are available but no codes discovering when called.
i'm confused. in to type i have to insert the CODE or a DESCRIPTION?
for example, in my case with rm4 pro i have to add rm4_pro or 0x....?
@sagitt From now on, you type the device model as a string. 0x5f36 can be of the rm_mini3_redbean or rm_mini3_newblackbean model, as they have the same chip.
@darylsargent Could you provide me a link to your device? Where did you buy it? Thanks!
@Berto93 Please check your configuration file.
@bigboban The PR is being reviewed and will be merged soon.
@sagitt From now on, you type the device model as a string. 0x5f36 can be of the rm_mini3_redbean or rm_mini3_newblackbean model, as they have the same chip.
This is mine, from debug it risult 0x5f36
@achille858 This is the new Black Bean.
@darylsargent Could you provide me a link to your device? Where did you buy it? Thanks!
@Berto93 Please check your configuration file.
@bigboban The PR is being reviewed and will be merged soon.
Thanks @felipediel, i checked configuration but is okay, is it possible that it's because maybe i don't have libraries updated? i'm running 0.108.5.
I don't know why with the same configuration.yaml (modifying only device type) with the previous component broadlink switch services are available.
@achille858 This is the new Black Bean.
thanks for answer! well "type: 0x5f36"?
@darylsargent Could you provide me a link to your device? Where did you buy it? Thanks!
@felipediel This was purchased from Amazon, the link is: Broadlink RM4 Mini Universal IR Audio Video Remote Control, Smart Home Wi-Fi Remote Hub, Compatible with Alexa https://www.amazon.com.au/dp/B07ZT73ZMP/ref=cm_sw_r_cp_tai_HxIMEb4M58X5S
That’s effectively direct from Broadlink. I’ll continue to fiddle today, just want to confirm I can learn a code with debug.py.
I don't find this "/usr/local/lib/python3.7/site-packages/broadlink"
I have HASSIO but I haven't docker. how can I solve it?
@achille858 If you are running the latest version of HA you don’t need to update the library, it has been done. This was mentioned in Felipe’s post I linked.
@Berto93 v0.108.5 already contains the python-broadlink v0.13.0, which works with the new component. I am running the same version and I just updated the component files provided by Felipe few comments back and it is all working. No need to update the python-broadlink lib. I have the same 0x5f36, the black one and I used this type for the config type: rm_mini3_newblackbean
@achille858 This is the new Black Bean.
thanks for answer! well "type: 0x5f36"?
@achille858 no, you also set type: rm_mini3_newblackbean
as Felipe told you, it is the New Black Bean. The component no longer uses hex types.
@Berto93 v0.108.5 already contains the python-broadlink v0.13.0, which works with the new component. I am running the same version and I just updated the component files provided by Felipe few comments back and it is all working. No need to update the python-broadlink lib. I have the same 0x5f36, the black one and I used this type for the config
type: rm_mini3_newblackbean
which app do you use to configure the Broadlink?
@achille858 I unfortunatelly don't remember exactly. It was a long time ago. But if I remember correctly the e-Control app wasn't able to find it at all (saying that this device is not supported), so I used the official one from the manual that came with the device, I just connected it to the wifi via the app, exited the app and uninstalled it, then I set a static DHCP lease on my router to fix the IP address.
@Berto93 v0.108.5 already contains the python-broadlink v0.13.0, which works with the new component. I am running the same version and I just updated the component files provided by Felipe few comments back and it is all working. No need to update the python-broadlink lib. I have the same 0x5f36, the black one and I used this type for the config
type: rm_mini3_newblackbean
Thank you @InToSSH, did you integrate it as remote or switch? Broadlink.learn and broadlink.send services are available to you?
@achille858 I unfortunatelly don't remember exactly. It was a long time ago. But if I remember correctly the e-Control app wasn't able to find it at all (saying that this device is not supported), so I used the official one from the manual that came with the device, I just connected it to the wifi via the app, exited the app and uninstalled it, then I set a static DHCP lease on my router to fix the IP address.
ok thanks but i have error in the configuration
Invalid config for [remote.broadlink]: [type] is an invalid option for [remote.broadlink]. Check: remote.broadlink->type. (See ?, line ?).
@Berto93 I am using just the remote, not switch. I am sending the commands through Node-Red, calling the send service.. and yes, both of those services are working.
@achille858 I think if you make it to the point were the broadlink connects to the wifi, and you can find it in the DHCP leases on your router, find it's MAC and IP, and you are able to ping it, it should work.
But to answer your problem with the invalid option, the same thing happend to me, as I said earlier, for some reason the HA doesn't load my custom_components/broadlink
folder (i have other custom components that are working, but not this one), and I got the same error, then I had to manually replace the component files directly in the home assistant here /usr/src/homeassistant/homeassistant/components/broadlink/
(I am using the Docker Hass.io, so your path might be different, but as long as you find the HA base folder, you should find the component, or search your filesystem for any of the files to find the path)
@Berto93 @achille858 I tested it here and it is no longer possible to use the code using custom_components. You need to replace the files in the original folder.
@Berto93 I am using just the remote, not switch. I am sending the commands through Node-Red, calling the send service.. and yes, both of those services are working.
@achille858 I think if you make it to the point were the broadlink connects to the wifi, and you can find it in the DHCP leases on your router, find it's MAC and IP, and you are able to ping it, it should work.
But to answer your problem with the invalid option, the same thing happend to me, as I said earlier, for some reason the HA doesn't load mycustom_components/broadlink
folder (i have other custom components that are working, but not this one), and I got the same error, then I had to manually replace the component files directly in the home assistant here/usr/src/homeassistant/homeassistant/components/broadlink/
(I am using the Docker Hass.io, so your path might be different, but as long as you find the HA base folder, you should find the component, or search your filesystem for any of the files to find the path)
the device is in the wifi network and can find MAC and IP address. It's probably the custom component... but in HASSIO without docker, where is the original folder??
@achille858 so are you using one of the pre-made images for devices like RPi or NUC? you can try to connect to your system via SSH terminal and use this command to find the path: find / | grep "broadlink/remote.py"
@achille858 so are you using one of the pre-made images for devices like RPi or NUC? you can try to connect to your system via SSH terminal and use this command to find the path:
find / | grep "broadlink/remote.py"
I use RPi 3B+, the search via ssh find only the custom component
We still need to test the sensor platform. Without that we will not be able to merge. Does anyone have the special cable with the RM4 sensors?
@achille858 Your three options are: Docker, Hassbian or just wait.
okI I wait 😄
Can't find local path of broadlink component.. i'm running hassio on docker.. any suggest? thank you :D
@Berto93 are you sure you are searching inside of your Docker container? When you connect to your device where you have your Docker, you need to use docker exec -it homeassistant /bin/bash
to connect to your Docker container of home assistant and search there, the path should be the same as the one I posted
docker exec -it homeassistant /bin/bash
@InToSSH Yes but in this way tells me that i don't have permissions, so i'm browsing manually folder or using FTP or raspbian for all operations i've done.. Maybe need to fix something
@Berto93 if you connect via FTP directly to your raspbian you won't find it, because you are accessing the raspbian filesystem, not the Docker container, make sure you are logged in as root or use sudo docker exec -it homeassistant /bin/bash
@Berto93 if you connect via FTP directly to your raspbian you won't find it, because you are accessing the raspbian filesystem, not the Docker container, make sure you are logged in as root or use
sudo docker exec -it homeassistant /bin/bash
@InToSSH Thanks, now i've access. Same directory as yours, i'm not so expert.. how replace files trough command line?
@Berto93 well.. easiest way I would say is to make backup of each file and then copy the text via vi editor.
Here is the process for one of the files (same applies to the others)
mv remote.py remote.py.bak
- to save the backup of the filevi remote.py
- opens the editor with blank file:wq
(this will also appear in the bottom left corner) - w = save file, q=exit the editorcat remote.py
, this should list the contents of the fileDelete files and download the new one using wget (use the links to raw
files provided by Felipe).
Il sab 18 apr 2020, 01:36 Berto93 notifications@github.com ha scritto:
@Berto93 https://github.com/Berto93 if you connect via FTP directly to
your raspbian you won't find it, because you are accessing the raspbian
filesystem, not the Docker container, make sure you are logged in as root
or use sudo docker exec -it homeassistant /bin/bash@InToSSH https://github.com/InToSSH Thanks, now i've access. Same
directory as yours, i'm not so expert.. how replace files trough command
line?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/core/issues/30215#issuecomment-615509676,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AIG2N252WEN6IPTOQJHUSMLRNDRYBANCNFSM4J7GKZZQ
.
@goose2600 yea, that might actually be even easier.
Just do the step one, to save the backup, and then wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/remote.py
- for the remote.py file, follow the rest of the links provided by Felipe here
@goose2600 yea, that might actually be even easier.
Just do the step one, to save the backup, and then
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/remote.py
- for the remote.py file, follow the rest of the links provided by Felipe here
Anyone looking to do this on a Raspberry Pi image, here are the steps to get into the docker image and access the /components/broadlink
directory:
Protected Mode
. Be sure to set a user name and password in the config file before starting it.docker exec -it homeassistant sh
. This drops you into a terminal running in the _docker_ container cd /usr/src/homeassistant/homeassistant/components/broadlink/
@felipediel I just tried on my Raspberry Pi installation with my recently purchase Rm3 Mini and I couldn't get the send or learn switch services to work.
Here are some details:
configuration.yaml
switch:
- platform: broadlink
host: 192.168.X.X
mac: 'XX:XX:XX:XX::XX'
friendly_name: "Broadlink"
type: 'rm_mini3_newblackbean'
switches:
tv:
command_on: 'JgDSAJOTEzcSNxM2ExITEhISExISEhM3EjcTNhMSEhMSEhMSEhITEhM2ExISExISExISEhMSEzYTEhM2EzYTNxI3EzYTNxIABfyTkxM3EjcSNxMSExISEhMSEhITNxI3EzYTEhITEhITEhITEhITNhMSExISEhMSEhMSEhM2ExITNhM3EjcSNxM2EzcSAAX8lJMSNxI3EzcSEhMSEhMUEBUQFDUSNxM3EhIVEBQQExITEhISEzcSEhMSExISEhMSEhITNxISEzcSNxM2EzcSNxI3EwANBQAAAAAAAA=='
command_off: 'JgDSAJOTEzcSNxM2ExITEhISExISEhM3EjcTNhMSEhMSEhMSEhITEhM2ExISExISExISEhMSEzYTEhM2EzYTNxI3EzYTNxIABfyTkxM3EjcSNxMSExISEhMSEhITNxI3EzYTEhITEhITEhITEhITNhMSExISEhMSEhMSEhM2ExITNhM3EjcSNxM2EzcSAAX8lJMSNxI3EzcSEhMSEhMUEBUQFDUSNxM3EhIVEBQQExITEhISEzcSEhMSExISEhMSEhITNxISEzcSNxM2EzcSNxI3EwANBQAAAAAAAA=='
@hscissors That's weird. Is the switch platform working? I made a small update to switch.py, could you try again?
@hscissors That's weird. Is the switch platform working? I made a small update to switch.py, could you try again?
The update is online! after doing so, just enter the strings in configuration?
@achille858 Yes, use this template.
@hscissors Let me check if your device is locked. Please run this file using python3 debug.py
. If the led blinks, try to capture a command. Send me debug.txt.
@achille858 Yes, use this template.
Invalid configuration for remote.broadlink
If I indicate “type” in remote, the configuration is wrong
@achille858 You need to update the files manually, the PR is not merged yet.
@InToSSH @goose2600 Do you confirm that broadlink.learn and broadlink.send are working with RM Mini 3 (0x5f36 - new Black Bean) in this latest update?
@achille858 You need to update the files manually, the PR is not merged yet.
@InToSSH @goose2600 Do you confirm that broadlink.learn and broadlink.send are working with RM Mini 3 (0x5f36 - new Black Bean) in this latest update?
But I don’t find the path in Hassio
Hi, I following the above instructions (docker exec -it homeassistant /bin/bash, backup files under /usr/src/homeassistant/homeassistant/components/broadlink/, wget for remote sensor switch const, restart home assistant 0-108.5), put this in my configuration:
``remote:
Attech debug file
debug.txt
When I use sudo docker exec -it homeassistant /bin/bash command, goes in bash-5.0#, then when i try to change directory (cd /usr/src/homeassistant/homeassistant/components/broadlink/) it won't change, but also not giving me errors too. Can't reach directory for backup. Is it still a permission problem?
EDIT: Solved just using the wrong command
@InToSSH @goose2600 Do you confirm that broadlink.learn and broadlink.send are working with RM Mini 3 (0x5f36 - new Black Bean) in this latest update?
Tested and working
@felipediel Tested your new component as switch, installed in original folder and it works with my RM mini 3 newblackbean. Broadlink send and learn services are working nicely.
@InToSSH Thanks for the explanation for command line file management, i've made your backup procedure than installed new files using wget as suggested by @goose2600
Thanks for your great support
@felipediel Tested your new component as switch, installed in original folder and it works with my RM mini 3 newblackbean. Broadlink send and learn services are working nicely.
@InToSSH Thanks for the explanation for command line file management, i've made your backup procedure than installed new files using wget as suggested by @goose2600
Thanks for your great support
where you got the files from? wget...
@achille858 Your three options are: Docker, Hassbian or just wait.
so for who has the HASSoS/HASSIO image (I have the NUC version), is impoossible to apply the fix, correct?
I see 108.6 this
Upgrade broadlink lib to 0.13.1 (@Danielhiversen - #34290) (broadlink docs)
which means is now merged?
(updating now)
EDIT, no that does not fix the issue
@felipediel Tested your new component as switch, installed in original folder and it works with my RM mini 3 newblackbean. Broadlink send and learn services are working nicely.
@InToSSH Thanks for the explanation for command line file management, i've made your backup procedure than installed new files using wget as suggested by @goose2600
Thanks for your great support
where you got the files from? wget...
Other files here https://github.com/home-assistant/core/issues/30215#issuecomment-598982872
@Klagio this instruction should work for you: https://github.com/home-assistant/core/issues/30215#issuecomment-615553072
works for me on HassOS 3.13 / Home Assistant 0.108.6
@Klagio this instruction should work for you: #30215 (comment)
works for me on HassOS 3.13 / Home Assistant 0.108.6
I also have HassOS 3.13 / Home Assistant 0.108.6! do I just have to copy the files to the "custom components"?
@Klagio this instruction should work for you: #30215 (comment)
works for me on HassOS 3.13 / Home Assistant 0.108.6
Ok I followed the instructions (the key was to disable protection mode). I did this cd /usr/src/homeassistant/homeassistant/components/broadlink/
and now I am in
But instructions are a bit confusing to me, do not want to mess with core without clearer instructions
Ok, basically
in /custom_components/broadlink/ put the 4 files const.py, remote.py, sensor.py, switch.py
in /usr/src/homeassistant/homeassistant/components/broadlink launch the command
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/
homeassistant/components/broadlink/remote.py
thjen also this
wget https://raw.githubusercontent.com/mjg59/python-broadlink/0ef417a6c73890f69a084e02e392dd2056745f58/broadlink/__init__.py
put this in configuration.yaml (with appropriate value)
remote:
- platform: broadlink
host: YOUR_IP_ADDRESS
mac: YOUR_MAC_ADDRESS
name: bedroom
then reset all the rm mini and rmpro, conencting only to WiFi, then abort the e-copntrol app
and that's it, correct???
I don't know which mess I did, get the following error in LOG
2020-04-18 17:09:10 ERROR (MainThread) [homeassistant.config] Platform error: remote
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 769, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 277, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/broadlink/remote.py", line 35, in <module>
from . import DOMAIN, data_packet, hostname, mac_address
ImportError: cannot import name 'DOMAIN' from 'homeassistant.components.broadlink' (/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py)
2020-04-18 17:09:10 ERROR (MainThread) [homeassistant.config] Platform error: remote
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 769, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 277, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/broadlink/remote.py", line 35, in <module>
from . import DOMAIN, data_packet, hostname, mac_address
ImportError: cannot import name 'DOMAIN' from 'homeassistant.components.broadlink' (/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py)
2020-04-18 17:09:11 ERROR (MainThread) [homeassistant.config] Platform error: switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 769, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 277, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/broadlink/switch.py", line 26, in <module>
from . import async_setup_service, data_packet
ImportError: cannot import name 'async_setup_service' from 'homeassistant.components.broadlink' (/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py)
@Klagio you no longer have to put anything in the custom_component, it didn't work for me and later Felipe confirmed it is not working anymore. Put all the files (remote, const, sensor, switch) to the homeassistant folder /usr/src/homeassistant/homeassistant/components/broadlink
. I think your log error is caused because you replaced only remote.py and not const.py so it can't read it.
__EDIT__: I also looked at the error now, it looks like you replaced the file __init__.py
as you stated in your comment. The init.py is not supposed to go to the components/broadlink folder (there is one aswell, but don't touch that one), this file you posted is supposed to go to the the python-broadlink lib here: /usr/local/lib/python3.7/site-packages/broadlink
but you don't have to update it now since it is already in the latest version of homeassistant, you only need to update those for files in the component
Same problem with
Discovering...
###########################################
RM4
# broadlink_cli --type 0x5f36 --host 192.168.2.205 --mac xxxxxxxxxxx
Device file data (to be used with --device @filename in broadlink_cli) :
0x5f36 192.168.2.205 08247bannn
temperature = False
It's a RM mini 3
It learns and sends using https://github.com/mjg59/python-broadlink CLI but no answer from HassOS 3.13.
@felipediel I can confirm that both services still work in the v0.108.6 with the files you provided.
__FOR OTHERS__ just a little recap if you are using Docker with HA at least v0.108.0
__NOTE: If you have HassOS image (like for RPi)__ follow the instructions posted by hscissors here to get to the component/broadlink folder, then follow the rest below from step 4.
sudo docker exec -it homeassistant /bin/bash
- this will open new terminal, it will say: bash-5.0#
cd /usr/src/homeassistant/homeassistant/components/broadlink/
mv const.py const.py.bak
, mv remote.py remote.py.bak
, mv sensor.py sensor.py.bak
, mv switch.py switch.py.bak
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/const.py
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/remote.py
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/sensor.py
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/switch.py
ls
, this will list the files in the folder, confirm these four files exist (alongside with their .bak version)remote:
- platform: broadlink
host: YOUR_BROADLINK_IP
mac: YOUR_BROADLINK_MAC
name: "any name if you want"
type: rm_mini3_newblackbean
(this is for type 0x5f36, change to the one you have)
__WARNING__: Do not change the __init__.py
file inside your components/broadlink folder and do not replace it with the init file posted here (it is for the Broadlink python lib which is already included in HA since v0.108.0)
@felipediel I can confirm that both services still work in the v0.108.6 with the files you provided.
FOR OTHERS just a little recap if you are using Docker with HA at least v0.108.0
NOTE: If you have HassOS image (like for RPi) follow the instructions posted by hscissors here to get to the component/broadlink folder, then follow the rest below from step 4.
- Connect to your machine with Docker
sudo docker exec -it homeassistant /bin/bash
- this will open new terminal, it will say:bash-5.0#
cd /usr/src/homeassistant/homeassistant/components/broadlink/
mv const.py const.py.bak
,mv remote.py remote.py.bak
,mv sensor.py sensor.py.bak
,mv switch.py switch.py.bak
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/const.py
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/remote.py
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/sensor.py
wget https://raw.githubusercontent.com/home-assistant/core/f7814116dc878aee6713fb542b114c82e7f63fe4/homeassistant/components/broadlink/switch.py
- type
ls
, this will list the files in the folder, confirm these four files exist (alongside with their .bak version)- Restart HA (otherwise if you put the following config and save it, HA will complain about not being correct and won't allow you to restart from the UI)
- change your HA config to:
remote: - platform: broadlink host: YOUR_BROADLINK_IP mac: YOUR_BROADLINK_MAC name: "any name if you want" type: rm_mini3_newblackbean
(this is for type 0x5f36, change to the one you have)
- Restart HA again, now it shouldn't complain and after reboot it should work
WARNING: Do not change the
__init__.py
file inside your components/broadlink folder and do not replace it with the init file posted here (it is for the Broadlink python lib which is already included in HA since v0.108.0)
thanks much clearer now.
Does this work for rm mini only? Not for rm pro?
And once all these changes are made, I do have to delete the integration in the e-control app, or I can leave it as it is?
@hscissors Let me check if your device is locked. Please run this file using
python3 debug.py
. If the led blinks, try to capture a command. Send me debug.txt.
@felipediel I ran debug,py
. Here are the results: https://gist.github.com/hscissors/26448b38eaf36be9aa64da85fd28de9e
Probably goes without saying, but the light did not blink while running debug.py
@hscissors Your device is blocked for local communications. You need to follow these steps in order to disable the cloud.
type: rm_mini3_newblackbean
Thank you very much.
Now my rm_mini3_newblackbean works correct in HA.
type: rm_mini3_newblackbean
Thank you very much.
Now my rm_mini3_newblackbean works correct in HA.
Where did you download the custom components?
Does this work for rm mini only? Not for rm pro?
And once all these changes are made, I do have to delete the integration in the e-control app, or I can leave it as it is?
@Klagio this works also for pro, just use the correct type:
in the config, possible values can be found in the const.py
file here , just look at the two arrays RM_TYPES and RM4_TYPES and select one from the list according to your device.
If your device can be pinged with the IP and the local communication is not blocked, you don't even have to touch the e-Control app, I believe. In case you enabled cloud, follow the instructions Felipe linked to few comments back.
@achille858 just follow the instructions I posted few comments back, it links you to those 4 important files for the component, along with the tutorial where to put them. If you want to just download the files without wget, just copy the url itself without the wget at the beginning.
@felipediel Followed the steps to disable cloud. Here is the updated gist file that debug.py
produced. I noticed that it does say that the authentication was successful now, but it doesn't learn: https://gist.github.com/hscissors/26448b38eaf36be9aa64da85fd28de9e
@hscissors Your device is now unlocked. Did you try to learn a code when the LED blinked?
@felipediel Ah ok, now debug.py
reports:
12:56:13,309 __main__ DEBUG [Code received]
JgDSAI6VEzgTNxQ3ExITEhMSExITEhM4EzcUNxMSExITEhMSExIUNxMSEzgTEhMSEhMTEhMSExITNxQRFDcTOBM3EzgTNxQABXKTlRM4EzcUNxMSExITEhMSExITOBM3FDcTEhMSExITEhMSFDcTEhM4ExITEhMSExITEhITEzcUEhI4EzgTNxQ2FDcUAAVykpYSORI4EzgSExITEhMSExITEjkSOBM4EhMSExAVEBUSExE6EBUQOhEUERQRFBEVEBUQFRA5EhQROhA6EToQOxA6EQANBQAAAAAAAA==
12:56:14,310 __main__ DEBUG Sending code...
12:56:14,310 __main__ DEBUG [Request]
bytearray(b'Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb1A\x00\x007\'j\x00\xbb\xe3\x08\x8c6\xa7\xdf$\x01\x00\x00\x00b\xd8\x00\x00n\xc8<x\xbd \x91=\x1b~\x0e|B\x0e\xc4\xb8\xb0\xddeV\xa5z`\xb9\x1f\xc1\x85\xec\xb2(zS\x1c\x91i\xdbQ,u\x01\xdc\xb0\xf6\xb7&\x8eT\ni:\x15"jRr\x9f\n\x1b\xa7)\x00\x93\xc1R\xdc.\x16\x96e\x860\x03\x99\x87\xa4\xc9\x93m\xb13\xa2\x8c\xdbp\xe8\x88\x03\xc4\xf1\xa6\xbe\xca\x1f\xc3\x1d91K\x83IJ\xfa\xb4B\xd2\x1aAw\xcbg\xfa\xee\xfaDjB*\x13F\xf44\xa0\xbfS!\xda\x82\xfd\xf3\xaa\x90\xd1K-\xdf\x12\rT\xf5?3Hr\x9b)\x8c\xf4\x0f!\xe8kjq\x99}r\xe2\x90\x84_\xeb\xf7\x98\xb7\x1d\xd4\xdb\xbe\xae\xc4\xcc\xbb\x93W\xbc\xdc\xebS\x1e\x0c\xd9\xcb9\xee\x8d\xb8\xd0:l\x03ZGV\xfb\xe0\xb6\xbe\xcb\n\x03\xae\xc1\\\xb4\x92T\xc0\xbf\xcaR\xb4\xd8\xfb0\xd1\xc3\x18\xcf\xaa6l\x9db\x08\x98\x8f\xc0\x1a\xc9\xce\xb0\xe19;\xbf/\x93\x0c\xe4\xe8')
12:56:14,337 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Q\xcf\x00\x007'\xee\x03\xbb\xe3\x08\x8c6\xa7\xdf$\x01\x00\x00\x00\xb1\xbe\x00\x00\x9c\xa3T\x1d\x04\xae^0\n\xfb\t\x07\xe7\x10S\x86", ('192.168.1.97', 80))
So strangely it still won't work from HA. With this configuration.yaml:
switch:
- platform: broadlink
host: 192.168.1.97
mac: XX:XX:XX:XX:XX:XX
friendly_name: "Broadlink"
type: rm_mini3_newblackbean
When I go to Developer Tools -> Services -> broadlink.send -> packet: { ip: 192.167.1.97, packet: <code from debug.py> }
still, nothing happens. Am I missing something?
@hscissors Your device type is 0x2737. This is not the new Black Bean. It does not need any update to work. The only problem was the cloud. Remove type: rm_mini3_newblackbean
from the configuration file and it will work fine.
Where do you see which model one has?
I have 3 mini and 2 Pro, but which model exactly, have no idea where to look
@Klagio If you run the debug.py
file felipediel posted a few replies back, it will show the type under DEBUG type
in the debug.txt
file
@achille858 You need to update the files manually, the PR is not merged yet.
@InToSSH @goose2600 Do you confirm that broadlink.learn and broadlink.send are working with RM Mini 3 (0x5f36 - new Black Bean) in this latest update?
RM mini3 (firmware v44057) started working after applying your patch on HA 0.108.6: broadlink.learn and send successful. Switch component now also works.
If you run the
debug.py
file felipediel posted a few replies
sorry this thread is enormous. I did a search for debug.py and not sure which is it.
Is it this? https://drive.google.com/file/d/1Gr-Qe_sdVL-Yn2g2ITDFYB1TTpd1pX8Z/view ??
I ran it, on a spare pi, and recieve
pi@piliving:~ $ python3 debug.py
Traceback (most recent call last):
File "debug.py", line 40, in
from cryptography.hazmat.backends import default_backend
ModuleNotFoundError: No module named 'cryptography'
@felipediel Ah! Thanks for catching that. I guess I can confirm that your patch on HassOS 3.13 works for the rm_mini
once I set the type in the configuration to type: rm_mini
@Klagio install the cryptography
package with: pip install cryptography
@Klagio If you run the
debug.py
file felipediel posted a few replies back, it will show the type underDEBUG type
in thedebug.txt
file
Ok after half an hour fighting for pip pip3 and the like, I think I managed. But it gives results for only one of my 5 devices. How to find the others?
1:57:40,924 root INFO Broadlink API Debug
21:57:40,926 __main__ DEBUG Starting discovery...
21:57:40,941 __main__ DEBUG [Request]
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x079\x15\x14\x06\x12\x04\x00\x00\x00\x00\xc0\xa8\x01\xed\xf3\x85\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00')
21:57:41,31 __main__ DEBUG [Response]
bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x079\x15\x14\x06\x12\x04\x00\x00\x00\x00\xc0\xa8\x01\xed\xf3\x85\x00\x00\x9e\xd0\x00\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x87@|#7\'X\x01\xa8\xc0\x84\xdd\xe34\xea4Master bedroom \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00")
21:57:45,946 __main__ DEBUG [Device 0]
21:57:45,948 __main__ DEBUG Host: ('192.168.1.88', 80)
21:57:45,948 __main__ DEBUG Mac: 84dde3xxxxxx
21:57:45,949 __main__ DEBUG Type: 0x2737
21:57:45,949 __main__ DEBUG Starting authentication...
21:57:45,951 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\xf8\x00\x007\'e\x00\xb1\xb2\x84\xdd\xe34\xea4\x00\x00\x00\x00\xa1\xc3\x00\x00E4R\xe7\xf9.\xda\x95\x83D\x93\x085\xef\x9am\xfbi-\xc3p\xb9\x04C\xac\\\xd6?\xbbS\xad\xfa\x08\x81L\xa7\xf8\xcfAq\x002\x8eW\x0c;\x86\xc9M\x05p\x84I\xa3\x89\xe2\x9a\xe1\x04T6\xa0[\xdd\xdc\x02\xc1a\xaf\x13%\xe8~\x19\xb0\xf7\xd1\xce\x06\x8d\xe5\x1ba\x91V\x87m3\x8c\xff;\x99\x1e@\xcd\xb1")
21:57:46,380 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8f\xdd\x00\x007'\xe9\x03\xb1\xb2\x84\xdd\xe34\xea4\x00\x00\x00\x00L\xc6\x00\x00\xfe\xed\xe1\xe0\x8b\x8c\xe3\xbf\xadSx\xcd\xf4\xa3\xa49~\x7f'l\xa2t\x03\xcc\x9f\xeaW\xcf\xe0\xcdOQ", ('192.168.1.88', 80))
21:57:46,382 __main__ DEBUG Authentication successful.
21:57:46,382 __main__ DEBUG Entering learning mode...
21:57:46,383 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbe\xd0\x00\x007\'j\x00\xb2\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb2\xbe\x00\x00\xcd\x99\x07\xf3\x03\x83\xd0I\x88z\x03\xf2F\x0c\x1a}")
21:57:46,406 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00E\xd1\x00\x007'\xee\x03\xb2\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb2\xbe\x00\x00\xcd\x99\x07\xf3\x03\x83\xd0I\x88z\x03\xf2F\x0c\x1a}", ('192.168.1.88', 80))
21:57:46,407 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00W\xd0\x00\x007\'j\x00\xb3\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:46,432 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\xd2\xf6\xff7'\xee\x03\xb3\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:47,435 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00X\xd0\x00\x007\'j\x00\xb4\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:47,471 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd4\xd2\xf6\xff7'\xee\x03\xb4\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:48,473 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Y\xd0\x00\x007\'j\x00\xb5\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:49,245 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd5\xd2\xf6\xff7'\xee\x03\xb5\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:50,249 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Z\xd0\x00\x007\'j\x00\xb6\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:50,270 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd6\xd2\xf6\xff7'\xee\x03\xb6\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:51,273 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00[\xd0\x00\x007\'j\x00\xb7\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:51,692 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd7\xd2\xf6\xff7'\xee\x03\xb7\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:52,695 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\\\xd0\x00\x007\'j\x00\xb8\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:53,119 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\xd2\xf6\xff7'\xee\x03\xb8\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:54,122 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00]\xd0\x00\x007\'j\x00\xb9\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:54,546 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd9\xd2\xf6\xff7'\xee\x03\xb9\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:55,549 __main__ DEBUG [Request]
bytearray(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00^\xd0\x00\x007\'j\x00\xba\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14")
21:57:55,570 __main__ DEBUG [Response]
(b"Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xda\xd2\xf6\xff7'\xee\x03\xba\xb2\x84\xdd\xe34\xea4\x02\x00\x00\x00\xb3\xbe\x00\x00\x0c\x92}9\tCK\x85\x9f\x80\x19\xdb\x95p\xda\x14", ('192.168.1.88', 80))
21:57:56,572 __main__ DEBUG Failed to learn: no code received.
Your device type is 0x2737
so for this device, in configuration.yaml only as below (take out type??)
switch:
- platform: broadlink
host: 192.168.1.97
mac: XX:XX:XX:XX:XX:XX
friendly_name: "Broadlink"
# type: rm_mini3_newblackbean
@Klagio You're in the same situation I was. It's not a rm_mini3
it's the mini. Add: type: rm_mini
. Then try using the "learn" command.
Not sure about finding other devices.
ou're in the same situation I was. It's not a
rm_mini3
it's the mini. Add:type: rm_mini
.
ok, that was the setting used with the standard component for that type
I guess for other devices we need to put as below. But debugg.py does not find other 4 devices I have, only 1
sp1: [0],
sp2: [0x2711, # SP2
0x2719, 0x7919, 0x271a, 0x791a, # Honeywell SP2
0x2720, # SPMini
0x753e, # SP3
0x7D00, # OEM branded SP3
0x947a, 0x9479, # SP3S
0x2728, # SPMini2
0x2733, 0x273e, # OEM branded SPMini
0x7530, 0x7546, 0x7918, # OEM branded SPMini2
0x7D0D, # TMall OEM SPMini3
0x2736 # SPMiniPlus
],
rm: [0x2712, # RM2
0x2737, # RM Mini
0x273d, # RM Pro Phicomm
0x2783, # RM2 Home Plus
0x277c, # RM2 Home Plus GDT
0x272a, # RM2 Pro Plus
0x2787, # RM2 Pro Plus2
0x279d, # RM2 Pro Plus3
0x27a9, # RM2 Pro Plus_300
0x278b, # RM2 Pro Plus BL
0x2797, # RM2 Pro Plus HYC
0x27a1, # RM2 Pro Plus R1
0x27a6, # RM2 Pro PP
0x278f, # RM Mini Shate
0x27c2, # RM Mini 3
0x27d1, # new RM Mini3
0x27de # RM Mini 3 (C)
],
rm4: [0x51da, # RM4b
0x5f36, # RM Mini 3
0x6026, # RM4 Pro
0x610f, # RM4c
0x62be # RM4c
],
a1: [0x2714], # A1
mp1: [0x4EB5, # MP1
0x4EF7 # Honyar oem mp1
],
@Klagio What devices are not being discovered?
@Klagio What devices are not being discovered?
I have other 2 mini and a pro that I can't ping. Plus another rm pro which I can ping .
Then I also have MP1, TC2, SC1, but not sure your code is for those too
Not sure about the model, of the pro. Broadlink company is pretty shitty in its marketing, so confusing.
EDIT ok seems a WiFI problem too, oh gosh. The one RM pro is
0x272a, # RM2 Pro Plus
EDIT2: BTW the MAC addresses are reversed
@Klagio You are facing a different problem, which is being caused by your SC1 device. This solution applies only to the new RM Mini 3 and RM4 series. It won't work for you.
@Klagio You are facing a different problem, which is being caused by your SC1 device. This solution applies only to the new RM Mini 3 and RM4 series. It won't work for you.
Oh ok, I will try to take out the SC1, if thats the problem
RM4 and RM2 pro plus are two diffrent series?
p.s. WTF happened with these broadlink devices. I use them since years on Home Assistant and they always worked fine
@Klagio You are facing a different problem, which is being caused by your SC1 device. This solution applies only to the new RM Mini 3 and RM4 series. It won't work for you.
Oh ok, I will try to take out the SC1, if thats the problem
RM4 and RM2 pro plus are two diffrent series?
p.s. WTF happened with these broadlink devices. I use them since years on Home Assistant and they always worked fine
new broadlink devices have a different system that works only on cloud with the app. the only way to use it with hass is not use the broadlink app. new rm4 not support IHC but only broadlink app. probably one works cloud and the other locally.
new broadlink devices have a different system that works only on cloud with the app. the only way to use it with hass is not use the broadlink app. new rm4 not support IHC but only broadlink app. probably one works cloud and the other locally.
@saggit Yes. The first step for someone experiencing problems with Broadlink devices is to disable the cloud. Without that, you can't even debug.
RM4 and RM2 pro plus are two diffrent series?
@Klagio Yes. RM4 devices need a special header for communication.
p.s. WTF happened with these broadlink devices. I use them since years on Home Assistant and they always worked fine
No idea. I am working on an upgrade that will improve communication with Broadlink devices. Perhaps it will solve the problem. If it doesn't, at least my code will bring us some debug data.
new broadlink devices have a different system that works only on cloud with the app
mine are "old" broadlink devices (rm_mini, rm_pro_plus, TC2) , I have them since years and always worked fine with Home Assistant. I did not change anything from the Broadlink app (no change of firmware, nothing). Problems started around 105 or 106.
So the problems is for sure in Home Assistant code
I followed and configured everything, but when I call the service “Brodlink.learn” the answer is called failed... 🤦🏼♂️
@achille858 Did you disconnect your device from the cloud? This step is mandatory.
Another important step is to insert the correct device type in the configuration file. If you don't know the type, use rm_mini
and if it doesn't work try rm_mini3_redbean
.
Yes. RM4 devices need a special header for communication.
p.s. WTF happened with these broadlink devices. I use them since years on Home Assistant and they always worked fine
No idea. I am working on an upgrade that will improve communication with Broadlink devices. Perhaps it will solve the problem. If it doesn't, at least my code will bring us some debug data.
Ok, now I get it. All this work is for the NEW rm mini and NEW rm4, not for the old series.
Well await your work, so at least will know whats happening also with older devices. Thanks
@achille858 Did you disconnect your device from the cloud? This step is mandatory.
Another important step is to insert the correct device type in the configuration file. If you don't know the type, use
rm_mini
and if it doesn't work tryrm_mini3_redbean
.
Yes the cloud is disconnected and the type is rm_mini3_newblackbean. Both with "rm_mini3_newblackbean" and with "rm_mini" I have a call error in the service Broadlink.learn
my configuration:
and debug:
debug.txt
@achille858 I just checked your debug. Your device is in fact a new Black Bean. The cloud is disabled and the device can be controlled locally.
Your device responded correctly to all commands. It should be working fine with this update. Please check your installation of Home Assistant and your configuration file.
Hi @felipediel
Thank you for the great support.
When does your patch will be merged?
@achille858 Have you tried setting up a remote:
component instead of switch:
component and using remote.learn_command and remote.send_command services?
@skakooli2 It's already merged. It will come in the next release.
@felipediel Thank you very much for all your great work on this. Our devices would be useless without you 😄 I am glad it was already merged, so we don't have to keep replacing the component.
@felipediel thank you very much. We just have to wait for the next release.
@felipediel , 108.7 is out but I didn't noticed any info in chancelog.
Should we expect the changes to be included or we have to wait for a newer version ?
Simone
@chemelli74 It may take a while to merge into the master branch. I hope it comes in the next release. Not something I can control.
@chemelli74 It may take a while to merge into the master branch. I hope it comes in the next release. Not something I can control.
custom component trick still working with last update, only thing is change __init__.py every update. i home 0.109 will have this component updated. :)
anyway it's working fine in these days.
@sagitt which init.py I need to replace after every update? What file I need to use too? Thanks
@sagitt which init.py I need to replace after every update? What file I need to use too? Thanks
see up
Sorry i think i didn't undertand. I updated home assistant to version 108.8, now gives me a configuration error on remote.py and switch.py. What should i do to make it work again?
EDIT: Solved! replaced files again in broadlink folder
@felipediel fala cara, tudo bem? Primeiramente, parabéns e obrigado pela contribuição. Estou tentando fazer meu rm mini 3 (novo blackbean) funcionar aqui, já segui diversos passos e até agora, consegui conectar ao home assistant (desconectado do cloud da broadlink e tdo mais). Porém, não consigo fazer ele "aprender" os inputs de um controle. Tentei tanto pela plataforma remote, utilizando learn (neste caso ele não cria o arquivo com os codigos) tanto pela switch (dá notificação de que não recebeu nenhum input). Saberia me indicar algum teste/configuração pra solucionar esse problema? Tem ideia do que pode estar rolando?
@techmarktm Opa, tudo certo? Estes são os passos necessários:
rm_mini3_newblackbean
).Isso já foi testado por bastante gente, deveria funcionar. Se não der certo, por favor rode este arquivo usando python3 debug.py
, tente capturar um comando e me envie debug.txt para eu dar uma olhada.
@techmarktm O envio de comandos está funcionando?
opa, valeu pela resposta rápida @felipediel . Cara, foi uma grande confusão minha, eu acho. (problema de hardware, aquele entre a cadeira e o teclado rs) Achei que já tinham atualizado essa feature no componente da broadlink na 0.108.8, mas como você comentou ali (no passo 2 das suas sugestões) tem que atualizar o componente manualmente pela dev branch. Como nunca fiz esse tipo de procedimento, nem imaginei que teria de fazer isso rs. Vou dar uma olhada em como faz isso, pelo que vi é usando a pasta custom_components né? Assim que eu tiver algum resultado, dou um feedback. Valeu!
@techmarktm Você precisa substituir os arquivos na pasta original. Os arquivos são estes. Você encontra aqui um passo a passo para fazer isso usando HassIO, SSH e Docker.
Outra opção seria instalar a versão de desenvolvedores do Home Assistant, mas ela pode trazer bugs e erros de estabilidade:
pip3 install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev
Ou, se quiser esperar, acho que não vai demorar muito.
@felipediel consegui aqui. Joguei esses arquivos em config/custom_components/broadlink e funcionou normalmente. Mais uma vez, agradeço pela atenção e contribuição com o componente. Faço-me a disposição caso precise de testes no newblackbean. Att.
Estranho, os usuários não estavam mais conseguindo por essa pasta. Que bom que voltou a funcionar.
Estou refatorando a integração Broadlink. Vou implementar a descoberta de dispositivos e melhorar a comunicação. Vou precisar de ajuda para testar quando terminar, aí eu aviso por aqui. Valeu, abraço!
Beleza! Show de bola, vai dar uma baita ajuda. Precisando então, estarei por aqui. Grande abraço.
bom dia @felipediel. Eu estou enfrentando o mesmo problema com os BL mini 3 modelo 5f36, porém eu utilizo esse http server https://github.com/rob121/broadlinkgo rodando em um Raspberry pi 4 para posteriormente poder enviar os comandos via HTTP get do meu Hubitat Elevation. Eu consegui inserir o 5f36 na lista de dispositivos (arquivo knowndevices.go) e quando rodo o server ele consegue encontrar o dispositivo mas ele não responde aos comandos enviados. Tentei seguir os passos descritos aqui no forum (pelo IHC conectar o BL e depois interromper o processo) porém mesmo assim não funcionou. Sei que não é exatamente o tópico aqui, mas não consegui encontrar informações em nenhum outro lugar. Você tem alguma ideia para me ajudar? No seu https://github.com/felipediel/python-broadlink aparentemente vc descreve a forma de conectar esses dispositivos, talvez se eu utilizar o seu programa para conectar eles e depois eu rodar meu server poderia ser uma opção? Desde já agradeço pela sua atenção. Toda ajuda é bem vinda. Obrigado
@alpaville21a14 Você pode adaptar a sua biblioteca com as mudanças que fiz neste pull request. O que estes novos dispositivos precisam basicamente são cabeçalhos especiais no payload. Repare que eu começo construindo os payloads a partir desses cabeçalhos e acrescento a mensagem em seguida.
@felipediel @alpaville21a14
Que bom que estão falando português ! me ajuda muito meu ingles é negação total.
Por favor me avise se conseguir algo @alpaville21a14 . Eu também uso esse mesmo Hub aqui na França.
@alpaville21a14 Você pode adaptar a sua biblioteca com as mudanças que fiz neste pull request. O que estes novos dispositivos precisam basicamente são cabeçalhos especiais no payload. Repare que eu começo construindo os payloads a partir desses cabeçalhos e acrescento a mensagem em seguida.
Muito obrigado @felipediel pelo retorno. Eu sou praticamente leigo na programação, então não sei nem por onde começar mas vou tentar aqui. Você trabalha com isso ou é somente um hobby? Conforme for, se possível, poderíamos fazer contato direto e aí a gente combina alguma forma pra vc fazer estes ajustes pra mim. Obrigado
@alpaville21a14 Faço os dois. Sou apaixonado por programação e automação residencial.
Estou dedicando praticamente todo o meu tempo livre para melhorar esta integração dentro do Home Assistant. Tem coisas bem legais vindo aí. Mas se você estiver precisando de algo diferente podemos conversar. Meu e-mail é [email protected]. Abraço!
@felipediel, what you think about starting a project for a tool able to extract codes from Broadlink mobile app database ? Would be nice to avoid learning hundreds of codes ;-)
Simone
I think it's a good idea. We can get codes from crowd-sourced databases and turn them into dictionaries compatible with the remote platform. I think IRDB would be a good start.
But first I need to implement discover() and config entries because this is blocking contributions and preventing this integration from growing. Then I have to finish the climate platform, which ended up forgotten in the middle of so many updates.
@felipediel , is there a chance that documentation is outdated ? I'm refering to https://www.home-assistant.io/integrations/broadlink/
I have configured both "remote:" and "switch:".
I can fin a service "broadlink.learn" but not one called "remote.learn_command".
Service works fine:
but comes from the "switch:" config, as window title states.
Simone
@chemelli74 Home Assistant changed: RemoteDevice class is now called RemoteEntity. If you are using an old custom component for the Broadlink remote platform you need to adapt it (although you no longer need custom components to control your RM4, as it now has native support).
@chemelli74 Home Assistant changed: RemoteDevice class is now called RemoteEntity. If you are using an old custom component for the Broadlink remote platform you need to adapt it (although you no longer need custom components to control your RM4, as it now has native support).
I'm on plain 0.109.2, everything in custom_components about broadlink has been removed before upgrading.
Simone
@chemelli74 Strange. I will have a look. Error messages? Does this solution work for you?
@chemelli74 Strange. I will have a look. Error messages? Does this solution work for you?
I'm already using ip address not DNS.
Simone
@chemelli74 No error messages? Are you using any custom components?
This is the best I have to offer you today. If it doesn't work we will have to investigate.
@chemelli74 No error messages? Are you using any custom components?
This is the best I have to offer you today. If it doesn't work we will have to investigate.
Will try to update using those files from 17 days ago and report back asap.
Simone
@chemelli74 You should get all the files. This newer version provides more accurate debug messages. Even if it doesn't solve your problem, it will help us understand it.
Hey @dennisadvani what's up!
Do you remember how you managed to control the device with the cloud disabled during captures?
I need to teach a user how to do this in order to add RF support to RM4 Pro.
Hey @felipediel,
Nothing much apart from a lot of social distancing! :) As far as I know, the device local API is always active and available on the device. To force local comms via the app:
With the app blocked from the internet, you can't login or configure additional remotes.
@dennisadvani Thank you! :+1:
Good evening,
sorry, but with the new version of home assistant at 0.109.6 there is no custom-component broadlink where to replace the files.
How can RM3 mini be added with the new version with firmware 44057?
@The-Course You don't need custom components anymore. This device now has native support. See the troubleshooting section of the documentation to learn how to configure it.
@chemelli74 I think I know where your problem is. Go to Settings
-> Entity registry
. Delete the remote entity that has a <!>
and remove the _2
from the name of the duplicate entity.
I did a fresh install of everything and I'm a bit lost :-(
From command line everything works fine:
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> devices = broadlink.discover(timeout=5)
>>> devices[0].auth()
True
>>> devices[0].enter_learning()
>>> ir_packet = devices[0].check_data()
>>> ir_packet
b'&\x00\xe6\x00j9\x0e+\r+\x0f\x0f\r\x10\r\x10\r,\x0e\x0f\r\x10\r,\x0f*\x0f\x0e\r,\r\x10\r\x10\r,\x0f*\x0e\x0f\r,\x0e*\x0f\x0f\r\x10\r,\r\x10\r\x10\r,\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x10\r\x11\r\x10\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x10\r\x11\r\x10\r,\r\x10\r\x10\r,\r\x10\r\x10\r\x11\r\x10\r\x10\r\x10\r\x11\r\x10\r\x10\r\x10\r,\r\x10\r\x11\r\x10\r,\x0e\x0f\r\x10\r\x10\r,\x0f*\x0f\x0e\r\x10\x0e\x10\r\x10\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x10\x0e\x10\r\x10\r\x10\r\x11\r\x10\r\x10\r\x10\r\x11\r\x10\r\x10\r\x10\r\x11\r\x10\r\x10\r\x10\r\x11\r\x10\r\x10\r,\r,\x0e\x0f\r,\x0e\x0f\r,\x0e*\x0f\x00\r\x05\x00\x00'
>>>
but from HA I get timeout from switch:
2020-05-12 00:12:47 ERROR (MainThread) [homeassistant.components.broadlink] No signal was received
and from remote:
2020-05-12 00:13:26 ERROR (MainThread) [homeassistant.components.broadlink.remote] Failed to learn 'turn on/climate': no signal received
my switch.yaml:
- platform: broadlink
host: !secret broadlink_ip
mac: !secret broadlink_mac
timeout: 30
type: rm_mini3_newblackbean
friendly_name: 'Broadlink Mini Salotto'
and my remote.yaml:
- platform: broadlink
host: !secret broadlink_ip
mac: !secret broadlink_mac
type: rm_mini3_newblackbean
Any idea what I'm missing ? Must be something really stupid but I can't see it unfortunately.
Simone
@chemelli74 Does the LED blink? Check the IP address. My guess is that you are sending the command to the wrong device.
@chemelli74 Does the LED blink? Check the IP address. My guess is that you are sending the command to the wrong device.
Nope, LED doesn't blink.
I double checked data more than once and I compared them with those detected by "Broadlink Manager" (that works): they are absolutely identical :-(
Any debug log I can enable to investigate further ?
Simone
@chemelli74 I need to debug you.
@chemelli74 I need to debug you.
Debug pointed me to the solution.
First run:
bash-5.0# python3 broadlink_debug.py
Traceback (most recent call last):
File "broadlink_debug.py", line 1049, in <module>
devices = discover(timeout=5)
File "broadlink_debug.py", line 115, in discover
local_ip_address = socket.gethostbyname(socket.gethostname())
socket.gaierror: [Errno -2] Name does not resolve
Added "127.0.0.1 homeassistant" to /etc/hosts and debug worked: https://pastebin.com/0yNfQWg2
Now the Question is: why hosts is not correctly filled in docker ?
Simone
@chemelli74 The problem is the device type. Your device is not the new black bean. Remove type: rm_mini3_newblackbean
from your config and it will work fine.
@chemelli74 The problem is the device type. Your device is not the new black bean. Remove
type: rm_mini3_newblackbean
from your config and it will work fine.
Thx a lot for your patience and support.
I don't understand what's changed since I was testing the component as a custom_components, but anyway now it's fixed.
Simone
Hi,
Thanks a lot for your work.
Can you help me with configuring RM3 0x5f36?
I have 2 RM3:
I think I have tried almost every possible combination:
but I can't get it to work.
The only way to get it to read commands is with your debug.py file. (white light turns on and in debug.txt I find the base64 code)
I have read codes with debug.py but when using them with the broadlink.send or remote.send services they don't work.
thanks, and sorry for my bad english (google translator is my friend)
@malpaso68 Any error messages?
@ malpaso68 ¿ Algún mensaje de error?
It depends on the type that I define in switch or remote, errors appear in the log.
Right now I just defined it as type newblackbean and no errors appear in the log, but the entity hasn't created me either.
configuration.yaml:
platform: broadlink
host: 192.168.1.111
mac: 24:df:xx:xx:xx:3f
type: rm_mini3_newblackbean
timeout: 30
retry: 5
switches:
tvcaseta:
friendly_name: "TVCaseta"
command_on: 'JgBgAAABIZUTEhITEhMSOBMTEhMSExITEjgSOBI5EhMSOBI4EjgSOBMTEjgSExITEhMSExITEhMSORITEjgSOBI4EjkSOBI4EgAFGQABJksSAAxYAAEnShIADFoAASNLEwANBQAAAAAAAA=='
command_off: 'JgBgAAABIpQTExITERURORITERQRFBITETgTOBI4ExISOBI4EjkSOBM3EhMTOBEUEhMRFREUERMSFBE4ExISORI5EjcSORE4EgAFGAABJ0sSAAxbAAEjSxMADFYAASZLEgANBQAAAAAAAA=='
platform: broadlink
host: 192.168.1.14
mac: '78:0f:xx:xx:xx:7a'
timeout: 15
retry: 5
switches:
tv_salon_lg:
friendly_name: "TV Salon LG: POWER"
command_on: 'JgBYAAABIJISExETETcSEhISEhQQFBETETcROBESEjcRNhM1EjcTNRMTERISNxEUERMSExE2EjYSNhM2EhIROBE3ETcREhITEgAFGwABH0oSAAwzAAEfShEADQU='
command_off: 'JgBYAAABIJISExETETcSEhISEhQQFBETETcROBESEjcRNhM1EjcTNRMTERISNxEUERMSExE2EjYSNhM2EhIROBE3ETcREhITEgAFGwABH0oSAAwzAAEfShEADQU='
@malpaso68 Did you disconnect the device from the cloud? I need to see the error messages to understand what is going on.
@ malpaso68 ¿Desconectó el dispositivo de la nube? Necesito ver los mensajes de error para entender lo que está sucediendo.
I just checked it in IHC app and BROADLINK app.
I only have 0x2737 configured in IHC, 0x5f36 is detected by the apps but it is not added.
@ malpaso68 ¿Desconectó el dispositivo de la nube? Necesito ver los mensajes de error para entender lo que está sucediendo.
I just checked it in IHC app and BROADLINK app.
I only have 0x2737 configured in IHC, 0x5f36 is detected by the apps but it is not added.
I have rebooted again and have seen this in the log:
2020-05-13 17:08:30 ERROR (MainThread) [homeassistant.components.switch] Error while setting up broadlink platform for switch
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, *self.kwargs)
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/broadlink/switch.py", line 117, in setup_platform
broadlink_device = blk.rm4((host, DEFAULT_PORT), mac_addr, None)
AttributeError: module 'broadlink' has no attribute 'rm4'
@malpaso68 You need to update Home Assistant.
@malpaso68 You need to update Home Assistant.
I think I'm in the last version. 0.109.6.
@malpaso68 Do you have anything in the custom_components/broadlink
folder? If so, please delete and reboot.
No, I don't have / broadlink on custom components.
/home/homeassistant/.homeassistant/custom_components $ ls -l
total 20
drwxr-xr-x 4 homeassistant homeassistant 4096 may 5 12:14 anniversaries
drwxr-xr-x 9 homeassistant homeassistant 4096 may 12 13:47 hacs
drwxr-xr-x 3 root root 4096 feb 6 14:24 hysen
drwxr-xr-x 2 homeassistant homeassistant 4096 mar 1 19:12 Sonoff
drwxr-xr-x 3 homeassistant homeassistant 4096 may 12 18:16 uilogs
I have verified that I really have the 0.109.6 version...
@malpaso68 Try removing hysen.
@malpaso68 Try removing hysen.
How many beers should I invite you to ?.
Works !!
Does this mean that I cannot have the Hysen (Broadlink Hysen) climate integration coexisting with the "0x5f36"?
@malpaso68 I think hysen was forcing an outdated version of the library in the manifest. You can try the latest version of this component. But if they don't bump the library to 0.14 soon, you will have problems with the next release of Home Assistant.
@felipediel, a quick OT question, if you have time:
Seems that my on/off single remote button send a bunch of different codes.
I was expecting the same for off and on, or at worst one for on and one for off; but it's not the case:
"1": "JgDmAGo5DioOKw4PDRANEQ4qDRENEA4rDSsODw4rDg8NEA4rDisNEA0sDioOEA0QDSwNEA0QDisODw4PDRANEQ0QDg8NEA4PDhANEA4PDg8OEA0QDRAODw4PDisNEA4QDSsODw4QDg8ODw4PDisODw4PDhANEA4rDSsOKw4PDg8OEA4PDisNDg8rDhANKw4rDisODw4PDhANEA0QDg8NEA4QDRAODw4PDg8OEA0QDg8ODw4QDRANEA4PDRAOEA0QDg8NEA4QDRAODw0QDg8OEA4PDRAODw4QDSsODw4QDg8ODw4PDRENAA0FAAA=",
"2": "JgDmAGo5DisOKg0RDRAODw4rDg8ODw4rDisNEA0rDhAODw0sDSsOEAwsDSwODw4PDSwODw4QDSsODw4QDRAODw4PDhANEA0QDg8ODw0RDRAODw4PDRAOEA4PDg8ODw4QDSsOEAwRDg8ODw4PDisODw4QDRAODw0sDioNLA4PDhANEA4PDisODw0sDRAOKwwsDisODw4PDhANEA0QDg8OEA0QDg8ODRAPDhANEA4PDRAOEA0QDg8ODw4QDBENEA4PDg8NEQ0QDg8ODw4PDhAODw4PDg8OEAwRDioOKw4rDisNKw4rDisOAA0FAAA=",
"3": "JgDmAGo5DioOKw4PDg8OEA4qDhANEA4rDSsNEQ0rDg8OEA4qDisODw4rDisNEA4PDisODw4PDisODw0QDhANEA4PDRANEA4QDRAODw4PDRENDw4QDg8NEQwRDioNEQ0QDSwNEA0QDg8NEA0RDCwOEA0QDg8NEA4rDSwNKw4QDRAODw4PDisODw4rDg8NLA4rDSsODw4QDRAODw4PDhAMEQ4PDg8ODw4QDg8ODw0QDhANDw4QDg8NEA4QDg8ODw4PDhANEA4PDg8ODw4QDg8NEA4PDg8OEA4PDSwODw4PDg8OEA0QDRAOAA0FAAA=",
"4": "JgDmAGs5DioNLA0QDg8OEA4qDRENEA0rDisODw4rDg8OEA0rDisODw4rDisNEA4PDisODw4PDSwODw0QDhANEA4PDg8ODw4QDRAODw4PDRENEA4PDg8ODw0RDRAODw4PDSwODw4PDhANEA4PDisODw4PDhAMEQ4qDisOKw0QDRAOEA0QDSsOEA0rDREOKg4rDisODw0QDg8OEA0QDg8ODw4QDg8ODw4PDhAMEQ0QDg8NEA4QDRANEA4PDhANEA4PDg8NEA0RDg8ODw0QDRENEA4PDg8OEA0QDioOKw4rDisNKw4rDisOAA0FAAA=",
"5": "JgDmAGo5DisOKw0QDg8ODw4rDg8ODw4rDisODw4rDRAODw4rDSwNEA4qDSwOEA0QDSsODw0RDSwNEA4PDRANEA0RDRANEA0QDRIMEA4PDhANDw0RDRAODw0QDhENDw0QDSwODw4PDRAOEA0QDisNEA4PDRANEQwsDSwNLA0QDRAOEA0QDCwNEA0sDg8NLA0sDSwNDw4QDg8ODw0RDg8NEA4PDhENDw0QDRANEQ0QDRANEA0QDRINDw0RDQ8NEQ0RDRANEA0QDBINDw0RDQ8NEgwRDQ8NEA0RDSsOKw0sDioNLA4rDSwOAA0FAAA=",
"6": "JgDmAGs5DSsOKw4PDRENEA0rDhANEA4rDSsOEA0rDg8OEA0rDisODw4rDisNEA4PDisNEA4PDisNEA4PDhANEA0QDRAOEA0QDRANEA4PDhANEA4PDg8ODw0RDg8NEA0RDSsODw4PDhAODw0QDisODw4QDRANEA4rDSsOKw0QDREMEQ4PDisODw4rDg8OKw0rDisNEA4QDBENEA4PDRAOEA0QDg8ODw0RDBEODw4PDRAOEA4PDg8ODw4QDRAODw4PDhANEA4PDg8ODw4QDRAODw4PDhANEA4PDSwOKg4rDisOKw4qDSwOAA0FAAA=",
"7": "JgDmAGo6DSwNKw0RDBENEA0sDRANEA0sDisMEQ0rDhANEQwsDCwOEAwsDisPDg0RDSsODw0RDSsNEA0RDRAODw0QDhAMEgwQDRANEA0SDQ8NEA4PDhANEA0QDisNEA0RDSsNEA0QDRANEQ0QDSwNEA4PDg8NEQ4qDSwOKw0QDg8NEA4QDCwNEQwsDRANLA0sDSwNEA4PDg8NEA0RDRANEA0QDRENEA0QDRANEQ0QDRAODw4PDRENEA0QDRANEQwRDRENEA0QDRANEQ0PDRAOEAwSDQ8ODw0QDSwODw4QDRANEA0QDREOAA0FAAA=",
"8": "JgDmAGk6DisOKg4QDRAODw4rDg8ODw0sDisNEA4rDQ8OEA4rDSsNEQ0rDisODw0RDSsODw0RDSsOEA0QDg8ODw0QDRENEA4PDg8OEA0QDg8ODw4PDRENEA4PDg8NEQ0QDSsOEA0QDg8ODw0RDSsOEA0QDRAODw4rDisNKw0RDRAODw0QDSwODw0sDRANLA4rDSsODw4QDRAODw4PDhAODw0QDRAOEAwRDRAODw4PDhANEA4PDg8OEA0QDg8ODw0QDhANEA4PDg8OEA0QDg8ODw0RDRAODw0QDisNLA0rDisOKw0rDisOAA0FAAA=",
What do you think ?
Simone
@chemelli74 This is normal, every toggle button behaves like this. Think of it as a debounce to avoid turning the device on and off with a single click. I created a feature to mimic this behavior. Whenever you want to capture a toggle button, use alternative: True
to capture an additional code. This significantly increases the response rate. Sometimes channel and volume buttons also behave like this. The rule is if you are having problems, use this feature.
@chemelli74 This is normal, all toggle buttons behave like this. Think of it as a debounce to avoid turning the device on and off with a single click. I created a feature to mimic this behavior. Whenever you want to capture a toggle button, use
alternative: True
to capture an alternative code. This increases the response rate significantly.
Will test for sure, but I don't get how the code change each time.
I mean I learned 8 times: witch of the 2 should I use in config ? I was expecting one for on and one for off, toggling. Nothing more.
Simone
EDIT: I'm using SmartIR so codes should go there in the end.
The logic in the device is:
if code != previous_code:
execute(code)
So any different code will work. Of course, the best alternative would be to switch between the eight codes to decrease the risk of collision when you are using a parallel remote. This would reduce the chances of a collision from 6.25% to 1.56%. But I don't think this justifies a fourfold effort in capturing.
SmartIR does not have this feature. Only the remote platform supports it.
Thank you so much for the detailed explanations and the time you spent for me!
The logic in the device is:
if code != previous_code: execute(code)
So any different code will work.
Interesting.
Will try to learn more than 8 codes and see if there is a repeating pattern.
Then will test with vanilla Broadlink integration.
Of course, the best alternative would be to switch between the eight codes to decrease the risk of collision when you are using a parallel remote. This would reduce the chances of a collision from 6.25% to 1.56%. But I don't think this justifies a fourfold effort in capturing.
So basically, if I use only Broadlink and no physical remote, one "on" and one off" codes should be enough ;-)
SmartIR does not have this feature. Only the remote platform supports it.
Author added a "on" command for me to test ;-)
But so far doesn't work for me.
Simone
What is this error and how to avoid it ?
2020-05-16 12:58:37 ERROR (MainThread) [homeassistant.components.broadlink.remote] Failed to learn 'turn on/climate': The device storage is full
Simone
So any different code will work. Of course, the best alternative would be to switch between the eight codes to decrease the risk of collision when you are using a parallel remote. This would reduce the chances of a collision from 6.25% to 1.56%. But I don't think this justifies a fourfold effort in capturing.
Based on your comment, I think to get this feature complete and working 100% of the times, there should be possibility to store more "on" codes and "off" codes depending on the number of remotes you have: 1 for HA and 1 for each remote.
That way sending all of them one after the other, should for sure avoid the conflict and allow A/C to execute the command.
What you think ?
Simone
Doesn't work. The only way to achieve 100% reliability is to send another code (one that makes no difference) to clear the cache first.
Doesn't work. The only way to achieve 100% reliability is to send another code (one that makes no difference) to clear the cache first.
Humm, doesn't the cache store only the last code ? So why sending more than one is not 100% reliable ?
Simone
P.S.> I'm on discord, maybe we can discuss there more than here.
Because the physical remote doesn't know your plan. It doesn't know the last code you sent, and you don't know the last code it sent, so the risk of a collision will always exist for repeated commands.
But this risk is not significant. Most remotes use at least one byte of variation. This represents a 0.2% chance of collision, which is completely acceptable.
I am so curious to learn that I would like to understand that in depth, so sorry if I reply again.
Based on the rule:
if code != previous_code:
execute(code)
there can be only 1 conflicting code: if I send from HA the same code that was sent from the remote, then nothing happens.
Assuming the cache is related to only 1 entry, the last received, if I send a couple of different "on" codes, I am 100% sure that the A/C will switch on.
So, it is not important what the A/C last received, to get a reliable command is enough to send 2 working "on" codes.
If not the first, then the second works for sure.
To confirm that, I tried a combination of more than 100 on/off sequences mixing physical remote button press and “broadlink.send” command with 1 on and 1 off.
Once I get the conflict, doing another “broadlink.send” with different code always fixed the action and command was executed.
Where am I wrong?
What am I missing ?
Simone
The code is the same for turning the device on and off.
STATE_OFF
-> power
-> power (different)
-> power (different)
-> STATE_ON
STATE_OFF
-> power
-> power
-> power (different)
-> STATE_OFF
No matter how many times you add power (different)
in the end, you will just be turning the device on and off several times without eliminating the unpredictability that occurred from step 1 to 2. And that's ok, this is the industry standard, you don't have to worry about that.
Got your point, and make perfect sense. Thank you.
My A/C has different code for on and off this is why I was not able to follow you ;-)
And I'm not alone: https://github.com/smartHomeHub/SmartIR/issues/348#issuecomment-629799359
Simone
These are the discrete codes. They are always the best option, but they are difficult to obtain, since the remote does not emit them clean (it adds the variation bytes because it does not know the real state of the device).
Sometimes it is possible to transform the captured code into a discrete code by removing the variable part. Good to know that you found them clean, this is definitely the way to go.
@chemelli74 Do you remember what caused the storage error? And how did you solve it? There is another user reporting this error, but I don't have the device to reproduce it.
@chemelli74 Do you remember what caused the storage error? And how did you solve it? There is another user reporting this error, but I don't have the device to reproduce it.
I have only a wild guess about it: I learned a lot of codes to understand the on/off thing when I saw it, so I bet it's related to the time last code stays in device cache.
A reboot of the device seems to have cleaned it for me.
Simone
I think there are some things we still don't know about those special headers. Perhaps they contain flags like "store this code" or "clear the cache". I will investigate further when I have the device.
I think there are some things we still don't know about those special headers. Perhaps they contain flags like "store this code" or "clear the cache". I will investigate further when I have the device.
Same issue here, RM4 Pro, i am also get the error "Failed to enter learning mode: The device storage is full".
I've tried restart the device and also reset to factory and the error still display every time i call the learning or sending service.
any idea?
I found a few different headers in my files and created a possible solution. Can anyone help me test it?
I found a few different headers in my files and created a possible solution. Can anyone help me test it?
Library updated. What should I test ?
Simone
@chemelli74 Try to reproduce the error with this new version.
@chemelli74 Try to reproduce the error with this new version.
ahahahah, first code learned and:
2020-05-21 00:34:47 ERROR (MainThread) [homeassistant.components.broadlink] Failed to learn: The device storage is full
Simone
Let's try with another header that I found here, just a sec.
I just updated the file. You need to get rid of the error before trying again (don't ask me how).
If you open a terminal and try device.check_data(), does the problem persist?
If you open a terminal and try device.check_data(), does the problem persist?
bash-5.0# python
Python 3.7.7 (default, Apr 28 2020, 13:57:57)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> devices = broadlink.discover(timeout=5)
>>> devices[0].check_data()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 600, in check_data
check_error(response[0x22:0x24])
File "/usr/local/lib/python3.7/site-packages/broadlink/exceptions.py", line 97, in check_error
raise exception(error_code)
broadlink.exceptions.AuthorizationError: Control key is expired
>>>
Simone
You need to authenticate first: devices[0].auth()
You need to authenticate first:
devices[0].auth()
Sorry, a bit tired ;-)
>>> devices[0].auth()
True
>>> devices[0].check_data()
b'&\x00\xe6\x00i:\x0e+\x0e+\r\x0f\x0f\x0f\x0e\x0f\x0e+\x0e\x0f\x0e\x10\r+\x0e+\x0e\x0f\x0e+\x0e\x0f\x0e\x10\r+\x0e+\r\x10\x0e+\x0e+\x0e\x0f\x0e\x10\x0c,\x0e\x10\r\x10\x0e+\x0e\x0f\x0e\x0f\r\x10\x0e\x10\r\x10\x0e\x0f\x0e\x0f\x0e\x10\r\x10\x0f\x0e\x0e\x10\r\x10\x0e\x0f\r\x10\r\x11\x0c\x11\r\x10\r,\x0e\x0f\r\x10\x0e+\r\x10\r\x11\r\x10\x0e\x0f\x0e\x0f\x0e+\x0e\x0f\x0e\x10\r\x10\x0e\x0f\r,\r,\x0e*\r\x11\r\x10\x0e\x0f\x0e\x10\x0e*\x0e\x10\r+\x0e\x10\r+\x0e+\x0e+\x0e\x0f\r\x10\x0e\x10\x0e\x0f\r\x10\r\x11\r\x10\x0e\x0f\x0e\x0f\r\x11\x0e\x0f\x0e\x0f\x0e\x0f\x0e\x10\r\x10\x0e\x0f\r\x10\r\x11\x0e\x0f\x0e\x0f\r\x10\x0e\x10\x0e\x0f\r\x10\x0e\x10\x0c\x11\r\x10\x0e\x0f\x0e\x10\r\x10\x0e\x0f\r\x10\r\x11\r\x10\r\x10\x0e+\x0e\x0f\x0e\x10\r\x10\r\x10\x0e\x0f\r\x11\r\x00\r\x05\x00\x00'
>>>
Simone
The error persists. The truth is that we always had this error, but it was going unnoticed. If we can’t solve it, I think it’s okay to ignore it.
The error persists. The truth is that we always had this error, but it was going unnoticed. If we can’t solve it, I think it’s okay to ignore it.
If you mean that it was always logged, I'm sure it was not the case. But maybe it was the time that my device was not authenticated.
Simone
I recently changed the library to raise firmware errors. This error can only be identified after the update. I will keep trying to handle it correctly, I would not like to ignore this exception. But if we do not succeed, I do not discard this option.
I made a script to learn 10,000 codes combining my remotes (one receives and the other sends) and I still didn't get any storage error. So I think this problem is only related to RM4 series.
I just realized that the problem has nothing to do with those special headers because 0x2737 has the same problem and does not use them.
@chemelli74 I solved the problem. Here is the solution, in case you need it before the release.
@chemelli74 I solved the problem. Here is the solution, in case you need it before the release.
@felipediel, finally tested:
2020-05-28 19:26:26 ERROR (MainThread) [homeassistant.components.remote] Error while setting up broadlink platform for remote
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/src/homeassistant/homeassistant/components/broadlink/remote.py", line 133, in async_setup_platform
devices = await hass.async_add_executor_job(discover)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/broadlink/__init__.py", line 79, in discover
local_ip_address = socket.gethostbyname(socket.gethostname())
socket.gaierror: [Errno -2] Name does not resolve
Issue is related to /etc/host missing entry:
bash-5.0# cat /etc/hosts
# Any manual change will be lost if the host name is changed or system upgrades.
127.0.0.1 localhost
::1 localhost
127.0.0.1 HomeNAS
::1 HomeNAS
if I add "127.0.0.1 <container name>" then it start working again.
so "homeassistant" for my production and "homeassistant-test" for my test environment.
But now I get this issue:
2020-05-28 19:38:14 ERROR (MainThread) [homeassistant.components.broadlink.remote] The correct class and type for 192.168.xxx.yy are <class 'broadlink.rm'> and 0x2737. The selected class is <class 'broadlink.rm'>
Simone
@chemelli74 Sorry, the instructions are out of date. The solution is already part of the Home Assistant (0.110.2). I just changed the instructions in case you need to revert.
Tested with fresh 0.110.3 docker container and get the same error message:
2020-05-29 00:46:43 ERROR (MainThread) [homeassistant.components.broadlink.remote] The correct class and type for 192.168.xxx.yy are <class 'broadlink.rm'> and 0x2737. The selected class is <class 'broadlink.rm'>
Simone
This is the remote.py
you took earlier. The clean installation does not have these error messages.
Hi guys. Please do not update before this PR is merged. 0x5f36 is unstable at 0.115.
Hi guys. Please do not update before this PR is merged. 0x5f36 is unstable at 0.115.
Hi Felipe,
thank you. I was on the 115 beta but the integration gave me "storage error" so I turned back di 0.114. Now I know why.
Most helpful comment
Tonight I will do a pull request.
Thanks to everyone who contributed to the solution!