AirCon icon indicating copy to clipboard operation
AirCon copied to clipboard

frequent disconnection

Open wifi75 opened this issue 4 years ago • 46 comments

I don't understand why my two climate always disconnects, or perhaps the service goes into lockout. while if I use the application from a smartphone it works. maybe the service for two climates is not working well? all climate have a static ip and the ping it is ok! I don't understand how to solve!

image

wifi75 avatar Jun 02 '20 08:06 wifi75

image

wifi75 avatar Jun 02 '20 09:06 wifi75

if I stop all service and start manual commad ./hisense.py --port 8888 --ip 192.168.1.19 --config config_studio.json --mqtt_host localhost --mqtt_user mqtt_user:pass --mqtt_topic hisense_studio after some command sent by the remote control on HA it doesn't answer anymore ... I believe there are still problems with hisense.py code

wifi75 avatar Jun 02 '20 11:06 wifi75

Did you rollback your change of _STATUS_UPDATE_INTERVAL? You might be swamping the AC's processor.

deiger avatar Jun 02 '20 11:06 deiger

Did you rollback your change of _STATUS_UPDATE_INTERVAL? You might be swamping the AC's processor.

I try...

wifi75 avatar Jun 02 '20 11:06 wifi75

I put this for now... https://github.com/deiger/AirCon/tree/403dd3e9f2984d5e7fc1136a276913830e90cfbb

I'm on testing

wifi75 avatar Jun 02 '20 12:06 wifi75

Same problem...not work...

wifi75 avatar Jun 02 '20 13:06 wifi75

Can you paste the syslog in Gist?

deiger avatar Jun 02 '20 13:06 deiger

Can you paste the syslog in Gist?

yes Sir, see below https://gist.github.com/wifi75/d8943bd48951e9e70f90417b08b347ef

wifi75 avatar Jun 02 '20 13:06 wifi75

I don't know why but the system can't work fine... now the service does not respond image

wifi75 avatar Jun 04 '20 07:06 wifi75

I've changed the code to retry the connection if the A/C resets, please try it out. Note that you'll need to first run pip3.7 install retry.

deiger avatar Jun 04 '20 12:06 deiger

@deiger thank you for reply, I have installad last Hisense.py and also pip3.7 install dataclasses_json paho-mqtt pycryptodome retry, now no update status, and also in Mqtt broker there aren't any data

same problem with manual command: for example: (service stopped before) ./hisense.py --port 8888 --ip 192.168.1.18 --config config_studio.json --mqtt_host localhost --mqtt_user mqtt_user:passw--mqtt_topic hisense_studio

image

image

wifi75 avatar Jun 04 '20 14:06 wifi75

The data in status of limited. What appears in syslog?

deiger avatar Jun 04 '20 14:06 deiger

@deiger

Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: message repeated 2 times: [ 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 -] Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:44:59 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:44:59] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:45:00 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:45:00] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:45:00 ubuntu-server python3[7429]: 192.168.1.18 - - [04/Jun/2020 16:45:00] "POST /local_lan/key_exchange.json HTTP/1.1" 200 - Jun 4 16:45:00 ubuntu-server python3[7430]: 192.168.1.19 - - [04/Jun/2020 16:45:00] "POST /local_lan/key_exchange.json HTTP/1.1" 200 -

wifi75 avatar Jun 04 '20 14:06 wifi75

Hmm.. That doesn't make sense... Could you please try running the script with --log_level DEBUG

deiger avatar Jun 04 '20 15:06 deiger

@deiger

after send command: ./hisense.py --port 8888 --ip 192.168.1.18 --config config_studio.json --mqtt_host localhost --mqtt_user mqtt_user:passw --mqtt_topic hisense_studio --log_level DEBUG

image

wifi75 avatar Jun 04 '20 16:06 wifi75

Is that /var/log/syslog?? Nothing else shows up?

deiger avatar Jun 04 '20 16:06 deiger

@deiger

Jun  4 18:40:33 ubuntu-server D0604 18:40:33.968  hisense.py:669] Response:#012{"random_2": "UEUk5jFGnv2CmjIF", "time_2": 582636108133}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.028  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.037  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"ZKWfOEsaHTR0jRE1","time_1":25702312015912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.038  hisense.py:669] Response:#012{"random_2": "8KwFWJyvlwiqH18U", "time_2": 582706585387}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.101  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.111  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"Y7IZM9y5HzdX5hs0","time_1":25702319315912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.112  hisense.py:669] Response:#012{"random_2": "V0xiRgNUmpHXapRX", "time_2": 582780344141}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.175  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.200  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.209  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"EEkpLqcgLi9Oe68s","time_1":25702329215912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.210  hisense.py:669] Response:#012{"random_2": "6tggVel3BY5maXxy", "time_2": 582878910541}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.273  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.281  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"la87LMFCOyYsaDEm","time_1":25702336515912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.282  hisense.py:669] Response:#012{"random_2": "WInaqZJVfBkWSxXN", "time_2": 582950838896}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.344  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.355  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"hh44I/BLvSel8Dkl","time_1":25702343715912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.357  hisense.py:669] Response:#012{"random_2": "CIGm6TGcKkwSjeGu", "time_2": 583025047628}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.419  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.428  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"nxpAJ3UHwhto8s4a","time_1":25702351115912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.429  hisense.py:669] Response:#012{"random_2": "ugKHUixrMeNFW2lx", "time_2": 583097609893}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.491  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.500  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"HfzGHJPGwBipgcQb","time_1":25702358315912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.501  hisense.py:669] Response:#012{"random_2": "PmZrRNYYxh5o6DG6", "time_2": 583169756342}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.565  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.590  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.600  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"DvBZER/vXheA59gU","time_1":25702368215912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.601  hisense.py:669] Response:#012{"random_2": "fjAcA26iLvJykoKb", "time_2": 583269454429}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.662  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.672  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"CAjiF+dM4QojO2wL","time_1":25702375515912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.673  hisense.py:669] Response:#012{"random_2": "8uBmy7af5bn9Ykyf", "time_2": 583342045753}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.735  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.743  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"VPnmDRZC4AitY+UL","time_1":25702382615912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.744  hisense.py:669] Response:#012{"random_2": "xM3cI8kIe80ri13O", "time_2": 583412496190}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.806  hisense.py:438] POST /local_reg.json {"local_reg": {"ip": "192.168.1.52", "notify": 1, "port": 8888, "uri": "/local_lan"}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.816  hisense.py:536] POST request,#012Path: /local_lan/key_exchange.json#012Headers:#012Host: 192.168.1.52#012Content-Length: 105#012Content-Type: application/json#012#012#012#012Body:#012{"key_exchange":{"ver":1,"random_1":"DD5/CdHufQSBgHAF","time_1":25702389815912,"proto":1,"key_id":58205}}
Jun  4 18:40:34 ubuntu-server D0604 18:40:34.818  hisense.py:669] Response:#012{"random_2": "wPYwNeGog464wKBO", "time_2": 583486131827}

wifi75 avatar Jun 04 '20 16:06 wifi75

OK, found the issue, try downloading again.

deiger avatar Jun 04 '20 17:06 deiger

@deiger You are the best! for now it work.... i test and I inform you tomorrow

wifi75 avatar Jun 04 '20 19:06 wifi75

@deiger still some small problems This morning I tryed to switch on cliam by Home assistant then I used remote controll for change mode ecc ecc after few second i send status command see below: image

wifi75 avatar Jun 05 '20 07:06 wifi75

Connection reset error is a server error, whereby the server drops the connection. I'm not sure why it happened, usually this has to do with the server suspecting the client is overloading it. That's why I added an exponential back off, up to 20sec. Does the error list eventually end? Also, did you revert the change suggested in the previous thread? This could definitely be a cause for this.

deiger avatar Jun 05 '20 10:06 deiger

sure, I used your latest fix in hisense.py.

ps. want I must revert?

wifi75 avatar Jun 05 '20 10:06 wifi75

It was suggested in #20 to change _STATUS_UPDATE_INTERVAL, please leave it at 600. I'll see how I can rate-limit the keep alive calls.

deiger avatar Jun 05 '20 14:06 deiger

It was suggested in #20 to change _STATUS_UPDATE_INTERVAL, please leave it at 600. I'll see how I can rate-limit the keep alive calls.

Sure i leave it at 600! and I test it... @ck007max question; the temperature slider is still not working right?

wifi75 avatar Jun 05 '20 14:06 wifi75

my temperature slider works, but with the latest version of hisense.py I have problems, so I use the previous version with update interval time sets to 60 secs.

ck007max avatar Jun 06 '20 10:06 ck007max

@ck007max What is wrong with the latest version?

deiger avatar Jun 06 '20 11:06 deiger

My services don't start: cameretta.service - Hisense A/C server cameretta Loaded: loaded (/lib/systemd/system/cameretta.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2020-06-06 16:38:55 CEST; 1h 12min ago Process: 44347 ExecStart=/usr/bin/python3 -u hisense.py --port 8888 --ip 192.168.1.145 --config cameretta.json --mqtt_host 192.16> Main PID: 44347 (code=exited, status=1/FAILURE)

giu 06 16:38:55 Hassio systemd[1]: cameretta.service: Scheduled restart job, restart counter is at 5. giu 06 16:38:55 Hassio systemd[1]: Stopped Hisense A/C server cameretta. giu 06 16:38:55 Hassio systemd[1]: cameretta.service: Start request repeated too quickly. giu 06 16:38:55 Hassio systemd[1]: cameretta.service: Failed with result 'exit-code'. giu 06 16:38:55 Hassio systemd[1]: Failed to start Hisense A/C server cameretta.

Why? I followed your readme file. If I launch the scritp in the usr/lib/hisense folder all is ok, but If I launch the services, they don't start. With the previous version (2 june) I hadn't problems. Where can I find the previous script?

ck007max avatar Jun 06 '20 15:06 ck007max

Did you pip3 install retry? I added a retry mechanism to handle the connection reset issue.

deiger avatar Jun 06 '20 18:06 deiger

I've understood the problem. I have to install retry with sudo command.

ck007max avatar Jun 06 '20 18:06 ck007max

@deiger is it possible to disable t set in dry mode in your script? Because in my AC model in dry mode is not possibile set temperature. In dry mode I have two lines on the AC display and with the remote I can change the values from -7 to +7 (no temperature). So I ask you if in your script in dry mode is possible to exclude t set. I try to change the temperature with your script and nothing happens. If I use the HiSense official app is the same, you can't change the temp in dry mode. Thanks

ck007max avatar Jun 07 '20 08:06 ck007max