Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadlink RM Mini 3: Failed to connect to device #25943

Open
webworxshop opened this issue Aug 14, 2019 · 1 comment

Comments

@webworxshop
Copy link
Contributor

commented Aug 14, 2019

Home Assistant release with the issue:
0.97.2

Last working Home Assistant release (if known):
Potentially whatever release contained python-broadlink 0.10 (but perhaps not, see below)

Operating environment (Hass.io/Docker/Windows/etc.):
Docker

Component/platform:
Broadlink

Description of problem:
When calling the broadlink.learn service, the service does not appear to be called. The message "Failed to connect to device" is posted in the logs. The Broadlink device LED does not go white (for learning mode).

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

switch:
  - platform: broadlink
    host: '<my rm ip>'
    mac: '<my rm mac>'
    type: rm_mini

I've double checked both the IP and MAC and they are working elsewhere (see below).

Traceback (if applicable):
None, just the error message above.

Additional information:
From looking at the code, the message appears when the device fails the auth method. I tried the command line tool from the python-broadlink library and it failed in a similar way with the latest version (see mjg59/python-broadlink#274). I fixed the issue in the library by going back to initialising the AES objects on every call as per the last working version (see mjg59/python-broadlink#276).

The problem is that the issue persists in HASS even if I use my fixed version of the library. I installed my version inside my Docker container with:

pip install -U git+https://github.com/webworxshop/python-broadlink.git@fix-pyaes

...and then restarted HASS. Trying the broadlink.learn service results in the same message. A visual inspection of the broadlink module inside the container confirms it is the right code. I even added a print statement to it to make sure!

A tcpdump yields the following initial packet sent by HASS (MAC address redacted):

0x0000:  4500 00b4 0d24 4000 4011 1408 0a00 0282  E....$@.@.......
0x0010:  0a00 028c daa7 0050 00a0 19bf 5aa5 aa55  .......P....Z..U
0x0020:  5aa5 aa55 0000 0000 0000 0000 0000 0000  Z..U............
0x0030:  0000 0000 0000 0000 0000 0000 92f4 0000  ................
0x0040:  2a27 6500 2820 xxxx xxxx xxxx 0100 0000  *'e.(.p}.B......
0x0050:  a1c3 0000 3764 6e3c bfbc 2a28 89fa d367  ....7dn<..*(...g
0x0060:  4314 02b3 9cb0 0bbc 5c6d 2b62 1a35 0a8e  C.......\m+b.5..
0x0070:  bad7 999a 641c 85e6 7612 e0e7 c23e a66f  ....d...v....>.o
0x0080:  2615 1c64 d7c4 ad27 3486 8125 617e 2c34  &..d...'4..%a~,4
0x0090:  fba6 a728 76a3 3669 46cf 871c e413 e51c  ...(v.6iF.......
0x00a0:  1d6c 1596 d8a8 f96e 622b 9fa8 159f ba02  .l.....nb+......
0x00b0:  f8ce 9778

The broadlink_cli tool with the working library version yields this initial packet:

0x0000:  4500 00b4 2976 4000 4011 f7b5 0a00 0282  E...)v@.@.......
0x0010:  0a00 028c b3db 0050 00a0 19bf 5aa5 aa55  .......P....Z..U
0x0020:  5aa5 aa55 0000 0000 0000 0000 0000 0000  Z..U............
0x0030:  0000 0000 0000 0000 0000 0000 f9f7 0000  ................
0x0040:  2a27 6500 5df2 xxxx xxxx xxxx 0000 0000  *'e.].p}.B......
0x0050:  a1c3 0000 4534 52e7 f92e da95 8344 9308  ....E4R......D..
0x0060:  35ef 9a6d fb69 2dc3 70b9 0443 ac5c d63f  5..m.i-.p..C.\.?
0x0070:  bb53 adfa 0881 4ca7 f8cf 4171 0032 8e57  .S....L...Aq.2.W
0x0080:  0c3b 86c9 4d05 7084 49a3 89e2 9ae1 0454  .;..M.p.I......T
0x0090:  36a0 5bdd dc02 c161 af13 25e8 7e19 b0f7  6.[....a..%.~...
0x00a0:  d1ce 068d e51b 6191 5687 6d33 8cff 3b99  ......a.V.m3..;.
0x00b0:  1e40 cdb1

As you can see the encrypted payload part of the packet is completely different! For some reason HASS is still sending a mangled packet. I'm completely stumped as to why, since it is using the fixed library version.

Hopefully someone else has more idea than me! Please let me know if I can provide any more information.

@probot-home-assistant

This comment has been minimized.

Copy link

commented Aug 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.