home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.81k stars 30.9k forks source link

Hive integration could not authenticate #70465

Closed julianjd-uk closed 2 years ago

julianjd-uk commented 2 years ago

The problem

After restarting Home Assistant the Hive integration works for a while, from a few minutes to maybe 30 minutes, and then stops with an authentication error in the core logs. This happens with and without 2FA enabled.

I'm UK based so Hive is still available to me.

What version of Home Assistant Core has the issue?

core-2022.4.6

What was the last working version of Home Assistant Core?

core-2022.4.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Hive

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hive/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Log data:
Logger: homeassistant.config_entries
Source: config_entries.py:349
First occurred: April 22, 2022, 8:46:51 PM (1 occurrences)
Last logged: April 22, 2022, 8:46:51 PM

Config entry 'xxxxxx@xxxxx.xxx' for hive integration could not authenticate

Core log data:
2022-04-23 06:36:35.748 | ERROR    | apyhiveapi.api.hive_async_api:request:74 - Hive token has expired when calling https://beekeeper.hivehome.com/1.0/nodes/all?products=true&devices=true&actions=true - HTTP status is - 401
2022-04-23 06:36:35.886 | ERROR    | apyhiveapi.api.hive_async_api:request:74 - Hive token has expired when calling https://beekeeper.hivehome.com/1.0/nodes/all?products=true&devices=true&actions=true - HTTP status is - 401
2022-04-23 06:36:35.986 | ERROR    | apyhiveapi.api.hive_async_api:request:74 - Hive token has expired when calling https://beekeeper.hivehome.com/1.0/nodes/all?products=true&devices=true&actions=true - HTTP status is - 401
2022-04-23 06:36:36.075 | ERROR    | apyhiveapi.api.hive_async_api:request:74 - Hive token has expired when calling https://beekeeper.hivehome.com/1.0/nodes/all?products=true&devices=true&actions=true - HTTP status is - 401

Additional information

No response

neilsleightholm-paxton commented 2 years ago

Tried re-adding and getting "Unknown error occurred" when entering the six digit auth code.

julianjd-uk commented 2 years ago

I removed the Hive integration and added it back in, it failed with "Unknown error occurred" after giving the 2FA code. The log shows:

Logger: aiohttp.server Source: components/hive/config_flow.py:81 First occurred: 6:40:40 PM (1 occurrences) Last logged: 6:40:40 PM

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 222, 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 81, in async_step_2fa self.tokens = await self.hive_auth.sms_2fa( File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 448, in sms_2fa await self.confirmDevice( File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 485, in confirmDevice 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 705, in _make_api_call http, parsed_response = self._make_request( File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request return self._endpoint.make_request(operation_model, request_dict) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request return self._send_request(request_dict, operation_model) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request request = self.create_request(request_dict, operation_model) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request self._event_emitter.emit(event_name, request=request, File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit return self._emitter.emit(aliased_event_name, kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit return self._emit(event_name, kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit response = handler(**kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler return self.sign(operation_name, request) File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign auth.add_auth(request) File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth raise NoCredentialsError() botocore.exceptions.NoCredentialsError: Unable to locate credentials

Turn 2FA off and the logon details are accepted, but the integration is added but shows "Failed to set up" The logs show:

Logger: homeassistant.config_entries Source: components/hive/init.py:94 First occurred: 6:44:16 PM (1 occurrences) Last logged: 6:44:16 PM

Error setting up entry xxxxxx@gmail.com for hive 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 94, in async_setup_entry devices = await hive.session.startSession(hive_config) File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 503, in startSession await self.getDevices("No_ID") File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 426, in getDevices await self.hiveRefreshTokens() File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 313, in hiveRefreshTokens result = await self.auth.refreshToken( File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 545, 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': 'xxxxxxxxxxxiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAifQ.i-NaavPntIIHghTxC9-XUW5TxH3wMPkvymotKI_WTPGBV98-fKw0cntnbYd4LAher0T0ZcU61z7-cFUO7Cetb3azxNv6uxMSOX98DUbzNVVmBgiakBpGk3Idpspgcc1fzLHEz1amXk01lXaXuWclT3JsGqmZE5dJV-LtXHzOb4_PdVKoj4acjPgXsbQUJqYKD27EdV6aZHzDKfDnw2KFxRMnVH5BqAtIqxiEm8VmB8jgfJHlJEkZod1eDfQuPSmHCfHRf-f942xJUaXkJRqOmDN4qnmh8Yur3GUKnxe8N_010NdG8MPpycQ8bWYFIK29oYymP-cSG6w9WVeNQue3SQ.h2ar5MbSYD__5bQs.gmtezzIsLpZPBVmBCrUPBuB9G3DXHHxmOkKXDFdBPmrl56DwsqfD-nqQ5lZjsKSgXtIvnSSFWrjOPnPfGdk-o7fVHucnDBvGPb81bIReVPNvsH1eKRkGG9lBI21vVagnrtY08FpZVCio84GwatMk1rWSG3IgnnyRkK3PEOxfud3-38e1aqPqpci9sHR_lEvDfPn63iIimjBrysLCHErSn04VP2o1Je-XNxWXrayXwLjoXL6OpsoaFqwZVDW9bDGl-CjF-cML5j_PDa35JT6XH3BcQ3wivjemr8n6fL0-DZg992y5Om6eSMIVWwdOccL5pfOwCp6ZLW2qgAqsmdmLVgpsYy1OODcFG3008O7PpzRLdGo5yWgQFw7DfVzEaHP8TAMo-jXeItGWD1lotmLEDy2RDV11tnlYKwNbh2svkqTFTdBVk878teKGn79eFiEcbJddRp9Qo9uMy6l3retmAUv_BkfCGeRZ2iDxZsjljqxIx3rAkxBKdcg4xltdvJvi54DZNLlp_IFMvzD6xXuyu5eOJ3WLBgnPg3CpcLNOWZFlNbsttwREKUqT0YtWJ_Ym6MYt9czWvNUcNqmITINVtX4y1-XDIaBt-vKFmxxO-_aWlzvuPTj3gA8fDborWROxlb2t-tnnlivfSwViiKwskwxImcA4fzpz-dBo6AfzsB9_ldQZ8QwamyfqpiVWp4mM4I0YSZHx3jJj_N5ldU8DWm1oA7NNyIdFyyC2YWEkMJZ1G8ojrYcnbYIjAggaPrR69Xwyi0CNx2cEc2Xnx6Pha8qNDfkWc8_5sf6Fek8R8oCKUCEqIbr_Kk3hvTkMGfz6sOf42FJLhve4IySq78-KEPx8PyWCZ5e6thOwRJ1HZpokr6FKWsN0PHEkNpZKJLSqEdCkALycc_gX0FMShA57xM3oCJB6sCvo_qN--QTbldMygrNC6itaxf0-vKz_1DDfrL646yoKA6-fd0ZVWtxaTzxaWElAvBgTgwXS_DFMfmQHO9Fy5sDAETewUjuWOxU9pzDfYMOcuruuIKuAnif1KKxy_LzDFESh3F7Cv3AYdirfHro5woKjGQPToHVmC9ZfRMGPelXgLX7sZJKJYwfJTuCbZOAsRtkmziKDtaghIzqLgxBTBgoawHAna_dSw1zQmQeq1D43NihaIEAptEPz219ZjVDll97DN3yYOHkMA7zJJZ3IHlknQR6pkOdf4MKRJ26yVl97vqNEb1BNKnTVU9s56dH2gzcEU30FwVqBj5J1IR0rVomfwxg4L64DtCZT76pmrCU7rp8IW4EVCbXncyzE-4ExHa-b9m9mvQ_gzDJPMOYtlvpk_l2fCC0zTlXmILulYyPGLw5SwonRxcGLJ7Mfb8imKo10bev_JnTuvGr3wlwwqecszGNidLQzXI6gcfbt-K3envUapsmJdnzdm-h8lNX_rqIkZz7EV1Rkzg.KTSiovcIM2M5MMvtcg8yqQ'},), type: <class 'tuple'>, valid types: <class 'dict'>

ukgaz1987 commented 2 years ago

I removed the Hive integration and added it back in, it failed with "Unknown error occurred" after giving the 2FA code. The log shows:

Logger: aiohttp.server Source: components/hive/config_flow.py:81 First occurred: 6:40:40 PM (1 occurrences) Last logged: 6:40:40 PM

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 222, 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 81, in async_step_2fa self.tokens = await self.hive_auth.sms_2fa( File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 448, in sms_2fa await self.confirmDevice( File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 485, in confirmDevice 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 705, in _make_api_call http, parsed_response = self._make_request( File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request return self._endpoint.make_request(operation_model, request_dict) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request return self._send_request(request_dict, operation_model) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request request = self.create_request(request_dict, operation_model) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request self._event_emitter.emit(event_name, request=request, File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit return self._emitter.emit(aliased_event_name, kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit return self._emit(event_name, kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit response = handler(**kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler return self.sign(operation_name, request) File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign auth.add_auth(request) File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth raise NoCredentialsError() botocore.exceptions.NoCredentialsError: Unable to locate credentials

Turn 2FA off and the logon details are accepted, but the integration is added but shows "Failed to set up" The logs show:

Logger: homeassistant.config_entries Source: components/hive/init.py:94 First occurred: 6:44:16 PM (1 occurrences) Last logged: 6:44:16 PM

Error setting up entry xxxxxx@gmail.com for hive 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 94, in async_setup_entry devices = await hive.session.startSession(hive_config) File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 503, in startSession await self.getDevices("No_ID") File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 426, in getDevices await self.hiveRefreshTokens() File "/usr/local/lib/python3.9/site-packages/apyhiveapi/session.py", line 313, in hiveRefreshTokens result = await self.auth.refreshToken( File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 545, 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': 'xxxxxxxxxxxiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAifQ.i-NaavPntIIHghTxC9-XUW5TxH3wMPkvymotKI_WTPGBV98-fKw0cntnbYd4LAher0T0ZcU61z7-cFUO7Cetb3azxNv6uxMSOX98DUbzNVVmBgiakBpGk3Idpspgcc1fzLHEz1amXk01lXaXuWclT3JsGqmZE5dJV-LtXHzOb4_PdVKoj4acjPgXsbQUJqYKD27EdV6aZHzDKfDnw2KFxRMnVH5BqAtIqxiEm8VmB8jgfJHlJEkZod1eDfQuPSmHCfHRf-f942xJUaXkJRqOmDN4qnmh8Yur3GUKnxe8N_010NdG8MPpycQ8bWYFIK29oYymP-cSG6w9WVeNQue3SQ.h2ar5MbSYD__5bQs.gmtezzIsLpZPBVmBCrUPBuB9G3DXHHxmOkKXDFdBPmrl56DwsqfD-nqQ5lZjsKSgXtIvnSSFWrjOPnPfGdk-o7fVHucnDBvGPb81bIReVPNvsH1eKRkGG9lBI21vVagnrtY08FpZVCio84GwatMk1rWSG3IgnnyRkK3PEOxfud3-38e1aqPqpci9sHR_lEvDfPn63iIimjBrysLCHErSn04VP2o1Je-XNxWXrayXwLjoXL6OpsoaFqwZVDW9bDGl-CjF-cML5j_PDa35JT6XH3BcQ3wivjemr8n6fL0-DZg992y5Om6eSMIVWwdOccL5pfOwCp6ZLW2qgAqsmdmLVgpsYy1OODcFG3008O7PpzRLdGo5yWgQFw7DfVzEaHP8TAMo-jXeItGWD1lotmLEDy2RDV11tnlYKwNbh2svkqTFTdBVk878teKGn79eFiEcbJddRp9Qo9uMy6l3retmAUv_BkfCGeRZ2iDxZsjljqxIx3rAkxBKdcg4xltdvJvi54DZNLlp_IFMvzD6xXuyu5eOJ3WLBgnPg3CpcLNOWZFlNbsttwREKUqT0YtWJ_Ym6MYt9czWvNUcNqmITINVtX4y1-XDIaBt-vKFmxxO-_aWlzvuPTj3gA8fDborWROxlb2t-tnnlivfSwViiKwskwxImcA4fzpz-dBo6AfzsB9_ldQZ8QwamyfqpiVWp4mM4I0YSZHx3jJj_N5ldU8DWm1oA7NNyIdFyyC2YWEkMJZ1G8ojrYcnbYIjAggaPrR69Xwyi0CNx2cEc2Xnx6Pha8qNDfkWc8_5sf6Fek8R8oCKUCEqIbr_Kk3hvTkMGfz6sOf42FJLhve4IySq78-KEPx8PyWCZ5e6thOwRJ1HZpokr6FKWsN0PHEkNpZKJLSqEdCkALycc_gX0FMShA57xM3oCJB6sCvo_qN--QTbldMygrNC6itaxf0-vKz_1DDfrL646yoKA6-fd0ZVWtxaTzxaWElAvBgTgwXS_DFMfmQHO9Fy5sDAETewUjuWOxU9pzDfYMOcuruuIKuAnif1KKxy_LzDFESh3F7Cv3AYdirfHro5woKjGQPToHVmC9ZfRMGPelXgLX7sZJKJYwfJTuCbZOAsRtkmziKDtaghIzqLgxBTBgoawHAna_dSw1zQmQeq1D43NihaIEAptEPz219ZjVDll97DN3yYOHkMA7zJJZ3IHlknQR6pkOdf4MKRJ26yVl97vqNEb1BNKnTVU9s56dH2gzcEU30FwVqBj5J1IR0rVomfwxg4L64DtCZT76pmrCU7rp8IW4EVCbXncyzE-4ExHa-b9m9mvQ_gzDJPMOYtlvpk_l2fCC0zTlXmILulYyPGLw5SwonRxcGLJ7Mfb8imKo10bev_JnTuvGr3wlwwqecszGNidLQzXI6gcfbt-K3envUapsmJdnzdm-h8lNX_rqIkZz7EV1Rkzg.KTSiovcIM2M5MMvtcg8yqQ'},), type: <class 'tuple'>, valid types: <class 'dict'>

Exactly the same as me, you just explained it a lot clearer than I did haha.

KJonline commented 2 years ago

Can you go into the account settings and see if a new device has been created. The device with should be in the trusted devices section of the account security in the hive app?

julianjd-uk commented 2 years ago

I have 3 devices, my phone and 2 Mozilla/5.0 devices.

KJonline commented 2 years ago

@julianjd-uk so you don’t have a device with the host name of the computer running home assistant?

julianjd-uk commented 2 years ago

No, nothing like that.

conormce commented 2 years ago

Having the same auth issues post update. 

Have uninstalled HACS Hive and hive integration then restarted and installed

Looked for trusted devices in the app before and after re-install and no change (phone and browser there before and after). 

On June 1, 2022, Tim Soethout @.***> wrote:

@julianjd-uk https://github.com/julianjd-uk so you don’t have a device with the host name of the computer running home assistant?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/70465#issuecomment- 1143988151, or unsubscribe https://github.com/notifications/unsubscribe- auth/AA4OBEQJ4R2MX4XJCTV3RM3VM6TD3ANCNFSM5UEGRRYQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

holdestmade commented 2 years ago

Having the same auth issues post update.  Have uninstalled HACS Hive and hive integration then restarted and installed Looked for trusted devices in the app before and after re-install and no change (phone and browser there before and after).  On June 1, 2022, Tim Soethout @.> wrote: @julianjd-uk https://github.com/julianjd-uk so you don’t have a device with the host name of the computer running home assistant? — Reply to this email directly, view it on GitHub <#70465 (comment)- 1143988151>, or unsubscribe <https://github.com/notifications/unsubscribe- auth/AA4OBEQJ4R2MX4XJCTV3RM3VM6TD3ANCNFSM5UEGRRYQ>. You are receiving this because you are subscribed to this thread.Message ID: @.>

Is the Hive custom component in HACS covered with this update ? I thought it was just the official integration in HA ?

dannytsang commented 2 years ago

I'm also having the same issue after 2022.6 upgrade. Couple of details before I go through the steps I tried:

I first got the device data error:

Logger: homeassistant.config_entries
Source: components/hive/__init__.py:82
First occurred: 19:10:15 (1 occurrences)
Last logged: 19:10:15

Error setting up entry Hive for hive
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 82, in async_setup_entry
    deviceGroupKey=hive_config["device_data"][0],
KeyError: 'device_data'

I left the DB upgrade to finish and then I tried multiple reboots and nothing changes and I got the device_data error.

I checked the mobile app and there was nothing in the Your trusted devices.

I removed the integration, restart home assistant and then when I try to add the integration it errors with the following trace:

2022-06-01 19:38:28 ERROR (MainThread) [aiohttp.server] 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 81, in async_step_2fa
    self.tokens = await self.hive_auth.sms_2fa(
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 448, in sms_2fa
    await self.confirmDevice(
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 485, in confirmDevice
    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 705, in _make_api_call
    http, parsed_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request
    self._event_emitter.emit(event_name, request=request,
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials

Nothing has appeared in the Your trusted devices.

ukgaz1987 commented 2 years ago

Can you go into the account settings and see if a new device has been created. The device with should be in the trusted devices section of the account security in the hive app?

No new devices added. With 2FA turned on, I can’t get past the bit where I have to enter the authentication code.

KJonline commented 2 years ago

Ye for some reason the error is the device isn’t be added as trusted so the auth doesn’t work. Bizarrely I logged in multiple times during testing without issue. But I can confirm I am having the issue now

julianjd-uk commented 2 years ago

The joys of doing IT work, it all works great until somebody else tries it.

We'll get there, if you need any help testing code, just give a shout and I'll do what I can.

KJonline commented 2 years ago

When I’m back later on I’ll work on a fix in my production home assistant and get it into the next 2022.6.x release

ukgaz1987 commented 2 years ago

When I’m back later on I’ll work on a fix in my production home assistant and get it into the next 2022.6.x release

Brill 🙂 thanks.

neilsleightholm-paxton commented 2 years ago

The joys of doing IT work, it all works great until somebody else tries it.

Yes been there.

We'll get there, if you need any help testing code, just give a shout and I'll do what I can.

Likewise, if you need anything tested let me know.

KJonline commented 2 years ago

This is the most bizarre thing I have come across. If I run my home assistant development on my machine which isn’t in a docker container of home assistant. The 2022.6.0 code works fine I can log in the device gets registered and I can refresh the token and it all works great. As soon as the code is put into a container the error starts to be thrown. I’ll keep looking but it’s not looking to be something simple.

julianjd-uk commented 2 years ago

That's interesting, what is happening to make that happen! Sounds like you'll be digging deep into this one, maybe a shout out to other developers will help, somebody may have come across something like this before.

Good luck with this, it sounds like it's going to be fine deep diving to find this issue.

Thanks for all your hard work with this integrating, it really is very much appreciated.

neilsleightholm-paxton commented 2 years ago

May not be relevant but I am getting the issue on VM (ova) version of Home Assistant.

KJonline commented 2 years ago

@neilsleightholm-paxton would be interested to know if that vm is running docker inside of it?

neilsleightholm-paxton commented 2 years ago

Afraid I don't know, it just says Virtual Machine ova in the hardware menu - it was an image I download from the HA site.

kingpotnoodle commented 2 years ago

You said the Hive account should show the hostname in trusted devices and this was working with your non-container test machine.

Could it be a problem getting a valid hostname from inside a container?

KJonline commented 2 years ago

@kingpotnoodle yes in the dev machine it registers with the host name. What have suggested was my initial thought so I hardcoded a name still had the same issue

julianjd-uk commented 2 years ago

It would be interesting to see the difference in a tcpdump between both systems and maybe the real interface that HA OS sends the data over. I would expect the code to give the same answer to a uname, not familiar with containers. Is HA OS adding something to the packets that Hive can't deal with?

KJonline commented 2 years ago

@julianjd-uk I wouldn't expect it to be as we use the boto client that AWS provide to make the http calls. It's a good shout though, where I have got to so far is refactor some of the code to register the device as a lot was happening at once. Worked around the breaking dependancy for users who haven't upgraded yet and have the ability to restore to a back to old config. In device registration hard coded the device name to be Home Assistant so it will eliminate any question around getting the host name and that being the issue. I'm going to submit something soon. Currently trying to manually manipulate files in a container to get some sort of testing done.

dannytsang commented 2 years ago

I'm also running it in a VM.

Tehsmash commented 2 years ago

I’m running HA OS directly on an Intel NUC and I’m seeing these issues on upgrade to 2022.6. I hope that provides a data point for non-container/VM scenarios too. I think for now I’m going to have to roll back to 2022.5 if I can until this is resolved.

kingpotnoodle commented 2 years ago

@kingpotnoodle yes in the dev machine it registers with the host name. What have suggested was my initial thought so I hardcoded a name still had the same issue

I thought it was probably too obvious to be the answer 🙄

Would there be a difference in any versions of the basic python libraries on the container vs other systems?

KJonline commented 2 years ago

@kingpotnoodle im not 100% ruling out the hostname as with the containers they just just pick new code changes. so even though I hardcoded the name it may or may not have picked it up restarting them just drops your change and loses it.

KJonline commented 2 years ago

@julianjd-uk I wouldn't expect it to be as we use the boto client that AWS provide to make the http calls. It's a good shout though, where I have got to so far is refactor some of the code to register the device as a lot was happening at once. Worked around the breaking dependancy for users who haven't upgraded yet and have the ability to restore to a back to old config. In device registration hard coded the device name to be Home Assistant so it will eliminate any question around getting the host name and that being the issue. I'm going to submit something soon. Currently trying to manually manipulate files in a container to get some sort of testing done.

I have put in a new PR #72929 with the changes mentioned. it has been set a milestone of 2022.6.1 so hopefully it will make it in and then we can rule a few things out and unblock some users. If anyone does have a home assistant back up from prior to Wednesday the configuration should work with the new code in this PR

neilsleightholm-paxton commented 2 years ago

Installed 2022.6.1 and seeing the same authentication error.

dannytsang commented 2 years ago

I got an error trying to add Hive Integration with 2022.6.1 as well.

simoncraddock commented 2 years ago

I have a feeling it'll be a few more days wait on a fix, but truly appreciate all the hardwork going on to resolve this issue.

si458 commented 2 years ago

same here still doesnt let me add in 2022.6.1

2022-06-03 08:28:03 ERROR (MainThread) [aiohttp.server] 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 100, 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 91, in async_step_2fa
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration
    await self.confirm_device(device_name)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device
    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 705, in _make_api_call
    http, parsed_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request
    self._event_emitter.emit(event_name, request=request,
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
julianjd-uk commented 2 years ago

Still the same, no new device added to the Hive application.

mastermc0 commented 2 years ago

Not sure how to link them but believe this is the same as a bug I raised #72839

alkissack commented 2 years ago

I think it (#72839) is a different and 2022.6 induced problem

KJonline commented 2 years ago

Yes they are both the same issue in different scenarios

santauk commented 2 years ago

2022.6.1 still causing issues. Running on HAOS on a PI4. Rolled back to prior v6 and all OK.

Logger: homeassistant.config_entries Source: components/hive/init.py:89 First occurred: 08:15:25 (1 occurrences) Last logged: 08:15:25

Error setting up entry xxxx@xxxxxxxx.co.uk for hive 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 494, in startSession if config["device_data"] is not None and not self.config.file: KeyError: 'device_data'

andyclegg1980 commented 2 years ago

I'm running 2022.6.1 inside a docker container running on Ubuntu 22.04 LTS. I have different errors depending upon whether 2FA is enabled on my Hive account. With 2FA enabled, I get this error after the App prompts for my OTP:

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 222, 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 91, in async_step_2fa
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration
    await self.confirm_device(device_name)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device
    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 705, in _make_api_call
    http, parsed_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request
    self._event_emitter.emit(event_name, request=request,
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials

Running with 2FA disabled, I get this error:

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 222, 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 63, in async_step_user
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration
    await self.confirm_device(device_name)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device
    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 AccessToken, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
Invalid type for parameter DeviceKey, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
lwsrbrts commented 2 years ago

This is a bit of a me too but I assume any data point is valid in debugging this.

I have an OVA installed version of Home Assistant, which I believe is HAOS (at least I'm offered to upgrade when a new version of Home Assistant OS is available (latest I upgraded to was 8.1).

I was running 2022.5.5 and have had no issues with the Hive integration on all prior updates I've applied. I attempted to update to 2022.6.1 today but the Hive integration failed. I restarted HA but no dice. I then removed the Hive integration and attempted to re-install it, I go through the auth process, am asked for my OTP code and I see an "unknown error" type message and the OTP submit form is still visible - like it won't submit because of whatever error is happening.

Anyhoo, I've rolled back to 2022.5.5 and it's fine again. I'll wait patiently for a fix before upgrading.

Thanks for investigating!


Logger: aiohttp.server
Source: components/hive/config_flow.py:105
First occurred: 11:58:40 (1 occurrences)
Last logged: 11:58:40
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 100, 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 91, in async_step_2fa
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration
    await self.confirm_device(device_name)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device
    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 705, in _make_api_call
    http, parsed_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request
    self._event_emitter.emit(event_name, request=request,
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
mastermc0 commented 2 years ago

Running in a docker container and getting a similar error to others.

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 100, 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 91, in async_step_2fa return await self.async_setup_hive_entry() File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry await self.hive_auth.device_registration("Home Assistant") File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration await self.confirm_device(device_name) File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device 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 705, in _make_api_call http, parsed_response = self._make_request( File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request return self._endpoint.make_request(operation_model, request_dict) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request return self._send_request(request_dict, operation_model) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request request = self.create_request(request_dict, operation_model) File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request self._event_emitter.emit(event_name, request=request, File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit return self._emitter.emit(aliased_event_name, **kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit return self._emit(event_name, kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit response = handler(**kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler return self.sign(operation_name, request) File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign auth.add_auth(request) File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth raise NoCredentialsError() botocore.exceptions.NoCredentialsError: Unable to locate credentials

paulski999 commented 2 years ago

This is a bit of a me too but I assume any data point is valid in debugging this.

I have an OVA installed version of Home Assistant, which I believe is HAOS (at least I'm offered to upgrade when a new version of Home Assistant OS is available (latest I upgraded to was 8.1).

I was running 2022.5.5 and have had no issues with the Hive integration on all prior updates I've applied. I attempted to update to 2022.6.1 today but the Hive integration failed. I restarted HA but no dice. I then removed the Hive integration and attempted to re-install it, I go through the auth process, am asked for my OTP code and I see an "unknown error" type message and the OTP submit form is still visible - like it won't submit because of whatever error is happening.

Anyhoo, I've rolled back to 2022.5.5 and it's fine again. I'll wait patiently for a fix before upgrading.

Thanks for investigating!


Logger: aiohttp.server
Source: components/hive/config_flow.py:105
First occurred: 11:58:40 (1 occurrences)
Last logged: 11:58:40
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 100, 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 91, in async_step_2fa
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration
    await self.confirm_device(device_name)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device
    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 705, in _make_api_call
    http, parsed_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 725, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 104, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 134, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.9/site-packages/botocore/endpoint.py", line 117, in create_request
    self._event_emitter.emit(event_name, request=request,
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 93, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.9/site-packages/botocore/signers.py", line 165, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.9/site-packages/botocore/auth.py", line 378, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials

Same issue for me, rolled back no auth issue

neilsleightholm-paxton commented 2 years ago

@KJonline is it possible to run the old version of the Hive integration in a stand-alone mode e.g. just copying the files to custom_components?

julianjd-uk commented 2 years ago

I don't know if you managed to get anything into 2022.6.2, but I've just updated to that version and no change in the error message for a connection without 2FA.

KJonline commented 2 years ago

@neilsleightholm-paxton if you need to login and don’t have a confirgured integration, using a custom integration wont change anything.

@julianjd-uk no changes went into 2022.6.2 as it’s been a busy weekend, I have been looking into it still where I can

neilsleightholm-paxton commented 2 years ago

@KJonline the idea is to use the pre-2022.6 Hive code as that worked perfectly for me. (Just trying to avoid downgrading HA to 2022.5.)

Nismonx commented 2 years ago

I don't know if this helps but I went back to 2022.5.5 because it was working for me back then. What I found out the next day is that tokens have expired or something, and it looked like everything was fine until I compared the reading against hive app and/or tried to change temperatures in hass.... Therefore although I was able to authenticate in the early version and get it all working, it was only temporarily.

drsewilliams commented 2 years ago

I have previously had hive integration working home assistant (~6 months ago). I had a new machine (OSX) so made a fresh installation of home assistant, running in a linux VM;

Without 2FA enabled, I'm receiving a very similar error to the above in the logs (see below).

Just wondering what the status is and whether this is going to be / can be fixed? Any other information I can provide that would be useful? Very happy to help testing etc. if needed.


Logger: aiohttp.server
Source: components/hive/config_flow.py:105 
First occurred: 12:09:11 (4 occurrences) 
Last logged: 12:33:40

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 100, 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 63, in async_step_user
    return await self.async_setup_hive_entry()
  File "/usr/src/homeassistant/homeassistant/components/hive/config_flow.py", line 105, in async_setup_hive_entry
    await self.hive_auth.device_registration("Home Assistant")
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 459, in device_registration
    await self.confirm_device(device_name)
  File "/usr/local/lib/python3.9/site-packages/apyhiveapi/api/hive_auth_async.py", line 480, in confirm_device
    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 AccessToken, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
Invalid type for parameter DeviceKey, value: None, type: <class 'NoneType'>, valid types: <class 'str'>```
chunkysteveo commented 2 years ago

Ditto on the failure of Hive on the latest install of HA. Mine is also failing to authenticate and load.