Hive-Custom-Component icon indicating copy to clipboard operation
Hive-Custom-Component copied to clipboard

[BUG]

Open wilfchun opened this issue 11 months ago • 1 comments

Describe the bug Hive fails to set up

To Reproduce Steps to reproduce the behaviour:

  1. Hive discovered on network.
  2. Add integration
  3. Enter account details
  4. Enter 2fa
  5. integration says failed to set up

Expected behaviour set up integration and added hive smart thermostat device

Screenshots

Logger: homeassistant.config_entries
Source: config_entries.py:640
First occurred: 19:39:33 (1 occurrences)
Last logged: 19:39:33

Error setting up entry [email protected] for hive
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/apyhiveapi/api/hive_auth_async.py", line 548, in refresh_token
    result = await self.loop.run_in_executor(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.13/site-packages/botocore/client.py", line 569, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/botocore/client.py", line 1023, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.NotAuthorizedException: An error occurred (NotAuthorizedException) when calling the InitiateAuth operation: Invalid Refresh Token.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hive/__init__.py", line 89, in async_setup_entry
  File "/usr/local/lib/python3.13/site-packages/apyhiveapi/session.py", line 502, in startSession
    await self.getDevices("No_ID")
  File "/usr/local/lib/python3.13/site-packages/apyhiveapi/session.py", line 425, in getDevices
    await self.hiveRefreshTokens()
  File "/usr/local/lib/python3.13/site-packages/apyhiveapi/session.py", line 304, in hiveRefreshTokens
    result = await self.auth.refresh_token(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self.tokens.tokenData["refreshToken"]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/apyhiveapi/api/hive_auth_async.py", line 562, in refresh_token
    raise HiveInvalid2FACode from err
apyhiveapi.helper.hive_exceptions.HiveInvalid2FACode

Desktop (please complete the following information):

  • HA OS running on RP4

Additional context I am a secondary user on the account, my landlord remains the primary user

wilfchun avatar Feb 03 '25 19:02 wilfchun

I am getting this also after having had Hive successfully working for some time - this just suddenly stopped.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:960
First occurred: 27 February 2025 at 18:04:35 (24230 occurrences)
Last logged: 1 March 2025 at 16:31:03

Update for binary_sensor.hive_hub_status fails
Update for climate.thermostat_2 fails
Update for switch.thermostat_2_heat_on_demand fails
Update for water_heater.thermostat_2 fails

Preceded by this:

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:234
First occurred: 25 February 2025 at 15:28:37 (5 occurrences)
Last logged: 25 February 2025 at 15:28:37


Detected code that calls async_forward_entry_setup for integration hive with title: [email protected] and entry_id: c9c4d1b1d2178dcc33d62086b6fd9d5f, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. T**his will stop working in Home Assistant 2025.1,** **please report this issue**

(my bold)

I am guessing someone else has probably done so but just in case.

I am using: 2025.1.0 version of this component on Generic x86-64 PC

## System Information

version | core-2025.1.4
-- | --
installation_type | Home Assistant OS
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.13.1
os_name | Linux
os_version | 6.6.73-haos
arch | x86_64
timezone | Europe/London
config_dir | /config

<details><summary>Home Assistant Community Store</summary>

GitHub API | ok
-- | --
GitHub Content | ok
GitHub Web | ok
HACS Data | ok
GitHub API Calls Remaining | 4994
Installed Version | 2.0.5
Stage | running
Available Repositories | 1566
Downloaded Repositories | 27

</details>

<details><summary>Home Assistant Cloud</summary>

logged_in | false
-- | --
can_reach_cert_server | ok
can_reach_cloud_auth | ok
can_reach_cloud | ok

</details>

<details><summary>Home Assistant Supervisor</summary>

host_os | Home Assistant OS 14.2
-- | --
update_channel | stable
supervisor_version | supervisor-2025.03.0
agent_version | 1.6.0
docker_version | 27.2.0
disk_total | 292.7 GB
disk_used | 11.4 GB
healthy | true
supported | true
host_connectivity | true
supervisor_connectivity | true
ntp_synchronized | true
virtualization | 
board | generic-x86-64
supervisor_api | ok
version_api | ok
installed_addons | File editor (5.8.0), Samba share (12.5.0), Mosquitto broker (6.5.0), Advanced SSH & Web Terminal (20.0.1), SQLite Web (4.3.1), Log Viewer (0.17.1), Syncthing (1.19.5)

</details>

<details><summary>Dashboards</summary>

dashboards | 6
-- | --
resources | 20
views | 20
mode | storage

</details>

<details><summary>Recorder</summary>

oldest_recorder_run | 17 February 2025 at 11:40
-- | --
current_recorder_run | 25 February 2025 at 15:24
estimated_db_size | 1026.91 MiB
database_engine | sqlite
database_version | 3.47.1

</details>

hawkeye100 avatar Mar 04 '25 15:03 hawkeye100

Stale issue message

github-actions[bot] avatar Nov 10 '25 05:11 github-actions[bot]

Fixed with 2025.11.2

KJonline avatar Nov 10 '25 22:11 KJonline