Hisense AEH-W4A1 Integration Question

Hi,
there is someone that use this new integration with success?
I have 2 Hisense Mini Apple Pie Air Conditioners with both AEH-W4A1 WiFi modules installed.I configured the modules with Hi-Smart Life App and they works.
I’m not able to integrate them into Home Assistant correctly.
First of all:

  • the 2 devices aren’t automatically discovered.
    I try:

hisense_aehw4a1:

in configuration.yaml without success.I have set up AEH-W4A1 Integration in settings menu but hassio tell me there are no devices with this integration.
However if i statically configure the devices:

hisense_aehw4a1:
ip_address:

  • 192.168.x.xx
  • 192.168.x.xx
    (i found wifi modules IP adress in my router menu)

hassio show me only one of the two modules.
HA shows a climate entity (climate. 192.168.x.xx).I tried to integrate it with a thermostat card.It give me all the options and right temp,but it fail to turn on the conditioner or any other comman.

Where am I doing wrong? I don’t use Hi-Smart life app anymore to avoid conflicts,but i have the devices configured in the app…
Or maybe i have to make static the IP adresses?

I’m a bit confused…
Thank you
Gabriele

I wrote the integration and maybe I can help you.

  1. If you define ip addresses in config you must set them as static in your router;
  2. automatic discovery will find them only if they are reachable on netmask 255.255.255.0 from your home assistant.

It is always better, also in case nr.2, to reserve static IP addresses for them, because failure on discovery could be related to a bad wireless connectivity between ACs and AP.
Also, a bad wireless connection (more than 1 second between command sent and response) will result in a failure command.

Thank you Davide for your tips,very appreciate.
Tomorrow i’ll make some test.
Obviouvsly thanks for your work about this integration.
Gabriele

Hi,i report my tests about my issues.
I made some progress.
I completely remove Hi-Smart Life App from my phone,removoving the paired connection.I think it’s important to not only don’t use the app,but also to completely remove the wired connection with the modules.
Now,i don’t wrote any configuration,i only activate the AEH-W4A1 integration.This one doesn’t report any device,but i found 2 new entity in hassio (climate.192_168_1_76 and climate.192_168_1_200).
I assigned them static IP and configure with thermostat card.
An entity works very well,like in the app i can send command to the AC.
But the other entity doesn’t work well and i receive a “failing to call service climate_hvac_mode” error.
I don’t thnik it’s a bad wireless connection,it’s the module closest to the router of the two and if it was a bad wifi connection,it wouldn’t work well with the app too,instead with the app it works perfectly like the other.
I receive this log in hassio when i try to communicate with the module:

`2019-12-19 19:14:09 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1845913488] Wrong response for type 101_0: f4f50140490100fe010101010065000100003012120f808000010102000000000000000000000500000000000b30160000000000000000032000000008000000000000000000000000000000000003dbf4fb
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 205, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 336, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 358, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/homeassistant/homeassistant/components/hisense_aehw4a1/climate.py", line 426, in async_set_hvac_mode
    await self._device.command(HA_STATE_TO_AC[hvac_mode])
  File "/usr/local/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 68, in command
    return await self._update_command(member)
  File "/usr/local/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 75, in _update_command
    if (await self._check_response(packet_type, pure_bytes)):
  File "/usr/local/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 131, in _check_response
    f"Wrong response for type {packet_type}: {pure_bytes.hex()}"
pyaehw4a1.exceptions.WrongRespError: Wrong response for type 101_0: f4f50140490100fe010101010065000100003012120f808000010102000000000000000000000500000000000b30160000000000000000032000000008000000000000000000000000000000000003dbf4fb``

What kind of problem could it be?
Thanks for your attention

I must investigate on your AC.
You can download from pypi.org/project/pyaehw4a1 my library or install via pip and execute these commands (you need Python installed):

python -m pyaehw4a1 discovery

Then, for every IP you’ll obtain, run:

python -m pyaehw4a1 version --host IP_ADDRESS 
python -m pyaehw4a1 AC --host IP_ADDRESS
python -m pyaehw4a1 AC --host IP_ADDRESS --command status_3_0
python -m pyaehw4a1 AC --host IP_ADDRESS --command status_3_1
python -m pyaehw4a1 AC --host IP_ADDRESS --command status_7_1
python -m pyaehw4a1 AC --host IP_ADDRESS --command status_10_4
python -m pyaehw4a1 AC --host IP_ADDRESS --command status_102_64

After that, check how your ACs respond to on and off commands (e.g. program reports an error but AC executes the command)

Send me the full log and I will try to correct the code for your specific case.

Thanks Davide.
As soon as possible i send you the full log.
Best wishes of new year.
Gabriele

Dear, good night.
I have some similar problems. I have configured the module from configuration.yaml as auto discovery, but every time I started HA it threw me an error indicating that it was not possible to configure. Then I tried to declare the module with its fixed IP (reserved by mac on my router). That way, when I started HA, it didn’t throw me any mistakes, but neither does the climate entity show me. I also tried to add the Hisense integration. I don’t remember at what time or with which combination, but thanks to what you were talking about here, I realized that HA created the climate.10_0_1_226 entity (the Hisense IP). Because of this, I wanted to reconfigure it to show me that entity again and I have not succeeded.
Could you help me?
Thank you!!

Well, I had a breakthrough. I had already removed the link between the Hisense and the official App, but I had never restarted that device. I cut the energy of the air and turned it on again, then restarted HA and now the climate entity appears to me. When I execute a command, a noise is heard from the air, as if to indicate that it receives a command, but does nothing. It only shows the following error in HA:

(call service failed)

Then, I managed to turn on the air, but I had to enter the card options and put several data to turn it on, such as ‘Preset’ in ‘None’ and ‘Mode’ in ‘Cold’. It did not work directly from the main buttons of the card (cold, heat, etc)

Another detail, every time I give it a command, the Air takes it correctly and fast, but throws constant error messages, for example when I want to lower the temperature: ‘call serviced failed climate/set_temperature. Wrong response for type 101_0: f4f501404 etc.’
(with a long code like the previous image)

I want to take the opportunity to congratulate you on the new integration, Davide!! I think if we correct these last details, it will look amazing!

I send you the data you requested in this message, to see if this fault can be fixed

python -m pyaehw4a1 version --host IP_ADDRESS:
An open stream object is being garbage collected; call “stream.close()” explicitly.
b’+XMV:4.4.7\r\n’


python -m pyaehw4a1 AC --host
AC 10.0.1.226 status_102_0 :
{
“wind_status”: “00000000”,
“sleep_status”: “0000000”,
“mode_status”: “0010”,
“run_status”: “0”,
“direction_status”: “00”,
“indoor_temperature_setting”: “00011010”,
“indoor_temperature_status”: “00011101”,
“indoor_pipe_temperature”: “00011100”,
“indoor_humidity_setting”: “10000000”,
“indoor_humidity_status”: “10000000”,
“somatosensory_temperature”: “00000000”,
“somatosensory_compensation”: “00000”,
“somatosensory_compensation_ctrl”: “001”,
“temperature_compensation”: “10100”,
“temperature_Fahrenheit”: “0”,
“timer”: “00000010”,
“hour”: “00000000”,
“minute”: “00000000”,
“poweron_hour”: “00000”,
“poweron_minute”: “000000”,
“poweron_status”: “0”,
“poweroff_hour”: “00000”,
“poweroff_minute”: “000000”,
“poweroff_status”: “0”,
“drying”: “0000”,
“wind_door”: “0000”,
“up_down”: “0”,
“left_right”: “0”,
“nature”: “0”,
“heat”: “0”,
“low_power”: “0”,
“low_electricity”: “0”,
“efficient”: “0”,
“dual_frequency”: “0”,
“dew”: “0”,
“swap”: “0”,
“indoor_clear”: “0”,
“outdoor_clear”: “0”,
“smart_eye”: “0”,
“mute”: “0”,
“voice”: “0”,
“smoke”: “0”,
“back_led”: “0”,
“display_led”: “0”,
“indicate_led”: “0”,
“indoor_led”: “0”,
“filter_reset”: “0”,
“left_wind”: “0”,
“right_wind”: “0”,
“indoor_electric”: “0”,
“auto_check”: “0”,
“time_laps”: “0”,
“rev23”: “0001”,
“sample”: “0”,
“indoor_eeprom”: “1”,
“indoor_temperature_sensor”: “0”,
“indoor_temperature_pipe_sensor”: “0”,
“indoor_humidity_sensor”: “0”,
“indoor_water_pump”: “0”,
“indoor_machine_run”: “0”,
“indoor_bars”: “0”,
“indoor_zero_voltage”: “0”,
“indoor_outdoor_communication”: “0”,
“display_communication”: “0”,
“keypad_communication”: “0”,
“wifi_communication”: “0”,
“electric_communication”: “0”,
“eeprom_communication”: “0”,
“rev25”: “000”,
“compressor_frequency”: “00000000”,
“compressor_frequency_setting”: “00000000”,
“compressor_frequency_send”: “00000000”,
“outdoor_temperature”: “00011011”,
“outdoor_condenser_temperature”: “00011011”,
“compressor_exhaust_temperature”: “00100101”,
“target_exhaust_temperature”: “00000000”,
“expand_threshold”: “00000000”,
“UAB_HIGH”: “00000000”,
“UAB_LOW”: “11100010”,
“UBC_HIGH”: “00000000”,
“UBC_LOW”: “00000000”,
“UCA_HIGH”: “00000000”,
“UCA_LOW”: “00000000”,
“IAB”: “00000000”,
“IBC”: “00000000”,
“ICA”: “00000000”,
“generatrix_voltage_high”: “00000000”,
“generatrix_voltage_low”: “00000000”,
“IUV”: “00000000”,
“rev46”: “000”,
“four_way”: “0”,
“outdoor_machine”: “0”,
“wind_machine”: “000”,
“rev47”: “00000000”,
“rev48”: “00000000”,
“rev49”: “00000000”,
“rev50”: “00000000”,
“rev51”: “00000000”,
“rev52”: “00000000”,
“rev53”: “00000000”,
“rev54”: “00000000”,
“rev55”: “00000000”,
“rev56”: “00000000”
}


python -m pyaehw4a1 AC --host IP_ADDRESS --command status_3_0

An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 3_0: 00000001


python -m pyaehw4a1 AC --host IP_ADDRESS --command status_3_1

Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 106, in _read_command
pure_bytes = await self._send_recv_packet(command)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 122, in _send_recv_packet
raise ConnectionError(f"AC unavailable at {self._host}") from None
pyaehw4a1.exceptions.ConnectionError: AC unavailable at 10.0.1.226


python -m pyaehw4a1 AC --host IP_ADDRESS --command status_7_1

An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 7_1: 0000000100010000000000100001010100000001


python -m pyaehw4a1 AC --host IP_ADDRESS --command status_10_4

An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Users\User\Desktop\HA\pyaehw4a1-0.3.3\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 10_4: 000000010000000100000001


python -m pyaehw4a1 AC --host IP_ADDRESS --command status_102_64

An open stream object is being garbage collected; call “stream.close()” explicitly.
AC 10.0.1.226 status_102_64 :
{
“ONE_KWH_I”: “00001001”,
“ONE_KWH_F”: “00000100”,
“ONE_KWH_D”: “11010110”,
“KWH_DAY”: “00000101”,
“KWH_WEEK_H”: “00000111”,
“KWH_WEEK_L”: “11101010”,
“KWH_MONTH_H”: “00000001”,
“KWH_MONTH_L”: “01110000”,
“KWH_QUARTER_H”: “01001000”,
“KWH_QUARTER_L”: “10000000”,
“KWH_HALFYEAR_H”: “10000000”,
“KWH_HALFYEAR_L”: “00000000”,
“KWH_YEAR_H”: “00000000”,
“KWH_YEAR_L”: “00000000”,
“KWH_H”: “00000000”,
“KWH_SH”: “00000000”,
“KWH_SL”: “00000000”,
“KWH_L”: “00000101”
}

I’m also having the same exact issue. HA successfully finds my AC with this component and I can run a fan command “sometimes”. However, even though I hear my AC beep confirm the call into action from it, HA still errors out with the same [Wrong response error]. See below.

I’m running python3.7 since 3.6 is being phased out after HA version 103.

Wrong response for type 101_0: f4f50140490100fe0101010100650001000002171514808000010104000000000000008000000500000000000405084b000080000000000000000000000000000000000000000000000000000000049cf4fb
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 205, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 336, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 358, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/hisense_aehw4a1/climate.py", line 424, in async_set_hvac_mode
    await self.async_turn_off()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/hisense_aehw4a1/climate.py", line 438, in async_turn_off
    await self._device.command("off")
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 68, in command
    return await self._update_command(member)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 75, in _update_command
    if (await self._check_response(packet_type, pure_bytes)):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 131, in _check_response
    f"Wrong response for type {packet_type}: {pure_bytes.hex()}"
pyaehw4a1.exceptions.WrongRespError: Wrong response for type 101_0: f4f50140490100fe0101010100650001000002171514808000010104000000000000008000000500000000000405084b000080000000000000000000000000000000000000000000000000000000049cf4fb

I followed the commands that you pasted earlier, attempting to see what commands I actually get a successful return from. Only the first and the last "seemed to work but I don’t understand this code either.

Here’s the outputs. They’re labeled.


> python -m pyaehw4a1 version --host 192.168.99.142 

usage: aehw4a1 [-h] {discovery,AC,check} ...
aehw4a1: error: argument choise: invalid choice: 'version' (choose from 'discovery', 'AC', 'check')
> python -m pyaehw4a1 check --host 192.168.99.142 

Found!
> python -m pyaehw4a1 AC --host 192.168.99.142

AC 192.168.99.142 status_102_0 :
 {
    "wind_status": "00001110",
    "sleep_status": "0000000",
    "mode_status": "0000",
    "run_status": "1",
    "direction_status": "10",
    "indoor_temperature_setting": "00010111",
    "indoor_temperature_status": "00010101",
    "indoor_pipe_temperature": "00010100",
    "indoor_humidity_setting": "10000000",
    "indoor_humidity_status": "10000000",
    "somatosensory_temperature": "00000000",
    "somatosensory_compensation": "00000",
    "somatosensory_compensation_ctrl": "001",
    "temperature_compensation": "00000",
    "temperature_Fahrenheit": "0",
    "timer": "00000100",
    "hour": "00000000",
    "minute": "00000000",
    "poweron_hour": "00000",
    "poweron_minute": "000000",
    "poweron_status": "0",
    "poweroff_hour": "00000",
    "poweroff_minute": "000000",
    "poweroff_status": "0",
    "drying": "0000",
    "wind_door": "0000",
    "up_down": "1",
    "left_right": "0",
    "nature": "0",
    "heat": "0",
    "low_power": "0",
    "low_electricity": "0",
    "efficient": "0",
    "dual_frequency": "0",
    "dew": "0",
    "swap": "0",
    "indoor_clear": "0",
    "outdoor_clear": "0",
    "smart_eye": "0",
    "mute": "0",
    "voice": "0",
    "smoke": "0",
    "back_led": "1",
    "display_led": "0",
    "indicate_led": "0",
    "indoor_led": "0",
    "filter_reset": "0",
    "left_wind": "0",
    "right_wind": "0",
    "indoor_electric": "0",
    "auto_check": "0",
    "time_laps": "0",
    "rev23": "0001",
    "sample": "0",
    "indoor_eeprom": "1",
    "indoor_temperature_sensor": "0",
    "indoor_temperature_pipe_sensor": "0",
    "indoor_humidity_sensor": "0",
    "indoor_water_pump": "0",
    "indoor_machine_run": "0",
    "indoor_bars": "0",
    "indoor_zero_voltage": "0",
    "indoor_outdoor_communication": "0",
    "display_communication": "0",
    "keypad_communication": "0",
    "wifi_communication": "0",
    "electric_communication": "0",
    "eeprom_communication": "0",
    "rev25": "000",
    "compressor_frequency": "00000000",
    "compressor_frequency_setting": "00000000",
    "compressor_frequency_send": "00000000",
    "outdoor_temperature": "00001001",
    "outdoor_condenser_temperature": "00001010",
    "compressor_exhaust_temperature": "00010010",
    "target_exhaust_temperature": "01001011",
    "expand_threshold": "00000000",
    "UAB_HIGH": "00000000",
    "UAB_LOW": "10000000",
    "UBC_HIGH": "00000000",
    "UBC_LOW": "00000000",
    "UCA_HIGH": "00000000",
    "UCA_LOW": "00000000",
    "IAB": "00000000",
    "IBC": "00000000",
    "ICA": "00000000",
    "generatrix_voltage_high": "00000000",
    "generatrix_voltage_low": "00000000",
    "IUV": "00000000",
    "rev46": "000",
    "four_way": "0",
    "outdoor_machine": "0",
    "wind_machine": "000",
    "rev47": "00000000",
    "rev48": "00000000",
    "rev49": "00000000",
    "rev50": "00000000",
    "rev51": "00000000",
    "rev52": "00000000",
    "rev53": "00000000",
    "rev54": "00000000",
    "rev55": "00000000",
    "rev56": "00000000"
}
> python -m pyaehw4a1 AC --host 192.168.99.142 --command status_3_0

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 57, in <module>
    main()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 42, in main
    parsed = asyncio.run(client.command(command))
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 58, in command
    return await self._read_command(member)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 87, in _read_command
    result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 117, in _bits_value
    raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 3_0: 00000001
> python -m pyaehw4a1 AC --host 192.168.99.142 --command status_3_1

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 57, in <module>
    main()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 42, in main
    parsed = asyncio.run(client.command(command))
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 58, in command
    return await self._read_command(member)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 87, in _read_command
    result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 117, in _bits_value
    raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 3_1: 00000001
> python -m pyaehw4a1 AC --host IP_ADDRESS --command status_7_1

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 57, in <module>
    main()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 42, in main
    parsed = asyncio.run(client.command(command))
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 58, in command
    return await self._read_command(member)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 87, in _read_command
    result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 117, in _bits_value
    raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 7_1: 0000000100010000000000100001010100000001
> python -m pyaehw4a1 AC --host 192.168.99.142 --command status_10_4

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 57, in <module>
    main()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/__main__.py", line 42, in main
    parsed = asyncio.run(client.command(command))
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 58, in command
    return await self._read_command(member)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 87, in _read_command
    result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyaehw4a1/aehw4a1.py", line 117, in _bits_value
    raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 10_4: 000000010000000100000001

> python -m pyaehw4a1 AC --host 192.168.99.142 --command status_102_64 AC 192.168.99.142 status_102_64 :

 {
    "ONE_KWH_I": "00001001",
    "ONE_KWH_F": "00000100",
    "ONE_KWH_D": "11010110",
    "KWH_DAY": "00000101",
    "KWH_WEEK_H": "00000111",
    "KWH_WEEK_L": "11101010",
    "KWH_MONTH_H": "00000001",
    "KWH_MONTH_L": "01110000",
    "KWH_QUARTER_H": "01001000",
    "KWH_QUARTER_L": "10000000",
    "KWH_HALFYEAR_H": "10000000",
    "KWH_HALFYEAR_L": "00000000",
    "KWH_YEAR_H": "00000000",
    "KWH_YEAR_L": "00000000",
    "KWH_H": "00000000",
    "KWH_SH": "00000000",
    "KWH_SL": "00000000",
    "KWH_L": "00000101"
}

Could you assist as well, me, in your investigation on what’s going on here? Thanks!

I have implemented the version command in v.0.3.3 of pyaehw4a1, you can find it on pypi.org, link above.

You all have the same error, the response 101_0 is not what is expected. This is probably related to XMV.4.4.7, while my code is based of my reversing of 4.4.6.

I’m also having trouble restarting HA, having to remove the integration and reload it to view the air conditioners online. The cause I think is due to an aggressive timing in the discovery function, which worked well on a development HA with no other processes running.

To mitigate the problem you must config integration from menu and not from configuration.yaml, so on restart it is easy to remove and reinstall the integration.

I will make corrections to the code and ask you to test it before doing a PR into HA.

N.B. I never said to disconnect AC from the official app and uninstall it -I never did and I did not investigate if it could have unexpected consequences on the functioning of the library.
I only declared not to use it to avoid conflicts in sending commands and the consequent blocking of the device; as some of you have already noticed by turning off the air conditioners they return to respond to commands

Can you tell me the model of the individual air conditioners, the version of XM and if they are monosplit or multisplit units? Thank you

I completely missed the download link you sent. I installed it and ran the version command successfully. Output belowThanks for the quick reply too! I think as expected, I’m getting the same errors after the upgrade, as the previous version.

**>python -m pyaehw4a1 version --host 192.168.99.142**

b'+XMV:4.4.7\r\n

My mini split is just a mono unit. It’s made from a Hisense partnership from my understanding, it’s not 100% Hisense but mostly. I actually use the Hisense “AC WiFi” App to control mine. (I’m not sure if that’s the latest Hisense app or not because for a while I quit using it. It’s awful!)
It’s an Innovair Quantum 1Ton 12K BTU Heat Pump 115V version. Model number: WIN12H1V51
The WiFi module I received from the manufacturer, the dongle, is made by Topeast. I’ve included a picture of it.
I’m not sure if the extra info helps or not.

Thanks for all your help!

Ok, I just uploaded v.0.3.4 of pyaehw4a1 on Pypi. Can you test it?

Hi Davide!
My air conditioner is a Hisense HISI53WCO, monosplit and my version is:

C:\Users\User>python -m pyaehw4a1 version --host 10.0.1.226
An open stream object is being garbage collected; call “stream.close()” explicitly.
b’+XMV:4.4.7\r\n’

Of course, I am to do the necessary tests. I already downloaded the new version, tell me what exact tests I should do and I send them to you. Do you need me to execute a command like yesterday?

Just send commands like on, off and heating using latest library on Pypi and report any errors or if it works

There I tried on off and it didn’t throw any error :smiley:

Command on:

C:\Users\User>python -m pyaehw4a1 AC --host 10.0.1.226 --command on
An open stream object is being garbage collected; call “stream.close()” explicitly.
An open stream object is being garbage collected; call “stream.close()” explicitly.
AC 10.0.1.226 on :
{
“wind_status”: “00001100”,
“sleep_status”: “0000000”,
“mode_status”: “0010”,
“run_status”: “1”,
“direction_status”: “00”,
“indoor_temperature_setting”: “00011001”,
“indoor_temperature_status”: “00011000”,
“indoor_pipe_temperature”: “00001001”,
“indoor_humidity_setting”: “10000000”,
“indoor_humidity_status”: “10000000”,
“somatosensory_temperature”: “00000000”,
“somatosensory_compensation”: “00000”,
“somatosensory_compensation_ctrl”: “001”,
“temperature_compensation”: “10010”,
“temperature_Fahrenheit”: “0”,
“timer”: “00000010”,
“hour”: “00000000”,
“minute”: “00000000”,
“poweron_hour”: “00000”,
“poweron_minute”: “000000”,
“poweron_status”: “0”,
“poweroff_hour”: “00000”,
“poweroff_minute”: “000000”,
“poweroff_status”: “0”,
“drying”: “0000”,
“wind_door”: “0000”,
“up_down”: “0”,
“left_right”: “0”,
“nature”: “0”,
“heat”: “0”,
“low_power”: “0”,
“low_electricity”: “0”,
“efficient”: “0”,
“dual_frequency”: “0”,
“dew”: “0”,
“swap”: “0”,
“indoor_clear”: “0”,
“outdoor_clear”: “0”,
“smart_eye”: “0”,
“mute”: “0”,
“voice”: “0”,
“smoke”: “0”,
“back_led”: “1”,
“display_led”: “0”,
“indicate_led”: “0”,
“indoor_led”: “0”,
“filter_reset”: “0”,
“left_wind”: “0”,
“right_wind”: “0”,
“indoor_electric”: “0”,
“auto_check”: “0”,
“time_laps”: “0”,
“rev23”: “0001”,
“sample”: “0”,
“indoor_eeprom”: “1”,
“indoor_temperature_sensor”: “0”,
“indoor_temperature_pipe_sensor”: “0”,
“indoor_humidity_sensor”: “0”,
“indoor_water_pump”: “0”,
“indoor_machine_run”: “0”,
“indoor_bars”: “0”,
“indoor_zero_voltage”: “0”,
“indoor_outdoor_communication”: “0”,
“display_communication”: “0”,
“keypad_communication”: “0”,
“wifi_communication”: “0”,
“electric_communication”: “0”,
“eeprom_communication”: “0”,
“rev25”: “000”,
“compressor_frequency”: “00110001”,
“compressor_frequency_setting”: “00110001”,
“compressor_frequency_send”: “00110001”,
“outdoor_temperature”: “00011100”,
“outdoor_condenser_temperature”: “00100010”,
“compressor_exhaust_temperature”: “00111011”,
“target_exhaust_temperature”: “00110111”,
“expand_threshold”: “00000000”,
“UAB_HIGH”: “00000000”,
“UAB_LOW”: “11100010”,
“UBC_HIGH”: “00000000”,
“UBC_LOW”: “00000000”,
“UCA_HIGH”: “00000000”,
“UCA_LOW”: “00000000”,
“IAB”: “00001100”,
“IBC”: “10000000”,
“ICA”: “00000000”,
“generatrix_voltage_high”: “00000000”,
“generatrix_voltage_low”: “00000000”,
“IUV”: “00100000”,
“rev46”: “000”,
“four_way”: “0”,
“outdoor_machine”: “0”,
“wind_machine”: “000”,
“rev47”: “00000000”,
“rev48”: “00000000”,
“rev49”: “00000000”,
“rev50”: “00000000”,
“rev51”: “00000000”,
“rev52”: “00000000”,
“rev53”: “00000000”,
“rev54”: “00000000”,
“rev55”: “00000000”,
“rev56”: “00000000”
}

Command off:

C:\Users\User>python -m pyaehw4a1 AC --host 10.0.1.226 --command off
An open stream object is being garbage collected; call “stream.close()” explicitly.
An open stream object is being garbage collected; call “stream.close()” explicitly.
AC 10.0.1.226 off :
{
“wind_status”: “00001100”,
“sleep_status”: “0000000”,
“mode_status”: “0010”,
“run_status”: “0”,
“direction_status”: “00”,
“indoor_temperature_setting”: “00011001”,
“indoor_temperature_status”: “00011000”,
“indoor_pipe_temperature”: “00010010”,
“indoor_humidity_setting”: “10000000”,
“indoor_humidity_status”: “10000000”,
“somatosensory_temperature”: “00000000”,
“somatosensory_compensation”: “00000”,
“somatosensory_compensation_ctrl”: “001”,
“temperature_compensation”: “10010”,
“temperature_Fahrenheit”: “0”,
“timer”: “00000010”,
“hour”: “00000000”,
“minute”: “00000000”,
“poweron_hour”: “00000”,
“poweron_minute”: “000000”,
“poweron_status”: “0”,
“poweroff_hour”: “00000”,
“poweroff_minute”: “000000”,
“poweroff_status”: “0”,
“drying”: “0000”,
“wind_door”: “0000”,
“up_down”: “0”,
“left_right”: “0”,
“nature”: “0”,
“heat”: “0”,
“low_power”: “0”,
“low_electricity”: “0”,
“efficient”: “0”,
“dual_frequency”: “0”,
“dew”: “0”,
“swap”: “0”,
“indoor_clear”: “0”,
“outdoor_clear”: “0”,
“smart_eye”: “0”,
“mute”: “0”,
“voice”: “0”,
“smoke”: “0”,
“back_led”: “1”,
“display_led”: “0”,
“indicate_led”: “0”,
“indoor_led”: “0”,
“filter_reset”: “0”,
“left_wind”: “0”,
“right_wind”: “0”,
“indoor_electric”: “0”,
“auto_check”: “0”,
“time_laps”: “0”,
“rev23”: “0001”,
“sample”: “0”,
“indoor_eeprom”: “1”,
“indoor_temperature_sensor”: “0”,
“indoor_temperature_pipe_sensor”: “0”,
“indoor_humidity_sensor”: “0”,
“indoor_water_pump”: “0”,
“indoor_machine_run”: “0”,
“indoor_bars”: “0”,
“indoor_zero_voltage”: “0”,
“indoor_outdoor_communication”: “0”,
“display_communication”: “0”,
“keypad_communication”: “0”,
“wifi_communication”: “0”,
“electric_communication”: “0”,
“eeprom_communication”: “0”,
“rev25”: “000”,
“compressor_frequency”: “00000000”,
“compressor_frequency_setting”: “00000000”,
“compressor_frequency_send”: “00000000”,
“outdoor_temperature”: “00011100”,
“outdoor_condenser_temperature”: “00011101”,
“compressor_exhaust_temperature”: “00110101”,
“target_exhaust_temperature”: “00110111”,
“expand_threshold”: “00000000”,
“UAB_HIGH”: “00000000”,
“UAB_LOW”: “11100010”,
“UBC_HIGH”: “00000000”,
“UBC_LOW”: “00000000”,
“UCA_HIGH”: “00000000”,
“UCA_LOW”: “00000000”,
“IAB”: “00000000”,
“IBC”: “00000000”,
“ICA”: “00000000”,
“generatrix_voltage_high”: “00000000”,
“generatrix_voltage_low”: “00000000”,
“IUV”: “00000000”,
“rev46”: “000”,
“four_way”: “0”,
“outdoor_machine”: “0”,
“wind_machine”: “000”,
“rev47”: “00000000”,
“rev48”: “00000000”,
“rev49”: “00000000”,
“rev50”: “00000000”,
“rev51”: “00000000”,
“rev52”: “00000000”,
“rev53”: “00000000”,
“rev54”: “00000000”,
“rev55”: “00000000”,
“rev56”: “00000000”
}

I ask you another question. When I use the AC from HA, after a few seconds of operation, it goes to “not available” and I have to restart HA in order to use the module again. Do you know why it can be? (There are no signal problems, because the AC is next to the router).

I honestly don’t know if it depends on the version of xmv or for a difference between mono and multi split, but once the error was identified it was easy to solve it.

I hope that the changes to the timing in sending the commands will also solve the other problem related to the failed discovery at the restart of HA. Fingers crossed!

Now I have to submit the patch on Github and I hope it arrives on your HA as soon as possible!

1 Like

I expect the same, we will cross our fingers! :smiley:

As soon as it is updated in HA, I will warn you if it works better there.

Thank you very much, Davide!!

Ok, PR done and merged in the dev branch! Release candidate is already in the freezing phase, maybe we will see the library updated in the next minor release.

1 Like

Thank you very much, Davide!!

I ask you an extra query, just in case, yesterday I tried all the available commands. All responded well with the exception of status_3_0, status_3_1, status_7_1 and status_10_4

All others work fine, including status_102_0 and status_102_64.

No problem with this?


Example of outputs errors

status_3_0

C:\Users\User>python -m pyaehw4a1 AC --host 10.0.1.226 --command status_3_0
An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 3_0: 00000001


status_3_1

C:\Users\User>python -m pyaehw4a1 AC --host 10.0.1.226 --command status_3_1
An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 3_1: 00000001


status_7_1

C:\Users\User>python -m pyaehw4a1 AC --host 10.0.1.226 --command status_7_1
An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 7_1: 00000001000100000000001000010101000000011000010011110100


status_10_4

C:\Users\User>python -m pyaehw4a1 AC --host 10.0.1.226 --command status_10_4
An open stream object is being garbage collected; call “stream.close()” explicitly.
Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\Python\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 64, in
main()
File "C:\Python\lib\site-packages\pyaehw4a1_main
.py", line 45, in main
parsed = asyncio.run(client.command(command))
File “C:\Python\lib\asyncio\runners.py”, line 43, in run
return loop.run_until_complete(main)
File “C:\Python\lib\asyncio\base_events.py”, line 608, in run_until_complete
return future.result()
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 81, in command
return await self._read_command(member)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 110, in _read_command
result = await self._bits_value(packet_type, pure_bytes, data_start_pos)
File “C:\Python\lib\site-packages\pyaehw4a1\aehw4a1.py”, line 140, in _bits_value
raise UnkDataError(f"Unknown data type {packet_type}: {binary_data}")
pyaehw4a1.exceptions.UnkDataError: Unknown data type 10_4: 0000000100000001000000010110001011110100