deiger / AirCon

Scripts for controlling Air Conditioners, e.g. with HiSense modules.
GNU General Public License v3.0
214 stars 58 forks source link

After some time AirCon just loses connection to my two ACs #130

Open trenoduro opened 3 years ago

trenoduro commented 3 years ago

I have aircon running in a docker container. After less than a day i have to manually restart it because it just doesn't work anymore, like it just disconnects from my two ACs.

Is this something anyone else encountered?

deiger commented 3 years ago

For me it works continuously. Do you have log messages that indicate the issue?

trenoduro commented 3 years ago
I0915 05:07:44.595  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:44 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:44.633  query_handlers.py:139] Decrypted: {"seq_no":66,"data":{"name":"f_filterclean","base_type":"boolean","value":0}}
I0915 05:07:44.634  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:44 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4476&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:44.643  query_handlers.py:139] Decrypted: {"seq_no":21,"data":{"name":"f_filterclean","base_type":"boolean","value":0}}
I0915 05:07:44.645  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:44 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4476&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:44.659  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:44 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:44.662  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:44 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:44.692  query_handlers.py:139] Decrypted: {"seq_no":67,"data":{"name":"f_humidity","base_type":"integer","value":0}}
I0915 05:07:44.693  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:44 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4477&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:44.695  query_handlers.py:139] Decrypted: {"seq_no":22,"data":{"name":"f_humidity","base_type":"integer","value":0}}
I0915 05:07:44.696  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:44 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4477&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:44.793  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:44 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:44.795  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:44 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:44.827  query_handlers.py:139] Decrypted: {"seq_no":23,"data":{"name":"f_power_display","base_type":"integer","value":0}}
I0915 05:07:44.829  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:44 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4478&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:45.591  query_handlers.py:139] Decrypted: {"seq_no":68,"data":{"name":"f_power_display","base_type":"integer","value":0}}
I0915 05:07:45.592  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:45 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4478&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:45.599  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:45 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:45.605  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:45 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:45.641  query_handlers.py:139] Decrypted: {"seq_no":24,"data":{"name":"f_temp_in","base_type":"integer","value":26}}
I0915 05:07:45.643  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:45 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4479&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:45.644  query_handlers.py:139] Decrypted: {"seq_no":69,"data":{"name":"f_temp_in","base_type":"integer","value":26}}
I0915 05:07:45.646  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:45 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4479&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:45.767  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:45 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
E0915 05:07:45.772  notifier.py:121] Failed to connect to 192.168.1.102, maybe it is offline?
I0915 05:07:46.382  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:46 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:46.383  query_handlers.py:139] Decrypted: {"seq_no":70,"data":{}}
I0915 05:07:46.384  query_handlers.py:82] Unsupported update message = 70
I0915 05:07:46.385  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:46 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4480&status=404 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:46.616  query_handlers.py:139] Decrypted: {"seq_no":25,"data":{}}
I0915 05:07:46.616  query_handlers.py:82] Unsupported update message = 25
I0915 05:07:46.617  web_log.py:206] 192.168.1.102 [15/Sep/2021:05:07:46 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4480&status=404 HTTP/1.1" 200 149 "-" "-"
I0915 05:07:46.686  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:46 +0000] "GET /local_lan/commands.json HTTP/1.1" 200 481 "-" "-"
I0915 05:07:47.589  query_handlers.py:139] Decrypted: {"seq_no":71,"data":{"name":"t_backlight","base_type":"boolean","value":0}}
I0915 05:07:47.590  web_log.py:206] 192.168.1.103 [15/Sep/2021:05:07:47 +0000] "POST /local_lan/property/datapoint.json?cmd_id=4481&status=200 HTTP/1.1" 200 149 "-" "-"
I0915 08:52:37.838  mqtt_client.py:37] MQTT message Topic: hisense_ac/ca2c4fa21032/t_work_mode/command, Payload b'off'
I0915 08:54:08.527  mqtt_client.py:37] MQTT message Topic: hisense_ac/ca2c4fa21032/t_work_mode/command, Payload b'off'
I0915 08:54:33.074  mqtt_client.py:37] MQTT message Topic: hisense_ac/ca2c4f954436/t_power/command, Payload b'ON'
I0915 08:54:34.077  mqtt_client.py:37] MQTT message Topic: hisense_ac/ca2c4f954436/t_work_mode/command, Payload b'cool'
I0915 08:54:45.093  mqtt_client.py:37] MQTT message Topic: hisense_ac/ca2c4f954436/t_power/command, Payload b'ON'
I0915 08:54:46.096  mqtt_client.py:37] MQTT message Topic: hisense_ac/ca2c4f954436/t_work_mode/command, Payload b'cool'

Those are the last lines of log where it's clear when it just stops working.

I'm attaching a pic with some comments Log

rotem925 commented 3 years ago

I have the same issue. I think I opened an issue regarding this as well. My solution was to restart the container every day at night with automation. Though that's not really a solution.

ninokotur commented 2 years ago

I have same issue, restarting HA addon/container makes it running again, but its not good when having automation running on schedule...

pbvdven commented 2 years ago

Same here aircon hang’s after day but I noticed that it was because of the auto backup at night of the addon after that it stops working when i removed the addon from auto backup problem is mostly fixed from everyday it now hangs just once of twice a week 😅

pbabilas commented 2 years ago

I've got problem with hangs the connection, says connection lost:

D0309 21:25:38.100  notifier.py:112] [KeepAlive] Sending POST http://192.168.1.104/local_reg.json {"local_reg": {"ip": "192.168.1.166", "notify": 1, "port": 8888, "uri": "/local_lan"}}
E0309 21:25:38.161  notifier.py:121] Failed to connect to 192.168.1.104, maybe it is offline?

Restarting ha (OS version), restarting integration, restarting whole VM not changing anything, also deleted config file and restart app but nothing changes. :( Only what helps is to restart wifi module with power off, but besides connection problem in HA mobile app is working fine so its not a network problem :(

pbvdven commented 2 years ago

It could be the way the aircon addon works it fetches the ip i think only on setup. If you have not set a dedicated ip for you aircon wlan adapter it maybe getting en other ip and there for the addon says offline. I had a problem despite having set a dedicated ip the isp router was buggy and sometimes would giving it an other ip then the dedicated one when the router reboot. Disconnect/connect the wlan adapter would set it straight after the router reboots. The fglair app doesn't need this to function properly so there for you can still control it true fglair app

trenoduro commented 2 years ago

It could be the way the aircon addon works it fetches the ip i think only on setup. If you have not set a dedicated ip for you aircon wlan adapter it maybe getting en other ip and there for the addon says offline. I had a problem despite having set a dedicated ip the isp router was buggy and sometimes would giving it an other ip then the dedicated one when the router reboot. Disconnect/connect the wlan adapter would set it straight after the router reboots. The fglair app doesn't need this to function properly so there for you can still control it true fglair app

I have dedicated ips but the problem persists

pbabilas commented 2 years ago

It could be the way the aircon addon works it fetches the ip i think only on setup. If you have not set a dedicated ip for you aircon wlan adapter it maybe getting en other ip and there for the addon says offline. I had a problem despite having set a dedicated ip the isp router was buggy and sometimes would giving it an other ip then the dedicated one when the router reboot. Disconnect/connect the wlan adapter would set it straight after the router reboots. The fglair app doesn't need this to function properly so there for you can still control it true fglair app

Ip is the same. Ping is working fine from vm, maybe token expired or device blocking other connections after some time?

pbvdven commented 2 years ago

It could be the way the aircon addon works it fetches the ip i think only on setup. If you have not set a dedicated ip for you aircon wlan adapter it maybe getting en other ip and there for the addon says offline. I had a problem despite having set a dedicated ip the isp router was buggy and sometimes would giving it an other ip then the dedicated one when the router reboot. Disconnect/connect the wlan adapter would set it straight after the router reboots. The fglair app doesn't need this to function properly so there for you can still control it true fglair app

Ip is the same. Ping is working fine from vm, maybe token expired or device blocking other connections after some time?

i dont know but it seems unlikely that it would be an token issue because then we should all have that problem not? i can only share my experience with the addon. i had that issue with the routers DHCP and i have setup an automations too keep things running in HA witch reboots the addon after HA started and every morning at 5:30 since i applied that i never had an issue with the addon anymore.

pbabilas commented 2 years ago

here's how it works:

(☸ |dev:pb-ratelimit) b-code@bcode-XPS  ~/Pobrane/gwakeonlan-0.7.0  ping 192.168.1.104
PING 192.168.1.104 (192.168.1.104) 56(84) bytes of data.
64 bytes from 192.168.1.104: icmp_seq=1 ttl=255 time=66.1 ms
64 bytes from 192.168.1.104: icmp_seq=2 ttl=255 time=82.1 ms
64 bytes from 192.168.1.104: icmp_seq=3 ttl=255 time=13.1 ms
64 bytes from 192.168.1.104: icmp_seq=4 ttl=255 time=3.55 ms
^C
--- 192.168.1.104 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 3.548/41.223/82.122/33.555 ms
(☸ |dev:pb-ratelimit) b-code@bcode-XPS  ~/Pobrane/gwakeonlan-0.7.0  ping 192.168.1.104
PING 192.168.1.104 (192.168.1.104) 56(84) bytes of data.
From 192.168.1.145 icmp_seq=1 Destination Host Unreachable
From 192.168.1.145 icmp_seq=2 Destination Host Unreachable
From 192.168.1.145 icmp_seq=3 Destination Host Unreachable
From 192.168.1.145 icmp_seq=4 Destination Host Unreachable
From 192.168.1.145 icmp_seq=5 Destination Host Unreachable
From 192.168.1.145 icmp_seq=6 Destination Host Unreachable
^C
--- 192.168.1.104 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6146ms

First ping is right after hisense hard restart at evening - and integration works, second one is at morning where host is offline, ping also is not working. Any idea how it;s possible ? ;)

(☸ |dev:pb-ratelimit) b-code@bcode-XPS  ~/Pobrane/gwakeonlan-0.7.0  nmap 192.168.1.104
Starting Nmap 7.80 ( https://nmap.org ) at 2022-03-14 06:56 CET
Nmap scan report for 192.168.1.104
Host is up (0.040s latency).
All 1000 scanned ports on 192.168.1.104 are closed

Nmap done: 1 IP address (1 host up) scanned in 0.68 seconds

host is up and no port is open, but the same was after restart and integration was working.

pbabilas commented 2 years ago

Hmm now ping is working again, despite not working integration...

pbabilas commented 2 years ago

I've tried to add ha restarting schedule but it does not help, but no i"ve got other logs:

D0318 07:21:09.380  notifier.py:112] [KeepAlive] Sending PUT http://192.168.1.104/local_reg.json {"local_reg": {"ip": "192.168.1.166", "notify": 0, "port": 8888, "uri": "/local_lan"}}
D0318 07:21:09.500  notifier.py:85] [KeepAlive] Waiting for notification or timeout
D0318 07:21:19.501  notifier.py:112] [KeepAlive] Sending PUT http://192.168.1.104/local_reg.json {"local_reg": {"ip": "192.168.1.166", "notify": 0, "port": 8888, "uri": "/local_lan"}}
D0318 07:21:19.530  notifier.py:85] [KeepAlive] Waiting for notification or timeout
D0318 07:21:29.531  notifier.py:112] [KeepAlive] Sending PUT http://192.168.1.104/local_reg.json {"local_reg": {"ip": "192.168.1.166", "notify": 0, "port": 8888, "uri": "/local_lan"}}
D0318 07:21:29.659  notifier.py:85] [KeepAlive] Waiting for notification or timeout
D0318 07:21:39.661  notifier.py:112] [KeepAlive] Sending PUT http://192.168.1.104/local_reg.json {"local_reg": {"ip": "192.168.1.166", "notify": 0, "port": 8888, "uri": "/local_lan"}}
D0318 07:21:39.790  notifier.py:85] [KeepAlive] Waiting for notification or timeout

maybe my configuration is wrong? I've got installed integration and mqtt broker: ha

mqtt has config:

certfile: fullchain.pem
customize:
  active: false
  folder: mosquitto
keyfile: privkey.pem
logins:
  - username: ****
    password: ****
require_certificate: false

aircon conf:

log_level: DEBUG
mqtt_host: 127.0.0.1
mqtt_user: ****
mqtt_pass: ****
port: 8888
app:
  - username: ****
    password: ****
    code: hisense-eu

Any idea ?

pbabilas commented 2 years ago

Anyone? ^^

pbabilas commented 2 years ago

ok, if anyone has that problem, i've managed it to work. Just deleted all services with aircon, mqtt, mqttdiscovery, restarted all added all again and from almost 2 days still working fine! Hope will stay that way ;]!

albertromkes commented 2 years ago

I had / have the same problem (although I only have 1 airco). After some time (couple of days / weeks) the integration just stops working. I've tried everything. Only thing that worked was removing everything, delete the device from the app and then install the addon again and follow the instructions (add it via the app, etc...). Today I tried this: turn on the airco with the remote. Restart the AddOn in HA. And voila: it's working again. That could be an 'easy' fix, but it still doesn't fix the underlying issue. But I don't know (yet) what the real cause is. Maybe the developer of this integration now has a clue as where to look / test.

Anyway: hopefully this helps someone.

FabioEight commented 2 years ago

Hi there, same issue reported also on #161

FabioEight commented 2 years ago

Hello, I tried to uninstall the addon, remove the hisense config folder and then restart but still:


                              IP address: 192.168.1.51
                              lanip_key: ###
                              lanip_key_id: ###
Device Cucina has:
                              IP address: 192.168.1.52
                              lanip_key: ###
                              lanip_key_id: ###
Device Soggiorno has:
                              IP address: 192.168.1.53
                              lanip_key: ###
                              lanip_key_id: ###
E0729 16:39:45.184  notifier.py:121] Failed to connect to 192.168.1.52, maybe it is offline?
E0729 16:39:45.185  notifier.py:121] Failed to connect to 192.168.1.51, maybe it is offline?
E0729 16:39:45.187  notifier.py:121] Failed to connect to 192.168.1.53, maybe it is offline?
E0729 16:39:46.205  notifier.py:121] Failed to connect to 192.168.1.52, maybe it is offline?
E0729 16:39:46.308  notifier.py:121] Failed to connect to 192.168.1.53, maybe it is offline?```

> I had / have the same problem (although I only have 1 airco). After some time (couple of days / weeks) the integration just stops working. I've tried everything. Only thing that worked was removing everything, delete the device from the app and then install the addon again and follow the instructions (add it via the app, etc...). Today I tried this: turn on the airco with the remote. Restart the AddOn in HA. And voila: it's working again. That could be an 'easy' fix, but it still doesn't fix the underlying issue. But I don't know (yet) what the real cause is. Maybe the developer of this integration now has a clue as where to look / test.
> 
> Anyway: hopefully this helps someone.

I also tried this by turning on the AC via HiSense app and then restarted the addon: nothing changes! Did you found any workaround for this? Thanks!
leandroalbero commented 2 years ago

Happened to me a couple of times too, neither rebooting nor reinstalling fixed it. The only times it has fixed by itself has been after a HA update. All of my 6 AC's failed at the same time and are reachable on my local network.

FabioEight commented 2 years ago

Last time I detected this issue, I had to remove the ACs from HiSense app and re-pair them. Then, I removed the old AirCon config, restarted it and everything was back. I think it' something has changed on the HiSense's APIs and this is not properly handled by AirCon.

leandroalbero commented 2 years ago

What I don't understand is why it works sometimes and sometimes not... If they changed something in the API side it should not work at all, shouldn't it?

FabioEight commented 2 years ago

Indeed, maybe there' some key rotation done every 2-3 months for example..

pbabilas commented 2 years ago

for me only one that works is power off the AC, and then start it again. when problem occurs my wifi module cant ping over eth. after restart ping works and connection is working.

leandroalbero commented 2 years ago

I can still control the ACs via the other app when HA stops working, so I guess they’re still connected to the internet. Must be a problem with the API as @FabioEight mentioned

FabioEight commented 2 years ago

for me only one that works is power off the AC, and then start it again. when problem occurs my wifi module cant ping over eth. after restart ping works and connection is working.

I think it's different then: when I lose control via HA, I'm still able to use HiSense app and to ping the devices.

pbabilas commented 2 years ago

for me only one that works is power off the AC, and then start it again. when problem occurs my wifi module cant ping over eth. after restart ping works and connection is working.

I think it's different then: when I lose control via HA, I'm still able to use HiSense app and to ping the devices.

It's strange, ping is not working but hisense app does ;)

FabioEight commented 1 year ago

Hello, any update on this?

emoses commented 1 year ago

I'm seeing the same problem, running independently in a docker container. I have 4 FGLair wifi units. Seems to work fine for about 10-20hrs then becomes non-responsive. I still see it accepting mqtt commands in the logs and the webserver is running (GET /hisense/status gives me a status) but no connection to the ACs. My guess is something is going on with the Notifier, either a deadlock or commands are backing up in the queue?

I might try to add some telemetry and see if I can figure out what's going on, I guess in the meantime a restart every few hours should do it.