Hive Integration

There’s an issue with a Hive Authentication chsnge.

See here

1 Like

Thank you for this.

Trying to setup the official hive app and I am getting “unknow error” when putting in the 2fa code. Here is the error from the log. Any ideas ? thanks

Logger: aiohttp.server
Source: components/hive/config_flow.py:108
First occurred: 6:45:51 AM (2 occurrences)
Last logged: 6:46:20 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 220, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 205, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 93, in async_step_2fa
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 108, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
AttributeError: 'HiveAuthAsync' object has no attribute 'device_registration'

Fixed with upgrade to 6.6 ^

I’ve had issues with Hive being unavailable, I’m in UK, not using 2FA on the hive account. Last known working in Core 2022.5.4. Restoring backup of 5.4 resolves. The issue in logs

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 339, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/hive/__init__.py", line 89, in async_setup_entry
    devices = await hive.session.startSession(hive_config)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 493, in startSession
    await self.getDevices("No_ID")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 416, in getDevices
    await self.hiveRefreshTokens()
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 303, in hiveRefreshTokens
    result = await self.auth.refreshToken(
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 544, in refreshToken
    result = await self.loop.run_in_executor(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 391, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 691, in _make_api_call
    request_dict = self._convert_to_request_dict(
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 739, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
  File "/usr/local/lib/python3.9/site-packages/botocore/validate.py", line 360, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter AuthParameters, value: ({'REFRESH_TOKEN': 'eyJjds...snipped...MT8A'},), type: <class 'tuple'>, valid types: <class 'dict'>

I’ve snipped the refresh token as it is huge, but the the class being tuple not dict is the thing, I’m afraid I don’t have any insight into why my hive setup is causing this, I’m happy to help provide any info to get this working as it’s a big part of my home assistant!

1 Like

@nochanceofmeatballs a fix went into 2022.6.6 for this. If your still using the custom component then I am planning on getting around to updating this today as it uses the wrong version of the library

3 Likes

Thank you, I had been messing with enabling/disabling and restoring backups, etc. But I needed to delete Hive, upgraded to 6.6 then installed Hive from fresh, it is now working. Apologies! And thank you for all the work you put in.

Hi, when will the 2022.6.1 version of the custom component hit HACS ?

Thanks

@Holdestmade that should be available now

Brilliant, thanks. Do I need to uninstall the old one and restart and install this new one as with the official one ?

You will need to yes

All done and working fine, many thanks

A (hopefully) little bit of help please before I mess everything up.
I’m running HA 2022.6.6 with Hive custom component 2021.5.4 (via HACS) but currently WITHOUT 2FA

What do I need to do to keep this setup (and Alexa if anyone knows !) working after enabling 2FA in the Hive app ?
I’m wanting to do this since trying to upgrade Hive 2022.6.1 this morning which broke my setup, restoring, then reading above that I now need to use 2FA with HA 2022.6.6 (even though mine IS currently working).
A simple step by step checklist would be very much appreciated.
Thank you in advance, and many thanks to all who keep this great integration running, especially @Khole

I was in same position. Just enable 2fa, remove the integration, restart and then re add the integration.

1 Like

I am using 2fa, removing integration, restarting and re-adding is not working for me. What am I missing?

You are using the account owner account? You are on home assistant 2022.7.0 +

Yes and yes

core-2022.7.5

I posted the log in another thread Hive Integration Error in 2022.7.* - #9 by perjury1

I’ve just updated Home Assistant to the latest version 2022.9.2 and took the liberty of changing from my custom hive component in HACS to the core one. This means that I needed to switch on 2FA which I’ve done.

Everything has authenticated and I can see some sensors coming in ok. All the hue lights came through too but in terms of the core bits of hive I’ve only got 3 sensors now:
climate.thermostat_1
sensor.thermostat_1_battery_level
switch.thermostat_1_heat_on_demand

I’ve lost all my sensors such as boiler state, demand temperature e.g. sensor.thermostat_1_state

I’ve removed and re-added a few times with restarts between and still no joy.

What have I done wrong?