ha-emporia-vue icon indicating copy to clipboard operation
ha-emporia-vue copied to clipboard

Failed auth after update

Open wilsonmfg opened this issue 2 years ago • 4 comments

The last few updates via HACS this fails to auth after the restart and I have to remove and re-add the integration. restarts or disable/enable don't bring it back alone.

am I doing something wrong? I'm just updating via HACS and restarting the server.

wilsonmfg avatar Nov 09 '21 14:11 wilsonmfg

Same here

debsahu avatar Nov 11 '21 17:11 debsahu

I've seen a bunch of errors from their API and if they happen during startup then the integration will fail to load correctly. Reloading the integration should fix that since it should try to reauth. I was under the impression that an error during setup should cause home assistant to retry setup automatically but that might not be working as I expected.

Could you get me the error(s) from the logs when this happens? I'm assuming there's a 500 error causing it (error on their side) but if it's something I'm sending that's invalid then I could fix that. If it's a 500 then all I can do is attempt to retry

magico13 avatar Nov 11 '21 17:11 magico13

this is all i have in my logs, Looks like an auth error, like the update is killing my saved credentials. I don't see any way to just redo them.

2021-11-09 08:14:41 ERROR (MainThread) [custom_components.emporia_vue] Could not authenticate with Emporia API 2021-11-09 08:23:37 ERROR (MainThread) [custom_components.emporia_vue.config_flow] Unexpected exception Traceback (most recent call last): File "/config/custom_components/emporia_vue/config_flow.py", line 77, in async_step_user info = await validate_input(self.hass, user_input) File "/config/custom_components/emporia_vue/config_flow.py", line 48, in validate_input if not await hub.authenticate(data[CONF_EMAIL], data[CONF_PASSWORD]): File "/config/custom_components/emporia_vue/config_flow.py", line 38, in authenticate result = await loop.run_in_executor(None, self.vue.login, username, password) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.9/site-packages/pyemvue/pyemvue.py", line 184, in login self.auth = Auth( File "/usr/local/lib/python3.9/site-packages/pyemvue/auth.py", line 45, in __init__ self.cognito.authenticate(password=password) File "/usr/local/lib/python3.9/site-packages/pycognito/__init__.py", line 447, in authenticate tokens = aws.authenticate_user() File "/usr/local/lib/python3.9/site-packages/pycognito/aws_srp.py", line 256, in authenticate_user tokens = boto_client.respond_to_auth_challenge( File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 357, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/lib/python3.9/site-packages/botocore/client.py", line 676, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.NotAuthorizedException: An error occurred (NotAuthorizedException) when calling the RespondToAuthChallenge operation: Incorrect username or password.

then after removing and readding:

2021-11-09 16:14:09 ERROR (MainThread) [custom_components.emporia_vue] Error communicating with Emporia API: 500 Server Error: Internal Server Error for url: https://api.emporiaenergy.com/AppAPI?apiMethod=getDeviceListUsages&deviceGids=7346+23042&instant=2021-11-09T22:14:09.007504Z&scale=1MIN&energyUnit=KilowattHours 2021-11-09 16:14:09 ERROR (MainThread) [custom_components.emporia_vue] Error fetching sensor data: Error communicating with Emporia API: 500 Server Error: Internal Server Error for url: https://api.emporiaenergy.com/AppAPI?apiMethod=getDeviceListUsages&deviceGids=7346+23042&instant=2021-11-09T22:14:09.007504Z&scale=1MIN&energyUnit=KilowattHours

chrwei avatar Nov 11 '21 17:11 chrwei

I've seen a bunch of errors from their API and if they happen during startup then the integration will fail to load correctly. Reloading the integration should fix that since it should try to reauth. I was under the impression that an error during setup should cause home assistant to retry setup automatically but that might not be working as I expected.

Could you get me the error(s) from the logs when this happens? I'm assuming there's a 500 error causing it (error on their side) but if it's something I'm sending that's invalid then I could fix that. If it's a 500 then all I can do is attempt to retry

Thanks, I removed and added the integration again, all sensors are now back.

debsahu avatar Nov 11 '21 18:11 debsahu