AirCon
AirCon copied to clipboard
AEH-W4F1
Just picked up a new Hisense portable AC (AP1419CW1G) and decided to see if this might work with it, and it seems close... My AC unit has the AEH-W4F1 wifi module, which does not appear to be very widespread yet.
Running the curl -ik 'http://localhost:8888/hisense/status'
command gives me the following (which seemed encouraging, although the temperature readings did not seem accurate):
HTTP/1.0 200 OK
Server: BaseHTTP/0.6 Python/3.7.5
Date: Mon, 25 May 2020 22:37:57 GMT
Content-type: application/json
{"f_electricity": 100, "f_e_arkgrille": 0, "f_e_incoiltemp": 0, "f_e_incom": 0, "f_e_indisplay": 0, "f_e_ineeprom": 0, "f_e_inele": 0, "f_e_infanmotor": 0, "f_e_inhumidity": 0, "f_e_inkeys": 0, "f_e_inlow": 0, "f_e_intemp": 0, "f_e_invzero": 0, "f_e_outcoiltemp": 0, "f_e_outeeprom": 0, "f_e_outgastemp": 0, "f_e_outmachine2": 0, "f_e_outmachine": 0, "f_e_outtemp": 0, "f_e_outtemplow": 0, "f_e_push": 0, "f_filterclean": 0, "f_humidity": 50, "f_power_display": 0, "f_temp_in": 81.0, "f_voltage": 0, "t_backlight": "OFF", "t_device_info": 0, "t_display_power": null, "t_eco": "OFF", "t_fan_leftright": "OFF", "t_fan_mute": "OFF", "t_fan_power": "OFF", "t_fan_speed": "AUTO", "t_ftkt_start": null, "t_power": "ON", "t_run_mode": "OFF", "t_setmulti_value": null, "t_sleep": "STOP", "t_temp": 81, "t_temptype": "FAHRENHEIT", "t_temp_eight": "OFF", "t_temp_heatcold": "OFF", "t_work_mode": "AUTO"}
But when I try the curl -ik 'http://localhost:8888/hisense/command?property=t_power&value=ON'
command the CLI/service appears to hang, and I need to restart the service before the "status" command will work again.
Not completely sure if this is related but checking the status of the service (by running this command systemctl status hisense.service
) I get these errors:
E0525 15:21:58.500 hisense.py:441] Failed to send local_reg keep alive to the AC.
Traceback (most recent call last):
File "hisense.py", line 437, in run
resp = conn.getresponse()
File "/usr/lib/python3.7/http/client.py", line 1344, in getresponse
response.begin()
File "/usr/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.7/http/client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
Any thoughts on getting this AC to work?
Thanks for working on this project @deiger , and thanks in advance for any and all support!
The error you got makes it seem to me that there is a deeper error here. Are you sure the correct IP address is set? Could you try running it with --log_level=DEBUG, and list it here (feel free, of course, to hide the keys, random values etc.).
So the IP address is correct, but out of curiosity I just tried entering the wrong IP address and then running curl -ik 'http://localhost:8888/hisense/status'
, which gave me the same output as when I have the correct IP address entered. This leads me to believe that there may be more work to be done in order for AEH-W4F1 to cooperate with your scripts.
Also, just to make sure we are on the same page about those errors (I also updated my original post with this info), they showed up when I ran this command systemctl status hisense.service
I tried running the server with --log_level=DEBUG, but unfortunately I'm not quite sure where to find that log info (system log maybe?)
So for now, to me it seems like this AC/Wifi module just might not work... No worries!
Either way, thanks again for your response, and let us know if you have any other thoughts or tricks up your sleeve for AEH-W4F1.
All the logs are stored in /var/log/syslog
. You can grep only the lines containing python3[pid], where pid is the process ID of the service.
Not sure if this is everything you would need to troubleshoot, but here is what I found in my syslog:
D0531 14:20:22.911 hisense.py:499] GET Request,#012Path: /hisense/status
D0531 14:20:22.913 hisense.py:649] Response:#012{"f_electricity": 100, "f_e_arkgrille": 0, "f_e_incoiltemp": 0, "f_e_incom": 0, "f_e_indisplay": 0, "f_e_ineeprom": 0, "f_e_inele": 0, "f_e_infanmotor": 0, "f_e_inhumidity": 0, "f_e_inkeys": 0, "f_e_inlow": 0, "f_e_intemp": 0, "f_e_invzero": 0, "f_e_outcoiltemp": 0, "f_e_outeeprom": 0, "f_e_outgastemp": 0, "f_e_outmachine2": 0, "f_e_outmachine": 0, "f_e_outtemp": 0, "f_e_outtemplow": 0, "f_e_push": 0, "f_filterclean": 0, "f_humidity": 50, "f_power_display": 0, "f_temp_in": 81.0, "f_voltage": 0, "t_backlight": "OFF", "t_device_info": 0, "t_display_power": null, "t_eco": "OFF", "t_fan_leftright": "OFF", "t_fan_mute": "OFF", "t_fan_power": "OFF", "t_fan_speed": "AUTO", "t_ftkt_start": null, "t_power": "ON", "t_run_mode": "OFF", "t_setmulti_value": null, "t_sleep": "STOP", "t_temp": 81, "t_temptype": "FAHRENHEIT", "t_temp_eight": "OFF", "t_temp_heatcold": "OFF", "t_work_mode": "AUTO"}
E0531 14:20:23.772 hisense.py:441] Failed to send local_reg keep alive to the AC.#012Traceback (most recent call last):#012 File "./hisense.py", line 436, in run#012 conn.request(method, '/local_reg.json', json.dumps(self._json), self._headers)#012 File "/usr/lib/python3.7/http/client.py", line 1252, in request#012 self._send_request(method, url, body, headers, encode_chunked)#012 File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request#012 self.endheaders(body, encode_chunked=encode_chunked)#012 File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders#012 self._send_output(message_body, encode_chunked=encode_chunked)#012 File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output#012 self.send(msg)#012 File "/usr/lib/python3.7/http/client.py", line 966, in send#012 self.connect()#012 File "/usr/lib/python3.7/http/client.py", line 938, in connect#012 (self.host,self.port), self.timeout, self.source_address)#012 File "/usr/lib/python3.7/socket.py", line 727, in create_connection#012 raise err#012 File "/usr/lib/python3.7/socket.py", line 716, in create_connection#012 sock.connect(sa)#012socket.timeout: timed out
D0531 14:20:23.772 hisense.py:435] POST /local_reg.json {"local_reg": {"ip": "someip", "notify": 1, "port": 8888, "uri": "/local_lan"}}
OK, let's take a step back, as it seems even the initial communication with the A/C fails. Which app are you using?
OK, let's take a step back, as it seems even the initial communication with the A/C fails. Which app are you using?
Good call, I am using the "HiSmart Air" Android app.
If it is this one, then the code for local control is exactly the same. Are you able to control the AC locally, e.g. after preventing the AC from contacting the Internet? Can you try entering the AC's ip address (that you've set in the script's command line) from the browser? It should return a "Page not found." 404 response.
That is the one. I don't know about controlling the AC locally, but I can definitely get the "Page not found" 404 response when entering the AC's IP into a web browser.
I'm starting to wonder about the reliability of the wifi module and/or app. Hisense's software is pretty terrible. If/when I get the AC connected to the app, it works for a minute and then pretty quickly becomes unavailable. But even when it is unavailable in the app, I can still reach the "Page not found" 404 response.
I'll keep messing with things here and report back if anything worth reporting comes up.
I've changed code to repeatedly retry the local registration against the A/C, in case if fails. It may resolve the flakiness issue.
Mind that you should run pip3.7 install retry
for it to work.
I tried messing with this a little more today, but am still facing the same issues. Curious if anybody else out there has tried AirCon with the AEH-W4F1...
I have a dehumidifier with this module. I have a somewhat similar experience trying to control it with this project, but for me it does work fine with the app.
The status command returns info, albeit inaccurate info like above. A power on/off command hangs, but the daemon doesn’t die.
I don’t seem to have any errors logged like the above indicating any failures to connect.
I’d love to help get this one working, if that’s at all possible.
@henworth are you running it with --device_type humidifier
? The configuration for humidifiers is really different.
There might be yet another type of configuration for dehumidifiers, I haven't seen such so far.
Hi, I'm having the same issue using טורנדו WiFi Status returns results, but when sending commands.. it hangs.. any resolution on this?
Hello all,
I have the same problem with two Hisense AC's (Module: AEH-W4B1). I'm using the "Hi-Smart AC" App on iOS and on the Status-Page I see the same Values as @NoNaym
{"f_electricity": 100, "f_e_arkgrille": 0, "f_e_incoiltemp": 0, "f_e_incom": 0, "f_e_indisplay": 0, "f_e_ineeprom": 0, "f_e_inele": 0, "f_e_infanmotor": 0, "f_e_inhumidity": 0, "f_e_inkeys": 0, "f_e_inlow": 0, "f_e_intemp": 0, "f_e_invzero": 0, "f_e_outcoiltemp": 0, "f_e_outeeprom": 0, "f_e_outgastemp": 0, "f_e_outmachine2": 0, "f_e_outmachine": 0, "f_e_outtemp": 0, "f_e_outtemplow": 0, "f_e_push": 0, "f_filterclean": 0, "f_humidity": 50, "f_power_display": 0, "f_temp_in": 81.0, "f_voltage": 0, "t_backlight": "OFF", "t_control_value": null, "t_device_info": 0, "t_display_power": null, "t_eco": "OFF", "t_fan_leftright": "OFF", "t_fan_mute": "OFF", "t_fan_power": "OFF", "t_fan_speed": "AUTO", "t_ftkt_start": null, "t_power": "ON", "t_run_mode": "OFF", "t_setmulti_value": null, "t_sleep": "STOP", "t_temp": 81, "t_temptype": "FAHRENHEIT", "t_temp_eight": "OFF", "t_temp_heatcold": "OFF", "t_work_mode": "AUTO"}
But when I use the Python query tool with the "--properies true" flag I see both AC's with correct values.
Syslog:
Aug 2 13:30:32 ioBroker-strom D0802 13:30:32.951 hisense.py:487] POST /local_reg.json {"local_reg": {"ip": "10.10.40.120", "notify": 0, "port": 8888, "uri": "/local_lan"}} Aug 2 13:30:33 ioBroker-strom W0802 13:30:33.023 api.py:40] Recieved invalid response for local_reg: <http.client.HTTPResponse object at 0x75dd7490>, retrying in 20 seconds...
Hi, I have the W4F1 version as well, the ac works fine with the Tornado 2-wifi app, no issues. When I run the status command I get back a JSON that looks correct (and as opposed to others it only works on the correct IP of the AC). But when I try to send it a command it hangs for a while and I get this error in hisense.py: ` 192.168.237.156 - - [23/Sep/2020 12:43:10] "POST /local_lan/property/datapoint.json HTTP/1.1" 200 - 192.168.237.156 - - [23/Sep/2020 12:43:10] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - 192.168.237.156 - - [23/Sep/2020 12:43:10] "POST /local_lan/key_exchange.json HTTP/1.1" 404 -
Exception happened during processing of request from ('192.168.237.156', 51644) Traceback (most recent call last): File "/usr/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python3.8/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python3.8/socketserver.py", line 720, in init self.handle() File "/usr/lib/python3.8/http/server.py", line 427, in handle self.handle_one_request() File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request method() File "hisense.py", line 600, in do_POST self.do_HEAD(HTTPStatus.NOT_FOUND) File "hisense.py", line 568, in do_HEAD self.end_headers() File "/usr/lib/python3.8/http/server.py", line 529, in end_headers self.flush_headers() File "/usr/lib/python3.8/http/server.py", line 533, in flush_headers self.wfile.write(b"".join(self._headers_buffer)) File "/usr/lib/python3.8/socketserver.py", line 799, in write self._sock.sendall(b) BrokenPipeError: [Errno 32] Broken pipe
`
any help would be greatly appreciated
I tried it with my AC, and it's working with AEH-W4F1
Hi @kaaspad, you seem to be getting a 404 error for the key exchange, which is really strange. Could you please try re-running discovery, and update the config file with the version at HEAD? Also, mind that you define a static IP address for the AC in your router.
Hi @kaaspad, you seem to be getting a 404 error for the key exchange, which is really strange. Could you please try re-running discovery, and update the config file with the version at HEAD? Also, mind that you define a static IP address for the AC in your router.
@deiger, was just trying with my AC with the same version, your last commit created a syntax error, see bellow please,
TracebTraceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/local/Cellar/[email protected]/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/rotem/Desktop/aircon/AirCon/aircon/main.py", line 23, in
Also, when running with the new code(and new discovery) and running curl -ik 'http://localhost:8888/hisense/command?property=t_power&value=ON'
I get this:
HTTP/1.1 400 Bad Request Content-Type: text/plain; charset=utf-8 Content-Length: 16 Date: Tue, 05 Jan 2021 11:58:40 GMT Server: Python/3.7 aiohttp/3.6.2
400: Bad Request%
The status curl command works well..
Hi @kaaspad, you seem to be getting a 404 error for the key exchange, which is really strange. Could you please try re-running discovery, and update the config file with the version at HEAD? Also, mind that you define a static IP address for the AC in your router.
@deiger, was just trying with my AC with the same version, your last commit created a syntax error, see bellow please,
TracebTraceback (most recent call last): File "/usr/local/Cellar/[email protected]/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/local/Cellar/[email protected]/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/rotem/Desktop/aircon/AirCon/aircon/main.py", line 23, in from .app_mappings import SECRET_MAP File "/Users/rotem/Desktop/aircon/AirCon/aircon/app_mappings.py", line 74 CELSIUS_BASED_APPS { ^ SyntaxError: invalid syntax
Oops, fixed the bug now.
👍 I can approve this is working using MQTT(HA). With auto discovery it picked the AC. Still playing with it..
I'm using Torando with Hisense w4F1. I was able to somehow configure things. a couple of questions:
-
there's a very long delay, I assume it's by the connection through the app the tornado cloud service. is there anyway I can get it to work locally and disable the remote connection?
-
there's seems to be a lot of commands firing to the AC Unit. I can hear it beeping and changing settings.