Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Authentication failed to AC #76

Closed
bonepl opened this issue Jun 26, 2021 · 33 comments
Closed

Authentication failed to AC #76

bonepl opened this issue Jun 26, 2021 · 33 comments

Comments

@bonepl
Copy link

bonepl commented Jun 26, 2021

I have 2 AUX Air Conditioners (Aux Halo and Aux Halo DeLuxe), both working flawlessly through AC Freedom app, but when I try to use your app I also end up with “Authentication failed to AC” error. Any tips for troubleshooting?

@tgrosz
Copy link

tgrosz commented Jun 26, 2021

I'm also stuck with rcool (aux product) unit. Probably the first step is to make it work with ac freedom but with no internet connection.

@mriosriquelme
Copy link

I'm not sure if it helps, but I realize that on the first connection, the response from AC is less than 38 bytes, so that's why the error "Authentication failed to AC" raised up.

@liaan
Copy link
Owner

liaan commented Jun 29, 2021

I'm not sure if it helps, but I realize that on the first connection, the response from AC is less than 38 bytes, so that's why the error "Authentication failed to AC" raised up.

Hi

I checked the code and there no check on auth packet for length (well, not that I could find/recall).
If you actually getting a response, that is something new. Most of the people having this issue that did network sniffs had no response on the network.

Maybe Aux change the protocol , or actually fixed the Auth part of there own products.

If you getting a response, is it possible you can do a network sniff (wireshark format) with the internet disabled so I can debug it?

@mriosriquelme
Copy link

I just put "print" for debugging inputs and outputs and added some tweaks at local code to get this :
Package send: 5aa5aa555aa5aa55000000000000000000000000000000000000000000000000d4f000002a4e6500efa0a043b0aae66c00000000a1c30000453452e7f92eda958344930835ef9a6dfb692dc370b90443ac5cd63fbb53adfa08814ca7f8cf417100328e570c3b86c94d05708449a389e29ae1045436a05bdddc02c161af1325e87e19b0f7d1ce068d

bytearray(b'\x00\x00\x00\x00111111111111111\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00Test 1\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')

Response:
5aa5aa555aa5aa5500000000000000000000000000000000000000000000000098ccffff2a4ee903efa0a043b0aae66c00000000afbe0000

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\x02\xcc\xff\xff*N\xe9\x03\x1a\xdf\xa0C\xb0\xaa\xe6l\x00\x00\x00\x00\xaf\xbe\x00\x00')

aes.decrypt on ac_db.py is not feasibly because "Input strings must be a multiple of 16 in length"

@mriosriquelme
Copy link

Just try to use AC Freedom app without internet and didn't work

@bonepl
Copy link
Author

bonepl commented Jul 7, 2021

Looks like AC Freedom communicates with units through cloud (AWS). So without the internet I think remote control is the only way :/

@liaan
Copy link
Owner

liaan commented Jul 7, 2021

Looks like AC Freedom communicates with units through cloud (AWS). So without the internet I think remote control is the only way :/

half correct, If it can talk local, it does that first. then goes cloud.

This library was written using debugging/sniffing traffic from Ac Freedom app using local only traffic (internet off).

It just seems like the Aux units are a issue. wonder if one can ask Aux how to control the device if internet is down ...

@bonepl
Copy link
Author

bonepl commented Jul 7, 2021

I tried sniffing AC Freedom communication with my Aux but couldn't find any local calls. If someone can point me to Aux email for technical issues I can try to ask them about offline/LAN communication. I'm not even sure if these new Aux use MQTT at all - couldn't find anything on MQTT explorer while investigating.

@liaan
Copy link
Owner

liaan commented Jul 7, 2021

I tried sniffing AC Freedom communication with my Aux but couldn't find any local calls. If someone can point me to Aux email for technical issues I can try to ask them about offline/LAN communication. I'm not even sure if these new Aux use MQTT at all - couldn't find anything on MQTT explorer while investigating.

no, none of the units do mqtt.

this script imitates the AC freedom app and then read/write to mqtt.

The communication is UDP broadcast port 80 (i think) . so if you sniff, you have to tell your switch to send ALL traffic from the Aux wifi fclient to your sniffer port.

The other option is to run wireshark on your android device itself and then remove your device from AC freedom and try re-add it without internet connection. this should force discovery traffic local, and hopefully force rest off comms also local.

@tgrosz
Copy link

tgrosz commented Jul 7, 2021

https://www.rcool.hu/elerhetoseg
in Hungarian. RCool is AUX - I can ask them if you write exactly what you need. Or I can be dumb and ask simply how to control the unit if there's no internet

@liaan
Copy link
Owner

liaan commented Jul 7, 2021

https://www.rcool.hu/elerhetoseg
in Hungarian. RCool is AUX - I can ask them if you write exactly what you need. Or I can be dumb and ask simply how to control the unit if there's no internet

always play dumb ..... ;-) would be great if you ccould ask

@bonepl
Copy link
Author

bonepl commented Jul 7, 2021 via email

@liaan
Copy link
Owner

liaan commented Jul 7, 2021

I confirm that AC Freedom keeps sending tons of messages on UDP. I haven't captured or decrypted those hexes yet though.

There is actually a http component as well. if you do dump to/from AC only, you will see it talks direct to cloud as well.

if the AC freedom can speak direct, it will speak direct first, then the cloud is update from the AC itself , this is so that your Ac freedom app can speak to cloud external and get the latest info even if you use the normal IR remote.

I never dug into that part, was never the intention to speak to cloud as then you start messing with other peoples things and can get into trouble.

Maybe Aux have a "legal" api one can talk into cloud with, that will be very easy then to integrate into HA. Probably should ask them one day

@mriosriquelme
Copy link

I enable now internet and I see packages on UDP, here some examples (I just have 3 AC, tested on 2)

5aa5aa555aa5aa55fcffffffe50715030b030707000000003300a8c06fea0000beca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50714030b030707000000003300a8c06fea0000bdca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50728020b030707000000003300a8c071c60000aeca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072a020b030707000000003300a8c071c60000b0ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072b020b030707000000003300a8c071c60000b1ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072b020b030707000000003300a8c076e90000d9ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072c020b030707000000003300a8c076e90000daca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072d020b030707000000003300a8c076e90000dbca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072e020b030707000000003300a8c06bd70000bfca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5072f020b030707000000003300a8c06bd70000c0ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50730020b030707000000003300a8c06bd70000c1ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50732020b030707000000003300a8c06efc0000ebca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50733020b030707000000003300a8c06efc0000ecca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50734020b030707000000003300a8c06efc0000edca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50734020b030707000000003300a8c0d4ca000021cb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50735020b030707000000003300a8c0d4ca000022cb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50736020b030707000000003300a8c0d4ca000023cb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50737020b030707000000003300a8c0f9ed00006ccb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50738020b030707000000003300a8c0f9ed00006dcb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50739020b030707000000003300a8c0f9ed00006ecb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5073a020b030707000000003300a8c0b8fe00003fcb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5073b020b030707000000003300a8c0b8fe000040cb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50700030b030707000000003300a8c0b8fe000006cb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50702030b030707000000003300a8c066d8000090ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50703030b030707000000003300a8c066d8000091ca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50704030b030707000000003300a8c0b5c40000cdca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50705030b030707000000003300a8c0b5c40000ceca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50706030b030707000000003300a8c0b5c40000cfca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50707030b030707000000003300a8c0f5d000001ccb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50708030b030707000000003300a8c0f5d000001dcb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe50709030b030707000000003300a8c0f5d000001ecb0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5070a030b030707000000003300a8c078cd00009fca0000000006000000000000000000
5aa5aa555aa5aa55fcffffffe5070b030b030707000000003300a8c078cd0000a0ca0000000006000000000000000000

I try the last command with packet sender and all three AC response to broadcast, but nothing happens now. Response from all AC was:

5A A5 AA 55 5A A5 AA 55 FC FF FF FF E5 07 0B 03 0B 03 07 07 00 00 00 00 33 00 A8 C0 78 CD 00 00 F3 DA 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 4E 2C 00 A8 C0 6C E6 AA B0 43 A0 E5 A5 A5 E5 85 8B E6 96 AF E7 A9 BA E8 B0 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01

5A A5 AA 55 5A A5 AA 55 FC FF FF FF E5 07 0B 03 0B 03 07 07 00 00 00 00 33 00 A8 C0 78 CD 00 00 77 DA 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 4E 2B 00 A8 C0 87 B5 45 B0 43 A0 E5 A5 A5 E5 85 8B E6 96 AF E7 A9 BA E8 B0 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01

5A A5 AA 55 5A A5 AA 55 FC FF FF FF E5 07 0B 03 0B 03 07 07 00 00 00 00 33 00 A8 C0 78 CD 00 00 D3 D9 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 4E 2A 00 A8 C0 78 5E 08 B0 43 A0 E5 A5 A5 E5 85 8B E6 96 AF E7 A9 BA E8 B0 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01

Also receive response from my RMPro RF .... XD

@liaan
Copy link
Owner

liaan commented Jul 8, 2021

Hi.

You will need to to send the Auth packet first before AC will allow you to send the 2nd command packet.

But the fact that you getting comms, means they do speak local .. maybe , it might just be that the Auth part is different

If you have some programming (editing) skills, you can hard code the return hex into this script and it can decode it bit better.

the RMPRo uses the same base method of communication, (broadlink) , just have different identifier and of course different command set.

I will try and decode the packets when I have a gap .. you can hardcode one by one into the script as well if you have any editing skills and love to tinker/are in a hurry. the file is clsases/ac_db.py line 566. and use the -d (full debug) when running monitor.py and will spit out the decoded packet into the logs.

@mriosriquelme
Copy link

mriosriquelme commented Jul 19, 2021

OK, I used Python control for Broadlink devices and then I realize that the AC are locked by the AC Freedom app by default. I just delete AC from the app, factory reset to AC, added again to the APP for send my Wifi information, but closed the app and I didn't allow to connect to the cloud. With that, the AC is free and unlocked. Then, I used library with hysen class and auth was ok (cool, one step closer), but when I retrieve any information of temperature or status I receive error, but I was able to get a key, I did this simple code to test. I hope this information helps you to get the issue.

import broadlink as blk
import binascii

d = blk.hello("192.168.0.254")
print(d)

acreal = blk.hysen(host=("192.168.0.254",80),mac="a043b0XXXXXX",devtype=20010)
print(acreal)
logged = acreal.auth()
print(acreal)
print(logged)
firmware =acreal.get_fwversion()
print(firmware)
print(binascii.hexlify(acreal.aes.algorithm.key))
print(binascii.hexlify(acreal.aes.mode.initialization_vector))

output:
奥克斯空调 (0x4e2a / 192.168.0.254:80 / A0:43:B0:XX:XX:XX)
Unknown (0x4e2a / 192.168.0.254:80 / A0:43:B0:XX:XX:XX)
Unknown (0x4e2a / 192.168.0.254:80 / A0:43:B0:XX:XX:XX)
True
42037
b'92a7a7793a30b4124afc6853d36d021c'
b'562e17996d093d28ddb3ba695a2e6f58'

@liaan
Copy link
Owner

liaan commented Jul 19, 2021

Hi,

Brilliant ..

Sorry, i'm absolutley swamped with work at moment so not had any luck looking into this again..

@rgolab
Copy link

rgolab commented Jul 21, 2021

OK, I used Python control for Broadlink devices and then I realize that the AC are locked by the AC Freedom app by default. I just delete AC from the app, factory reset to AC, added again to the APP for send my Wifi information, but closed the app and I didn't allow to connect to the cloud. With that, the AC is free and unlocked. Then, I used library with hysen class and auth was ok (cool, one step closer), but when I retrieve any information of temperature or status I receive error, but I was able to get a key, I did this simple code to test. I hope this information helps you to get the issue.

Hi, your procedure was very helpful. After unlock I just run monitor again and for me it just work as expected (without problem with Authentication). Please just be sure if you have all devices unlocked. In my case I had two devices - after unlock first the monitor still shown the Authentication failed message. After comment the second device configuration everything start working and I'm able to manage device from HA.

@bonepl
Copy link
Author

bonepl commented Jul 21, 2021 via email

@liaan
Copy link
Owner

liaan commented Jul 22, 2021

OK, I used Python control for Broadlink devices and then I realize that the AC are locked by the AC Freedom app by default. I just delete AC from the app, factory reset to AC, added again to the APP for send my Wifi information, but closed the app and I didn't allow to connect to the cloud. With that, the AC is free and unlocked. Then, I used library with hysen class and auth was ok (cool, one step closer), but when I retrieve any information of temperature or status I receive error, but I was able to get a key, I did this simple code to test. I hope this information helps you to get the issue.

Hi, your procedure was very helpful. After unlock I just run monitor again and for me it just work as expected (without problem with Authentication). Please just be sure if you have all devices unlocked. In my case I had two devices - after unlock first the monitor still shown the Authentication failed message. After comment the second device configuration everything start working and I'm able to manage device from HA.

From my experience these devices are VERY slow. so if you have 2 devices try to talk to them faster then 1-2 seconds apart, they simply never reply.
Could be that was just to much traffic

So can you just confirm by unlocking the devices . they work on this script without issue?

@rgolab
Copy link

rgolab commented Jul 22, 2021

From my experience these devices are VERY slow. so if you have 2 devices try to talk to them faster then 1-2 seconds apart, they simply never reply.
Could be that was just to much traffic

So can you just confirm by unlocking the devices . they work on this script without issue?

I can confirm my AC work with the monitor.py after unlocking without issues. But you have to be fast enough. I mean your monitor.py script has to be run before the AC Freedom app is connected to the cloud. So directly after message Your device is connected to the WiFi on your AC Freedom app you have to close the app and in the same time run the monitor.py script. Otherwise you'll see again message about Authentication failed.

Can someone write down steps needed to be able to integrate AUX conditioner
from HA (having standard raspberry pi with hassos)? I'm a big python noob,
but I can see guys that you have succeeded :(

Please contact me - I'll try to help you.

@tgrosz
Copy link

tgrosz commented Jul 22, 2021

Please contact me - I'll try to help you.

Please share the process, I'm also interested, thank you.

@rgolab
Copy link

rgolab commented Jul 22, 2021

Process which work for me:

  1. remove device from AC Freedom
  2. reset wifi on the Aux device (COOL + + for few seconds)
  3. open AC Freedom app and add device
  4. when I see info on the AC Freedom app "Your AC is connected to the WiFi" I close the AC Freedom app and run the monitor.py script few times - sometimes it works after first try, sometimes I have to try more

It works for me only from the MacOS host. I tried to close monitor.py inside the docker container but even if I use network_mode: host it doesn't work - I have an error related to the Authentication Failed to AC. I'm trying to understand what is happening during this process. Maybe the useful information will be the fact when I run the monitor.py the function gendevice from the ac_db.py package is running few times (devtype I added to the function for debugging):

▶ python3 monitor.py -d -c settings/config.yml
Starting Monitor...
devtype: 653a
devtype: 4e2a
devtype: 61a2

so @liaan maybe do you have idea why it randomly work and why I'm not able to run it from docker container?

@luziczek
Copy link

I did it this way for my AUX J-SMART device:

  1. Removed AC unit from AC Freedom app.
  2. Reset wifi on device as stated in the previous comment.
  3. Added device in the AC Freedom app.
  4. When device was ready to be named (it's the screen after the progress screen) I've hard closed the app. I've checked that ping to the device is okay and executed monitor.py - it worked flawlessly first time.

iOS+macOS, monitor.py straight out of repo (without Docker). Didn't change a thing in the code.

@rgolab
Copy link

rgolab commented Jul 22, 2021

Finally I found the problem in my case.

I had the self_discovery option set to True in my config file. Because I have other device which was locked I had Authentication Failed to AC in the loop. After disabling self_discovery everything works fine (in the docker container as well).

The problem is related to the fact that discover function by default is trying to "get device as an object" - even if the device is not the AC - in my case eg. BroadLink-RM4-Pro.

@liaan
Copy link
Owner

liaan commented Jul 22, 2021

Finally I found the problem in my case.

I had the self_discovery option set to True in my config file. Because I have other device which was locked I had Authentication Failed to AC in the loop. After disabling self_discovery everything works fine (in the docker container as well).

The problem is related to the fact that discover function by default is trying to "get device as an object" - even if the device is not the AC - in my case eg. BroadLink-RM4-Pro.

If you do a ./monitor.py -S , do you get any output?

@liaan
Copy link
Owner

liaan commented Jul 22, 2021

oooooooooo .... now get it .. you have other broadlink devices, and yes, script is to stupid to drop non AC "objects" on auto discovery.. it will try control via the main loop each object, and of course that going to fail on the broadlink as its not right type_id

well, something like that

probley should drop the objec to the device array if not right type_id

@mriosriquelme
Copy link

I also confirm that worked once I restart all AC devices... thanks to all!

@LordDethman
Copy link

This did work for me as well. Now, has anyone been able to get it to work like this and still be able to use the AC Freedom App? Also it seems to have issues with Home Assistant Cloud and Alexa. It is there can I can control it with my phone app. But the Voice commands dont work.

The only other issue is that the values being displayed are clearly in °C but read °F on the HA GUI. It is rather strange.

@kovalevvv
Copy link

i have same problem. Discover working only if break ac freedom pairing procedure in set name step. Then i have success discovered device (BSUI/IN-12HN8)

➜ broadlink_ac_mqtt git:(master) ./monitor.py -S
*********** start copy below ************
devices:

  • ip: 10.4.4.117
    mac: a043b08dba4c
    name: ''
    port: 80

*********** stop copy above ************

but service not working ;(

➜ broadlink_ac_mqtt git:(master) ./monitor.py
Starting Monitor...
object of type 'int' has no len()
Stopping

My config
param 'self_discovery' nothing change

➜ broadlink_ac_mqtt git:(master) cat settings/config.yml
service:
daemon_mode: True
update_interval: 10
self_discovery: True
bind_to_ip: False

mqtt:
host: 10.4.4.54
port: 1883
client_id: ac_to_mqtt
user: homeassistant
passwd: 123
topic_prefix: /aircon
auto_discovery_topic: homeassistant
auto_discovery_topic_retain: False
discovery: False

##Devices
devices:

  • ip: 10.4.4.117
    mac: a043b08dba4c
    name: ''
    port: 80

@kovalevvv
Copy link

i found solution, password must be a string ;) (add quotes in yml file)

@Mehmet89
Copy link

@kovalevvv

How do you mean?

Can you explain how?

@jasiulaka
Copy link

AUX J-Smart after user @luziczek procedure (resetnig wifi) working well .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants