bm1549 / home-assistant-frigidaire

Custom component for the Frigidaire integration
30 stars 10 forks source link

Failed to set up... #54

Closed sirjmann92 closed 1 month ago

sirjmann92 commented 1 month ago

We (or at least I) seem to be having problems with this integration again. It just stopped working after a recent HA update (2024.5.3). I updated to 2024.5.4 and it's still not working. I honestly don't know if it's related to the HA update at all, could just be a coincidence in timing.

Is this still working for anyone else? I tried reloading it but I still have the same issue...

Logger: homeassistant.config_entries
Source: config_entries.py:575
First occurred: 4:34:40 PM (3 occurrences)
Last logged: 4:51:24 PM

Error setting up entry frigidaire for frigidaire
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 530, in post_request
    return self.parse_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 477, in parse_response
    raise FrigidaireException(f'Request failed with status {response.status_code}: {response.content}')
frigidaire.FrigidaireException: Request failed with status 429: b'{"error":"cas_3403","message":"You have exceeded the maximum number of active sessions. Please log out of another device or wait until an existing session expires.","detail":"Too many active login context"}'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/frigidaire/__init__.py", line 20, in setup
    hass.data[DOMAIN][entry.entry_id] = frigidaire.Frigidaire(
                                        ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 247, in __init__
    self.authenticate()
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 371, in authenticate
    frigidaire_auth_response = self.post_request(self.regional_base_url, '/one-account-authorization/api/v1/token', self.get_headers_frigidaire("POST", include_bearer_token=False), data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 532, in post_request
    self.handle_request_exception(e, "POST", f'{url}{path}', headers, encoded_data)
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 501, in handle_request_exception
    raise FrigidaireException(error_str)
frigidaire.FrigidaireException: Error processing request:
POST https://api.us.ocp.electrolux.one/one-account-authorization/api/v1/token
headers={'x-api-key': 'UcGF9pmUMKUqBL6qcQvTu4K4WBmQ5KJqJXprCTdc', 'Authorization': 'Bearer', 'Accept': 'application/json', 'Accept-Charset': 'UTF-8', 'User-Agent': 'Ktor client', 'Content-Type': 'application/json'}
payload={"grantType": "urn:ietf:params:oauth:grant-type:token-exchange", "clientId": "FrigidaireOneApp", "idToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlJFUTBNVVE1TjBOQ1JUSkVNemszTTBVMVJrTkRRMFUwUTBNMVJFRkJSamhETWpkRU5VRkJRZyJ9.eyJpc3MiOiJodHRwczovL2ZpZG0uZ2lneWEuY29tL2p3dC80X0F4MThhbTlXOWFieU5kTHViNmlkTGcvIiwiYXBpS2V5IjoiNF9BeDE4YW05VzlhYnlOZEx1YjZpZExnIiwiaWF0IjoxNzE2NTAwMDgwLCJleHAiOjE3MTY1MDAzODAsInJpc2tTY29yZSI6MC4wLCJzdWIiOiJlNGYzZWM3ODcwMGQ0YTBjYTcwZDA2ZWYyMjE3ZThlZCIsImNvdW50cnkiOiJVUyJ9.cCpIOAI7GtpACrZ_owjpKAC_2N9YPn2dfOWF3kj5o1lXmBnropDauDebHMvcfg_7D9Nqlmpc4bsok0ah-nBzQQDhrMHYzvflE6Z7Yw0HolWajCuSSUMVpcNOWl31Oky5LgDzVtdGAlATIQ-nBevHLUVVB3TpqTsBBH7gJql3w1PWmknk5EwvMObp8nq1fAnbE_9Kn4hjMObnOMCUldPXe7pebGD7_L0NsgRG96vdJxBDxxypnARoFZZJkkFy-pctCT-L4tMXHJMiByk5IJ2UCPfV6yTIWwyqIfSycLzX0Nzz20q7kl1Z4DD0mVturU26ARYiHkTIFmHoGJXvsz_SZA", "scope": ""}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/frigidaire/__init__.py", line 28, in async_setup_entry
    await hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/frigidaire/__init__.py", line 26, in setup
    raise data_entry_flow.AbortFlow from err
TypeError: AbortFlow.__init__() missing 1 required positional argument: 'reason'
sirjmann92 commented 1 month ago

Must have been something on the other end... it's working fine today.

sirjmann92 commented 1 month ago

Spoke too soon. When I'm able to log in on the app, it works in HA. A little while later, my automations stop working. When I check the app on my phone I'm still logged in, but if I log out and try to log back in it says to try again later and won't log me in... when I check the integration in HA I see the entities are unavailable. When I reload the integration it goes back to "Failed to set up..."

Since there is also an issue in the app, I still assume this is an issue on their end. I'm going to reopen this issue in the hopes that someone that is also experiencing this sees it and maybe has a workaround. Or maybe @rothn or @bm1549 can look into it from an API perspective and shed some light on it. Is it just me, or just my environment? Or are others also having problems with signing into Frigidaire services lately?

amaisano commented 1 month ago

I am having issues with HA but not the app.

I just installed the unit in my window today so I cannot speak to previous versions of HA. On 2024.5.4 now.


Logger: homeassistant.config_entries
Source: config_entries.py:575
First occurred: 7:50:17 PM (4 occurrences)
Last logged: 8:53:33 PM

Error setting up entry Frigidaire for frigidaire
Traceback (most recent call last):
  File "/config/custom_components/frigidaire/__init__.py", line 20, in setup
    hass.data[DOMAIN][entry.entry_id] = frigidaire.Frigidaire(
                                        ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 246, in __init__
    self.authenticate()
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 282, in authenticate
    auth_response = self.post_request('/authentication/authenticate', data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 430, in post_request
    return self.parse_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 404, in parse_response
    raise FrigidaireException(f'Request failed with status {response.status_code}: {response.content}')
frigidaire.FrigidaireException: Request failed with status 403: b'{"message":"Forbidden"}'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/frigidaire/__init__.py", line 28, in async_setup_entry
    await hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/frigidaire/__init__.py", line 26, in setup
    raise data_entry_flow.AbortFlow from err
TypeError: AbortFlow.__init__() missing 1 required positional argument: 'reason'
sirjmann92 commented 1 month ago

Been running fine for a few days now. It was hit or miss for a bit when I first closed the issue, so I reopened it. Since then, not so much as a hiccup.

Closing issue...

amaisano commented 1 month ago

Note in your errors:

frigidaire.FrigidaireException: Request failed with status 429: b'{"error":"cas_3403","message":"You have exceeded the maximum number of active sessions. Please log out of another device or wait until an existing session expires.","detail":"Too many active login context"}'

I am hitting this more often this year. What is the current polling rate? 30s?

rothn commented 1 month ago

@amaisano Please file a new ticket for this-- it looks like a different issue. I have not seen it. Are you signed in on a bunch of mobile devices or do you have several HomeAssistant instances running? Please answer on the new ticket.