cdpuk / ha-bestway

Home Assistant integration for Bestway / Lay-Z-Spa hot tubs
MIT License
72 stars 19 forks source link

"Failed to Setup" Error #7

Closed BrettEBowman closed 1 year ago

BrettEBowman commented 1 year ago

I just got back to my house with the hot tub and tried to use the integration again. But it wasn't working. I've tried deleting, re-adding, etc., but still no go.

I can successfully login with the Bestway app. Also, if I select the EU API instead of the US API, I get an unknown login error, so I think that the integration is successfully logging in to the US Bestway API.

The errors in the log indicate that there is an error related to the USER_TOKEN_EXPIRY (see below).

2022-12-19` 15:59:37.884 INFO (MainThread) [homeassistant.setup] Setting up bestway
2022-12-19 15:59:37.884 INFO (MainThread) [homeassistant.setup] Setup of domain bestway took 0.0 seconds
2022-12-19 15:59:37.886 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry dale@b.com for bestway
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2022-12-19 16:00:58.675 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry dale@b.com for bestway
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2022-12-19 16:02:27.986 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry dale@b.com for bestway
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2022-12-19 16:04:19.451 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry dale@b.com for bestway
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
BrettEBowman commented 1 year ago

Downgrading to v1.1.0 works fine.

cdpuk commented 1 year ago

Should have been fixed as part of #8 and released in v1.1.2. You will need to upgrade, then delete and re-add the account in HA.

BrettEBowman commented 1 year ago

v1.1.2 does indeed seem to have solved the problem for me. Thanks!