AirCon
AirCon copied to clipboard
KeyError 'name' Exception :(
Hi, thanks for gr8 integration. Almost everythink works but during the script I've got exception:
--- Logging error ---
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/logging/handlers.py", line 934, in emit
self.socket.send(msg)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/logging/handlers.py", line 855, in _connect_unixsocket
self.socket.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/logging/handlers.py", line 937, in emit
self._connect_unixsocket(self.address)
File "/usr/lib/python3.7/logging/handlers.py", line 866, in _connect_unixsocket
self.socket.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
Call stack:
File "/hisense/hisense.py", line 822, in <module>
httpd.serve_forever()
File "/usr/lib/python3.7/socketserver.py", line 237, in serve_forever
self._handle_request_noblock()
File "/usr/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.7/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/usr/lib/python3.7/http/server.py", line 426, in handle
self.handle_one_request()
File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
method()
File "/hisense/hisense.py", line 578, in do_POST
handler(self, parsed_url.path, query, data)
File "/hisense/hisense.py", line 657, in property_update_handler
logging.exception('Failed to handle %s', update)
Message: 'Failed to handle %s'
Arguments: {'seq_no': 1284, 'data': {}}
Dunno how to fix that error, becouse data is empty after decrypt data. Any idea? Can I isset that param in code?
It looks like there is missing current temperature param. always is set to default ;(
OK, which AC are you using? Maybe the changed something. I assume the script is continuing as usual except for the error message? I can change the code to just ignore a response with empty data if that is indeed the case.
My model is AUD-24UX4RCL4, Mute this error is no problem, but I cant get information about current temp its always 81 F.
There are many of empty data:
W0421 20:05:32.917 hisense.py:695] Decrypted: {"seq_no":1542,"data":{"name":"f_electricity","base_type":"integer","value":3}}
W0421 20:05:32.986 hisense.py:695] Decrypted: {"seq_no":1543,"data":{"name":"f_e_arkgrille","base_type":"boolean","value":0}}
W0421 20:05:33.151 hisense.py:695] Decrypted: {"seq_no":1544,"data":{"name":"f_e_incoiltemp","base_type":"boolean","value":0}}
W0421 20:05:33.322 hisense.py:695] Decrypted: {"seq_no":1545,"data":{"name":"f_e_incom","base_type":"boolean","value":0}}
W0421 20:05:33.502 hisense.py:695] Decrypted: {"seq_no":1546,"data":{"name":"f_e_indisplay","base_type":"boolean","value":0}}
W0421 20:05:33.596 hisense.py:695] Decrypted: {"seq_no":1547,"data":{"name":"f_e_ineeprom","base_type":"boolean","value":0}}
W0421 20:05:33.656 hisense.py:695] Decrypted: {"seq_no":1548,"data":{"name":"f_e_inele","base_type":"boolean","value":0}}
W0421 20:05:33.725 hisense.py:695] Decrypted: {"seq_no":1549,"data":{"name":"f_e_infanmotor","base_type":"boolean","value":0}}
W0421 20:05:33.890 hisense.py:695] Decrypted: {"seq_no":1550,"data":{"name":"f_e_inhumidity","base_type":"boolean","value":0}}
W0421 20:05:33.952 hisense.py:695] Decrypted: {"seq_no":1551,"data":{"name":"f_e_inkeys","base_type":"boolean","value":0}}
W0421 20:05:34.015 hisense.py:695] Decrypted: {"seq_no":1552,"data":{"name":"f_e_inlow","base_type":"boolean","value":0}}
W0421 20:05:34.079 hisense.py:695] Decrypted: {"seq_no":1553,"data":{"name":"f_e_intemp","base_type":"boolean","value":0}}
W0421 20:05:34.244 hisense.py:695] Decrypted: {"seq_no":1554,"data":{"name":"f_e_invzero","base_type":"boolean","value":0}}
W0421 20:05:34.311 hisense.py:695] Decrypted: {"seq_no":1555,"data":{"name":"f_e_outcoiltemp","base_type":"boolean","value":0}}
W0421 20:05:34.372 hisense.py:695] Decrypted: {"seq_no":1556,"data":{"name":"f_e_outeeprom","base_type":"boolean","value":0}}
W0421 20:05:34.536 hisense.py:695] Decrypted: {"seq_no":1557,"data":{"name":"f_e_outgastemp","base_type":"boolean","value":0}}
W0421 20:05:34.704 hisense.py:695] Decrypted: {"seq_no":1558,"data":{"name":"f_e_outmachine2","base_type":"boolean","value":0}}
W0421 20:05:34.774 hisense.py:695] Decrypted: {"seq_no":1559,"data":{"name":"f_e_outmachine","base_type":"boolean","value":0}}
W0421 20:05:34.837 hisense.py:695] Decrypted: {"seq_no":1560,"data":{"name":"f_e_outtemp","base_type":"boolean","value":0}}
W0421 20:05:34.914 hisense.py:695] Decrypted: {"seq_no":1561,"data":{"name":"f_e_outtemplow","base_type":"boolean","value":0}}
W0421 20:05:34.983 hisense.py:695] Decrypted: {"seq_no":1562,"data":{"name":"f_e_push","base_type":"integer","value":0}}
W0421 20:05:35.049 hisense.py:695] Decrypted: {"seq_no":1563,"data":{"name":"f_filterclean","base_type":"boolean","value":0}}
W0421 20:05:35.114 hisense.py:695] Decrypted: {"seq_no":1564,"data":{"name":"f_humidity","base_type":"integer","value":0}}
W0421 20:05:35.201 hisense.py:695] Decrypted: {"seq_no":1565,"data":{"name":"f_power_display","base_type":"integer","value":660}}
W0421 20:05:35.267 hisense.py:695] Decrypted: {"seq_no":1566,"data":{"name":"f_temp_in","base_type":"integer","value":22}}
W0421 20:05:35.328 hisense.py:695] Decrypted: {"seq_no":1567,"data":{}}
E0421 20:05:35.328 hisense.py:657] Failed to handle {'seq_no': 1567, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:35.389 hisense.py:695] Decrypted: {"seq_no":1568,"data":{"name":"t_backlight","base_type":"boolean","value":0}}
W0421 20:05:35.452 hisense.py:695] Decrypted: {"seq_no":1569,"data":{"name":"t_device_info","base_type":"integer","value":0}}
W0421 20:05:35.514 hisense.py:695] Decrypted: {"seq_no":1570,"data":{}}
E0421 20:05:35.514 hisense.py:657] Failed to handle {'seq_no': 1570, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:35.574 hisense.py:695] Decrypted: {"seq_no":1571,"data":{}}
E0421 20:05:35.574 hisense.py:657] Failed to handle {'seq_no': 1571, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:35.738 hisense.py:695] Decrypted: {"seq_no":1572,"data":{}}
E0421 20:05:35.738 hisense.py:657] Failed to handle {'seq_no': 1572, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:35.797 hisense.py:695] Decrypted: {"seq_no":1573,"data":{}}
E0421 20:05:35.797 hisense.py:657] Failed to handle {'seq_no': 1573, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:35.984 hisense.py:695] Decrypted: {"seq_no":1574,"data":{}}
E0421 20:05:35.985 hisense.py:657] Failed to handle {'seq_no': 1574, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.151 hisense.py:695] Decrypted: {"seq_no":1575,"data":{}}
E0421 20:05:36.152 hisense.py:657] Failed to handle {'seq_no': 1575, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.236 hisense.py:695] Decrypted: {"seq_no":1576,"data":{"name":"t_ftkt_start","base_type":"integer","value":0}}
W0421 20:05:36.303 hisense.py:695] Decrypted: {"seq_no":1577,"data":{"name":"t_power","base_type":"boolean","value":0}}
W0421 20:05:36.474 hisense.py:695] Decrypted: {"seq_no":1578,"data":{}}
E0421 20:05:36.475 hisense.py:657] Failed to handle {'seq_no': 1578, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.638 hisense.py:695] Decrypted: {"seq_no":1579,"data":{}}
E0421 20:05:36.639 hisense.py:657] Failed to handle {'seq_no': 1579, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.714 hisense.py:695] Decrypted: {"seq_no":1580,"data":{"name":"t_sleep","base_type":"integer","value":0}}
W0421 20:05:36.777 hisense.py:695] Decrypted: {"seq_no":1581,"data":{}}
E0421 20:05:36.777 hisense.py:657] Failed to handle {'seq_no': 1581, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.854 hisense.py:695] Decrypted: {"seq_no":1582,"data":{}}
E0421 20:05:36.855 hisense.py:657] Failed to handle {'seq_no': 1582, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.915 hisense.py:695] Decrypted: {"seq_no":1583,"data":{}}
E0421 20:05:36.915 hisense.py:657] Failed to handle {'seq_no': 1583, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:36.975 hisense.py:695] Decrypted: {"seq_no":1584,"data":{}}
E0421 20:05:36.976 hisense.py:657] Failed to handle {'seq_no': 1584, 'data': {}}
Traceback (most recent call last):
File "/hisense/hisense.py", line 652, in property_update_handler
name = update['data']['name']
KeyError: 'name'
W0421 20:05:37.036 hisense.py:695] Decrypted: {"seq_no":1585,"data":{"name":"t_work_mode","base_type":"integer","value":0}}
W0421 20:05:37.102 hisense.py:695] Decrypted: {"seq_no":1586,"data":{"name":"t_control_value","base_type":"integer","value":3014674}}
Maybe decrypt is wrong?
I've added also one more field:
t_control_value: int = field(default=50, metadata={'base_type': 'integer', 'read_only': True})
but no idea what is it ;]
Which app are you using? They might be using a different set of keys. I've added an option to the cli to print out all the supported properties. Try running:
./query_cli.py --user [email protected] --passwd my_pass --app my_app --config config.json --properties True
My app is HiSMart LIfe
params looks like that: https://privatebin.2.cloud.mns.pl/?1da290dda4559efe#34SuKE3GIpEDwNJqvCre+QXbpZu2IQYNo6NtDsGZRoU=
But cant find nothink about temperature
It seams that the t_control_value is current temp. But dunno how to convert it to celcius unit. Its changing when current tem is changing.
You mean t_control_value is the temperature set to the AC? Which values are you seeing there? It might be a merge of multiple factors into a single integer. The environment temperature is in f_temp_in, which is available (both in the supported set, line 777, and in the log (returned 22, which has to be Celsius rather than Fahrenheit as in my AC).
no, t_control_value looks like current tem in the room. f_temp_in is the set one. And yes f_temp_in is celcius. t_control_value is the only one property that is changing during the day when room temperature is changing. But as I said before cant to understand how to read it in celcius or other unit.
Looking at the assets, it seems that it is indeed comprised of several values: wind_speed, power_on_off, mode, fast_heat_and_code, energy_saving, temperature, throttle_up_and_down, throttle_left_and_right, silent_mode, temperature_measure. I'm not sure how exactly (yet).
f_temp_in is read only, you cannot edit it. It really should be the room temperature. What you see in t_control_value changing during the day is likely the temperature_measure part. Try adjusting the AC by the remote, and see how t_control_value adjusts.
Well you're right. t_tem_in is temperature from the room. Dunno how I was looking at this before :o So now only one is missing is temp which is set.
Ok, I've got no idea how to decrypt this value. Nothing seams to be working ;( Maybe you will find something...
OK, finally got it. It's all stored inside JSON configuration files in the app. These are the bits encoding each value: 0-3 t_fan_speed 5 t_power 8-10 t_work_mode 12 t_temp_heatcold 14 t_eco 16-22 t_temp 24 t_fan_power 26 t_fan_leftright 28 t_fan_mute 30 t_temptype
Honestly I dont know how to implement this to decode t_control_value :D
Ok, now i get it ;] It looks that I forgot basics ;]
It seems I had it off by one, so it should really be:
1-4 t_fan_speed
6 t_power
9-11 t_work_mode
13 t_temp_heatcold
15 t_eco
17-23 t_temp
25 t_fan_power
27 t_fan_leftright
29 t_fan_mute
31 t_temptype
Yes I count from 0 ;]
OK, so now all I need is to integrate it with home assistant and all is done. You done excellent work! Thanks a lot!
One more, I'm trying pack this value to int, but what about missing bits? just 00 ? any other control properties not working for me so I guess that need to control it y this value.
Ok, I'm tried every way to set properties and no one is working ;( is there any way to control AC via this api?
Which value are you getting when querying t_control_value? Let's try to decrypt it. My guess is that you should just update the specific bits in the buffer that are relevant to what you'd like to change.
Yes I did this, but nothing changes in my AC. I tried other property and also changing bits in t_control_value, but there are no changes in AC. I enabled debug flag but there are no information written when I send update commands.
Only one I can manage is on/off
Can you attach here the value you're getting when querying t_control_value?
Like you did before, with the ...hisense.py:695] Decrypted:
...
Ofc, looks like that:
W0426 08:05:10.510 hisense.py:700] Decrypted: {"seq_no":1631,"data":{"name":"t_control_value","value":3014734}}
I wonder if ac needs 2 properties together to update properties , I mean t_work_mode and t_control_value when trying to set t_work_mode, like that;
D0426 07:55:55.747 hisense.py:688] Encrypting: {"seq_no": 46, "data": {"properties": [{"property": {"base_type": "integer", "name": "t_work_mode", "value": 2, "id": "voXUYS9k"}}, {"name": "t_control_value", ... }]}}
3014734
means:
t_fan_speed MEDIUM
t_power ON
t_work_mode FAN
t_temp_heatcold OFF
t_eco OFF
t_temp 23
t_fan_power OFF
t_fan_leftright OFF
t_fan_mute OFF
t_temptype CELSIUS
Try passing 2621518
, and it should set the temperature to 20
.
Passing 2622542
should both set the temperature to 20
and the work mode to COOL
.
I'm aware but nothing is changing in AC:
b-code@xps ~/workspace/shop-builder/matrix master curl -ik 'http://localhost:8888/hisense/command?property=t_control_value&value=2622542' ✔ 11362 11:50:34
HTTP/1.0 200 OK
Server: BaseHTTP/0.6 Python/3.7.5
Date: Sun, 26 Apr 2020 09:50:45 GMT
Content-type: application/json
{"queued commands": 1}% b-code@xps ~/workspace/shop-builder/matrix master curl -ik 'http://localhost:8888/hisense/status' ✔ 11363 11:50:45
HTTP/1.0 200 OK
Server: BaseHTTP/0.6 Python/3.7.5
Date: Sun, 26 Apr 2020 09:51:03 GMT
Content-type: application/json
{"f_electricity": 3, "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": 0, "f_power_display": true, "f_temp_in": 21.0, "f_voltage": 0, "t_backlight": "ON", "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": 0, "t_power": "ON", "t_run_mode": "OFF", "t_setmulti_value": null, "t_sleep": "STOP", "t_temp": 20, "t_temptype": "CELSIUS", "t_temp_eight": "OFF", "t_temp_heatcold": "OFF", "t_work_mode": "FAN", "t_control_value": 3014734}%
Just now I've observed in my hismart just after passing new t_control_value - it change for a bit of a sec, and then gets right back to its previous settings, but its' so quick that I can't observe more information... ;(
I might have finally got it. They have this thing called "enable bit" before each of the values (that also explains why there are bit skips). You need to toggle that bit in order for the change to kick in. 2688334 Would do the setting I mentioned above, for both COOL and 20 deg.