sampsyo / hass-smartthinq

Home Assistant component for LG SmartThinQ HVAC devices
MIT License
282 stars 98 forks source link

The integration stops working after some time and requires a restart of Home assistant #50

Open photonforge opened 4 years ago

photonforge commented 4 years ago

I have an air conditioner KS-Q18PWXD integrated via HACS. All functions are working. But after sometime, (usually 6-12 hours), the device stops getting recognised in home assistant and is stuck at the last setting before it lost connectivity. Turning the AC off and on using the remote control doesn't help, neither does disconnecting the AC from the mains and plugging it back in. But if i restart home assistant, the AC gets recognised, and the cycle repeats. Because of this issue i've had to restart home assistant at least once a day, just to control the AC via home assistant.

Is there any solution for this issue? Thanks in advance.

sampsyo commented 4 years ago

Huh, that's always annoying! These issues are hard to diagnose, but the place to start is looking at your Home Assistant log. Anything interesting in there?

photonforge commented 4 years ago

Huh, that's always annoying! These issues are hard to diagnose, but the place to start is looking at your Home Assistant log. Anything interesting in there?

Thanks for the quick response! I have put the logger in debug and waiting for the device to become undetected. will get back with the log once it happens.

photonforge commented 4 years ago

Huh, that's always annoying! These issues are hard to diagnose, but the place to start is looking at your Home Assistant log. Anything interesting in there?

Heres the log when the device doesn't get detected after a restart:

2020-05-13 19:25:27 ERROR (MainThread) [homeassistant.setup] Error during setup of component smartthinq Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component component.setup, hass, processed_config # type: ignore File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/smartthinq/__init__.py", line 69, in setup client = wideq.Client.from_token(refresh_token, region, language) File "/usr/local/lib/python3.7/site-packages/wideq/client.py", line 220, in from_token client.refresh() File "/usr/local/lib/python3.7/site-packages/wideq/client.py", line 203, in refresh self._auth = self.auth.refresh() File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 282, in refresh self.refresh_token) File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 231, in refresh_auth raise TokenError()

And here's another instance with the same issue:

2020-05-14 00:46:59 ERROR (SyncWorker_11) [custom_components.smartthinq.climate] SmartThinQ device not available: AIR CONDITIONER

Thanks

photonforge commented 4 years ago

After another restart it gets detected, and stays so for some hours before becoming unavailable again, with this log:

2020-05-14 12:06:35 WARNING (MainThread) [homeassistant.components.climate] Updating smartthinq climate took longer than the scheduled update interval 0:01:00

Thanks

sampsyo commented 4 years ago

Hmm, that's odd. The first error (about a token) just indicates that the authentication didn't work—but I don't know why that would be the case if it works when you restart HomeAssistant.

The second error is something I get myself pretty frequently—and it doesn't go away when I restart HomeAssistant. For me at least, it's on the LG server side, or perhaps even on the device itself—the device just disconnects entirely and nothing can contact it, not even the official LG iOS app. The only fix I have found to work is to unplug and replug the little WiFi module box inside my AC unit. 🤷

photonforge commented 4 years ago

One or two restarts of the home assistant always gets the device detectable again, the third log (took longer than the scheduled update...) happens after a few hours when it goes off the grid. even then, Im able to ping the AC, so the AC wifi does not disconnect from the network.

Sometimes one restart doesn't fix the issue, when I get the 1st or 2nd log issue. however another restart fixes it and the AC is detected again.

Unplugging and replugging the power to the AC doesn't work if it was not detectable in home assistant in the first place.

Thanks.