-
Notifications
You must be signed in to change notification settings - Fork 58
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
AEH-W4A1 #1
Comments
Hi, |
I pried into the Hi-Smart Life app, and it seems entirely different. It is not based on aylanetworks code, but has something by xinlianfeng. |
https://github.com/cgdgithub/ControlJavaEdition Searching for xinlianfeng I found this repository, it seems that this is the same way they communicate with Hi-Smart Life app, it also states that the module port is 8888 which is correct, and also seems that this port is used to receive authenticated mqtt commands. EDIT: The same package com.xinlianfeng.livehome is mentioned inside Hi-Smart Life app, so yeah this is the source code for controling the AC. |
Cool! |
Hi guys, I used Packet Capture, an android app to MITM sniff packets. For example, if you raw send AT+XMV to port 8888 of ac you obtain a response like +XMV:4.4.6 (it can be useful to identify the AEH-W4A1 module and also to search in the LAN of all the conditioners) And if you send I searched a lot online information about the protol used, but I found only an old pamplet about a similar serial protol developed together by Hisense and Hitachi. Probably an archaic version of the current one, but of no use. Unfortunately I do not have the skills to develop an add-on for Home Assistant, but if someone wanted to do it I could put myself to decode all the bytes of the protocol and reconstruct its functioning. I have already done some work ;) |
Hi! (or just a mqtt translator) |
@bannhead Unfortunately with +XMV:4.4.7, I only get a response directly from the AC if i send AT+XMV. The protocol seems to be a somehow encoded JSON string, you can learn more here: https://github.com/cgdgithub/ControlJavaEdition/blob/master/src/com/xinlianfeng/android/livehome/devices/base/DevicesLogic.java#L461 Anyway, you can do guessing with many replies, for example, in the status response F4F50140490100FE01010101006600010000201A211D80808001A10000000000000000000000050000000000215E2300000000000000000000000000080000000000000000000000000000000000053DF4FB in the series of bytes 201A21 the byte 20 means that the AC is Off, while 28 means that the AC is On; while the byte 21 represents the current temperature (in my testing, 1C was 28°C, 1B 27°C, 1A 26°C, 19 25°C and 17 23°C) |
Unfortunately the actual parsing logic here is hidden in the JNI-wrapped libhisense.so file, in functions like Java_com_xinlianfeng_android_livehome_hisense_ProtocolNative_parsePara and Java_com_xinlianfeng_android_livehome_hisense_ProtocolNative_buildPara. |
It's a serial protocol, JSON is used only in app for code semplicity; communication to and from AC are raw bits sent in tcp over port 8888. Standard response packet And here the data part converted in binary and divided using the table obtained from java analysis:
P.S. I use netcat on Windows to resquest AC state, sending this hex string |
You must send not plain text, but a real bit string. You can create it using a hex editor like HxD and pass it to nc using < and > to redirect output to a file |
Oh, it works. I don't get why sending plain HEX to the Hisense server works but not directly to the AC :P Well this is a nice finding, LAN is Open \😃/ |
It's surprising that in this protocol they use Celsius, in the AEH-W4B1 protocol they rely on Fahrenheit. |
I have almost finished analysis of responses for packet type 102. This is the most important type because it reports the full state of the AC. Other packet types (3, 3 sub 1, 7 sub 1, 10 sub 4, 30, 101, 101 sub 32 and 202) are related to other things like setting modes (101), wifi (30) and so on. These are the links to download the case study and related tables to interpret fields and values. |
It is possible to switch easily to °F and the other way around: all the logic start to use and report temperature consequently. This is the source of my knowledge of the protocol. The DeviceProtocol and OffsetAttribute declarations explain the parameters for the creation and interpretation of the data field of the packets, with a few small variations that I indicated in my analysis, perhaps due to a revision of the protocol. But the best thing is that most command packets can be written statically, except for those where a timer is set and little else! If you tell me what else you may need I am at your disposal! I can create a list of commands to be sent to set the various parameters and obviously I am available for any clarification on the interpretation of the reply packets with the conditioner status. |
In AEH-W4B1 everything is Fahrenheit, there is a parameter for changing the mode to Celsius, but it only affects the display on the AC. Here is what I need:
|
I have done my dirty job!
The read-only flag is only for JSON, because for AEH-W4A1 you obtain a response packet, as follow
Response packet analysys UPDATED and UPDATED SOURCE to latest protocol specification! Every packet contains all the values
Only the packets to set the on and off timers, which need to be created dynamically, are missing. If it can be useful to implement it, I already have the instructions to create the packets ;)
No, the Android app requires status every time it sends a command and when it is inactive about every 40 seconds. I hope everything is clear and that you can add support to this device too |
For completeness, I point out that the protocol extrapolated here was the basis of everything, but that it is a non-exact correspondence with the current one. After all this work, I found also this page with updated protocol data! |
Thanks, I'll start merging it into the script. |
Hi-Smart Life app updated today to version 5.2.9 with changelog "Updated the application protocol". |
There are significant code changes, it's hard to exactly as the code when through some sort of obfuscation processing. |
Ok, in my spare time I managed to do a working HA integration for the AEH-W4A1 module; post on HA forum here I ask those who have a different module like AEH-W4B1 and AEH-W4E1 if they can test the library on the local network to find out if they are compatible. Those who own an AEH-W4A1 can copy the integration into custom components to try it while waiting for the pull request |
@bannhead, Nice! The protocol for AEH-W4B1 is entirely different, no chance for it to work. |
yeah,it seem that app or module version differs,the protocol differs,so it's a hard way.I have tried the serial comm to control it,using esp8266 and ttl-to-rs485 module,and it's a little difficult to analysis the code,any help would be grateful! |
this is the code i have captured and i analysisd some of them: AA 2A AC 00 00 00 10 00 00 02 01 04 00 48 35 00 00 00 04 04 00 00 04 01 04 01 0E 00 00 00 00 80 00 00 00 00 00 00 00 00 00 DE 18 //set_temp 26 cool |
@happylichuanxi could you grab various packets (switching modes, hor and vert swing on and off, set temp from min to max step by step, and everything else you can change and grab via serial bus) and send them to me? Can you indicate wifi module and ac brand&model? |
sure,but it takes time, I will grab as soon as I can. |
@happylichuanxi were you able to get the ESP8266 to control the AC directly without using the hisense module? |
I am trying to connect directly to AC over RS485. esp32+uartRS485, I have Hisense AC with AEH-W4E1. = Works.
|
I will try to use RS485+esp8266(esp-link) can you give me baudrate of rs485 ? |
baudrate=9600 |
I will use this adapter, only understand better , i send 30bytes @9600 baud with commands and i receive 30bytes ? Or i receive only one byte with status? For now I only want read status. |
all byte. |
@miky2k Hello, yes, you called? |
I'm testing hardware with simple c code:
My goal is to write a simple esp8266 firmware that abstract AC protocol and present command as rest API or JSON state, |
@miky2k @straga |
Link is working i try to fix , copy and paste if not work with click. |
Hi, some solution for hisense ac in hass? |
I use the AEH-W4A1 module. Control and status is functional but unstable. Often the module disconnects from wifi regularly every 2 minutes. Regularly every 5 minutes I am unavailable in HA. I have already replaced the module with the new problem is the same. I assume that the problem is with the program in the module |
I use https://github.com/pslawinski/esphome_airconintl and make some changes and it works with 1 model of my hisense AC, using ESP-8266 NodeMCU directly connecting to the AC can control it via esphome but still can't getting any current status from the AC. But same ESP-8266 not working for another model hisense AC, I guess another model using different uart protocol. |
@zoffypal HI |
I was found this repository before. However, it's looks not esphome or adruino project, I didn't know how to use it neither to compile it and flash to esp8266 and connect to Home Assistant. |
@zoffypal |
Hi,
I've found your repository the first day of creation. I've tried the script with AEH-W4A1 but this module does not seem to have an open LAN port.
It has 8888 TCP open but it just replays everything you send to it.
With Wireshark I found it communicates to the servers with port 1024 TCP, but it is closed/filtered on LAN.
It communicates with a couple of servers, but the main one is:
hi-smartlife.topfuturesz.com (TCP Port 7820, App Hi-Smart Life)
I've been able to replay some TCP packets to turn on/off, change the fan speed, get and set the temperature, turn off the dimmer and other things.
I will try the new script, but upon sniffing traffic, I couldn't find any lan_key in the communication between the servers, so I think this module is out of luck with LAN control.
This module does not work with Hi-Smart AC.
The text was updated successfully, but these errors were encountered: