apetrycki/daikinskyport

Fails to Load when starting

Closed this issue · 7 comments

unc2k3 commented

Hello,

I've had an issue popup where the integration will not load unless I go into the integration settings and click Reload. This seems to happen every morning and I think once or twice throughout the day (but don't quote me on that). I'm running the latest version and my system details are:

Home Assistant 2023.10.1
Supervisor 2023.10.0
Operating System 10.5
Frontend 20231005.0 - latest

Logger: homeassistant.config_entries
Source: config_entries.py:399
First occurred: October 9, 2023 at 8:20:06 PM (2 occurrences)
Last logged: 9:16:23 AM

Error setting up entry Daikin for daikinskyport
Traceback (most recent call last):
File "/config/custom_components/daikinskyport/init.py", line 161, in _async_update_data
current = await self.hass.async_add_executor_job(self.daikinskyport.update)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/daikinskyport.py", line 258, in update
result = self.get_thermostats()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/daikinskyport.py", line 156, in get_thermostats
thermostat_info = self.get_thermostat_info(thermostat['id'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/daikinskyport.py", line 203, in get_thermostat_info
raise ExpiredTokenError ("Daikin Skyport token expired")
custom_components.daikinskyport.daikinskyport.ExpiredTokenError: Daikin Skyport token expired

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/init.py", line 79, in async_setup_entry
await coordinator._async_update_data()
File "/config/custom_components/daikinskyport/init.py", line 165, in _async_update_data
await self.hass.async_add_executor_job(self.daikinskyport.update)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/daikinskyport.py", line 258, in update
result = self.get_thermostats()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/daikinskyport.py", line 156, in get_thermostats
thermostat_info = self.get_thermostat_info(thermostat['id'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikinskyport/daikinskyport.py", line 203, in get_thermostat_info
raise ExpiredTokenError ("Daikin Skyport token expired")
custom_components.daikinskyport.daikinskyport.ExpiredTokenError: Daikin Skyport token expired

Have you tried re-downloading the integration? This exception should get caught by _async_update_data and request new tokens. If that doesn't work, please set your logging to debug and capture all daikinskyport messages.

unc2k3 commented

It looks like something's not right with your system or connection. You should never get an error when requesting tokens with your username and password. Did you type your email and password correctly? The integration can't recover from multiple 400 errors. That's not normal. Also, if you set your logging to debug, it'll give me more information.

unc2k3 commented

Hmm, that's interesting. Someone else had that issue and provided a patch to check if the thermostat was offline, but they were still able to log in and retrieve tokens. It's just when it went to retrieve the thermostat data, there was no data and it returned an error code and a message that the device was offline. I think they had multiple thermostats, though, so maybe that's why.

unc2k3 commented

I added some more debug output so hopefully I can capture what is happening when a thermostat is offline. Unfortunately I only have one, so I may need someone to try out any changes I make to see if it works properly with multiple thermostats.