[SOLVED] Hive integration failed to start after power loss

My home had a power outage while I was overseas and HA rebooted.
Everything seems to be ok except the Hive integration.

Automations which use Hive integration are reporting:

The automation "Office Boost 2" (automation.office_boost_2) has an unknown action: hive.boost_heating_on

As there is nothing wrong with that Action I looked in Integrations.

In Integrations, the Hive integraton is showing as ‘Failed to set up’.
In Entities, each Hive Entity is listed as “Not provided” (an exclamation point in a red circular arrow).

I have 21 Hive devices.
If I delete the Integration I will lose the devices and entities.
I would prefer not to do that.

I have tried rebooting HA with no change.

When I look in the log after a reboot I get the following:

Home Assistant Core
2024-11-17 16:45:15.539 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for hive
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/apyhiveapi/api/hive_auth_async.py", line 548, in refresh_token
result = await self.loop.run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/botocore/client.py", line 565, in _api_call
return self._make_api_call(operation_name, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/botocore/client.py", line 1021, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.NotAuthorizedException: An error occurred (NotAuthorizedException) when calling the InitiateAuth operation: Refresh Token has expired
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 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/hive/__init__.py", line 87, in async_setup_entry
devices = await hive.session.startSession(hive_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/apyhiveapi/session.py", line 502, in startSession
await self.getDevices("No_ID")
File "/usr/local/lib/python3.12/site-packages/apyhiveapi/session.py", line 425, in getDevices
await self.hiveRefreshTokens()
File "/usr/local/lib/python3.12/site-packages/apyhiveapi/session.py", line 304, in hiveRefreshTokens
result = await self.auth.refresh_token(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/apyhiveapi/api/hive_auth_async.py", line 562, in refresh_token
raise HiveInvalid2FACode from err
apyhiveapi.helper.hive_exceptions.HiveInvalid2FACode
2024-11-17 16:45:31.700 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'current_temperature' when rendering '{{ state.attributes.current_temperature }}'
2024-11-17 16:45:31.701 WARNING (MainThread) [homeassistant.components.homeassistant.triggers.numeric_state] Error initializing 'TRV measurement Back Room' trigger: In 'numeric_state' condition: entity climate.back_living_room state '' cannot be processed as a number

I am unable to interpret this but it made me wonder if it has lost the config of my Hive user details?
If so, I cannot see how I can re-enter them.

I am currently running HA core 2021.8.1 and OS 12.4

Any suggestions please?

I tried restoring a backup and that didn’t fix it so I deleted the Integration and reinstalled it.
I thought I would have to rename all the devices but, in the event, that wasn’t necessary.
The process was easier than I had feared.