prestomation / resmed_myair_sensors

This is a Home Assistant custom component to pull daily CPAP data from ResMed's myAir service using an undocumented API
MIT License
93 stars 9 forks source link

EU Login - Unknown error occurred #25

Closed DavidBurstein closed 2 months ago

DavidBurstein commented 2 years ago

Hi there Attempting to add my new EU - MyAir account using the integration installed via HACS. I've tried a few times including reinstalls and restarts.

HA error log below: I'm outside my ability so I'm not sure how to interpret the below. Does the last line "Attempt to decode JSON with unexpected mimetype" shed any light?

Thanks David

This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/resmed_myair/client/legacy_client.py:85 Integration: ResMed myAir CPAP Sensors (documentation, issues) First occurred: 9:06:48 AM (1 occurrences) Last logged: 9:06:48 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 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 "/config/custom_components/resmed_myair/config_flow.py", line 52, in async_step_user device: MyAirDevice = await get_device( File "/config/custom_components/resmed_myair/config_flow.py", line 31, in get_device await client.connect() File "/config/custom_components/resmed_myair/client/legacy_client.py", line 85, in connect authn_json = await authn_res.json() File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1103, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: application/xml', url=URL('https://myair.resmed.eu/authenticationids/externalwebservices/restotprequestselect.php')

Snuffy2 commented 3 months ago

v0.0.5-2FA Released - Quick fix from v0.0.4-2FA

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Thanks @aeble and @fmeus for the v0.0.4-2FA logs. This should fix the issue.

Please send me both working and failing debug logs so I can continue to refine as needed. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

dhover commented 3 months ago

Tested with version v0.0.5-2FA. Get Incomplete account. I've logged into the web again and say the timezone is filled in but after pressing modify it seems the timezone is empty. I've choosen the right timezone for the Netherlands. Then I redownloaded the integration and filled in the credentials and the 2FA. Still the same message about an incomplete account. Timezone is filled in and the dashboard is showing data. debug log sent.

Snuffy2 commented 3 months ago

v0.0.6-2FA - Save the Country Code

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Thanks to @aeble, @fmeus and @dhover for the debug logs

Please send me both working and failing debug logs so I can continue to refine as needed. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

londondev77 commented 3 months ago

I’m still getting no devices or entities. I’ve emailed the latest logs - hope they’re useful!

Snuffy2 commented 3 months ago

v0.0.7-2FA - Fix issue with country_code

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Thanks @londondev77 for the debug logs.

I found the issue with the country_code

Please send me both working and failing debug logs so I can continue to refine as needed. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

londondev77 commented 3 months ago

That’s worked!

hans99 commented 3 months ago

0.0.7 worked on first try, thanks for the good work!

aeble commented 3 months ago

Is there a way to show you our gratitude, @Snuffy2 ? Like a ko-fi link or paypal?

aeble commented 3 months ago

oh, and: I expect the bearer token will not be valid forever. How is the re-authentication being handled?

dhover commented 3 months ago

Still no success for me. I've deleted all files and installed the latest 0.0.7 version. I get the same error as before. If I look into the logfile I see an entry 'timeZone': 'America/Los_Angeles'. That is strange because I've chosen Europe/Amsterdam.

afbeelding The data from tonight is already in my dashboard. The other strange thing is that the timezone Europe/Amsterdam is 3 times in the list of available timezones. afbeelding Logfile sent.

fmeus commented 3 months ago

I have done the initial setup of v0.0.7-2FA at 6:45. The latest succesful data fetch was at 8:16.

It started failing from 8:46, so it appears it has worked again for approx. 2 hours before authorization fails. See logging below

2024-08-25 08:46:00.989 INFO (MainThread) [custom_components.resmed_myair.coordinator] Updating from myAir
2024-08-25 08:46:00.990 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [get_user_device_data] Starting Query
2024-08-25 08:46:00.991 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] operation_name: getPatientWrapper, query: 
        query getPatientWrapper {
            getPatientWrapper {
                fgDevices {
                    serialNumber
                    deviceType
                    lastSleepDataReportTime
                    localizedName
                    fgDeviceManufacturerName
                    fgDevicePatientId
                    __typename
                }
            }
        }

2024-08-25 08:46:00.991 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] country_code: NL
2024-08-25 08:46:00.992 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] appsync_url: https://graphql.hyperdrive.resmed.eu/graphql
2024-08-25 08:46:00.992 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] headers: {'x-api-key': 'da2-o66oo6xdnfh5hlfuw5yw5g2dtm', 'Authorization': '**REDACTED**', 'rmdhandsetid': '02c1c662-c289-41fd-a9ae-196ff15b5166', 'rmdlanguage': 'en', 'rmdhandsetmodel': 'Chrome', 'rmdhandsetosversion': '127.0.6533.119', 'rmdproduct': 'myAir EU', 'rmdappversion': '2.0.0', 'rmdhandsetplatform': 'Web', 'rmdcountry': 'NL', 'accept-language': 'en-US,en;q=0.9'}
2024-08-25 08:46:00.993 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] json_query: {'operationName': 'getPatientWrapper', 'variables': {}, 'query': '\n        query getPatientWrapper {\n            getPatientWrapper {\n                fgDevices {\n                    serialNumber\n                    deviceType\n                    lastSleepDataReportTime\n                    localizedName\n                    fgDeviceManufacturerName\n                    fgDevicePatientId\n                    __typename\n                }\n            }\n        }\n        '}
2024-08-25 08:46:01.288 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] records_res: <ClientResponse(https://graphql.hyperdrive.resmed.eu/graphql) [200 OK]>
<CIMultiDictProxy('Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '273', 'Connection': 'keep-alive', 'Date': 'Sun, 25 Aug 2024 06:46:01 GMT', 'x-amzn-RequestId': '75bab8f4-3a35-4b96-86cb-1d15d63ebf38', 'x-amzn-appsync-TokensConsumed': '1', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 5e95d2e6aebe43cabd9dcdad89ad0a42.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'AMS54-C1', 'X-Amz-Cf-Id': 'MrFhUAGuMJo25aMja_JchgLOV2FCyoBAPlTtVpPpjwRB0vVtd6XZBw==')>

2024-08-25 08:46:01.289 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] records_dict: {'data': {'getPatientWrapper': None}, 'errors': [{'path': ['getPatientWrapper'], 'data': None, 'errorType': 'myAir:result', 'errorInfo': {'success': False, 'errorType': 'unauthorized', 'errorCode': 'unauthorized'}, 'locations': [{'line': 3, 'column': 13, 'sourceName': None}], 'message': 'Error'}]}
2024-08-25 08:46:01.289 ERROR (MainThread) [custom_components.resmed_myair.coordinator] Authentication Error while updating. AuthenticationError: Getting unauthorized error on gql_query step. unauthorized: unauthorized
2024-08-25 08:46:01.289 ERROR (MainThread) [custom_components.resmed_myair.coordinator] Authentication failed while fetching myAir update data: Authentication Error while updating. AuthenticationError: Getting unauthorized error on gql_query step. unauthorized: unauthorized
2024-08-25 08:46:01.289 DEBUG (MainThread) [custom_components.resmed_myair.coordinator] Finished fetching myAir update data in 0.300 seconds (success: False)
2024-08-25 08:46:01.659 ERROR (Recorder) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/resmed_myair/coordinator.py", line 48, in _async_update_data
    self.device = await self.myair_client.get_user_device_data()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/client/eu_client.py", line 503, in get_user_device_data
    records_dict = await self.gql_query("getPatientWrapper", query)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/client/eu_client.py", line 421, in gql_query
    await self._resmed_response_error_check(
  File "/config/custom_components/resmed_myair/client/eu_client.py", line 103, in _resmed_response_error_check
    raise AuthenticationError(
custom_components.resmed_myair.client.myair_client.AuthenticationError: Getting unauthorized error on gql_query step. unauthorized: unauthorized

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/coordinator.py", line 60, in _async_update_data
    raise ConfigEntryAuthFailed(
homeassistant.exceptions.ConfigEntryAuthFailed: Authentication Error while updating. AuthenticationError: Getting unauthorized error on gql_query step. unauthorized: unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1052, in _async_init_reauth
    result = await hass.config_entries.flow.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1293, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1323, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 512, in _async_handle_step
    self._raise_if_step_does_not_exist(flow, step_id)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 591, in _raise_if_step_does_not_exist
    raise UnknownStep(
homeassistant.data_entry_flow.UnknownStep: Handler ConfigEntriesFlowManager doesn't support step reauth
aeble commented 3 months ago

Can confirm @fmeus observations:

[core-ssh config]$ grep -i resmed home-assistant.log
2024-08-25 12:51:40.534 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration resmed_myair which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-25 12:52:02.706 INFO (MainThread) [custom_components.resmed_myair] Starting ResMed myAir Integration Version: v0.0.7-2FA
2024-08-25 12:52:02.707 DEBUG (MainThread) [custom_components.resmed_myair] [init async_setup_entry] config_entry.data: {'Username': 'axel.eble@gmail.com', 'Password': '**REDACTED**', 'Region': 'EU', 'access_token': '**REDACTED**', 'country_code': 'DE'}
2024-08-25 12:52:07.266 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] config_entry.data: {'Username': 'axel.eble@gmail.com', 'Password': '**REDACTED**', 'Region': 'EU', 'access_token': '**REDACTED**', 'country_code': 'DE'}
2024-08-25 12:52:07.267 INFO (MainThread) [custom_components.resmed_myair.coordinator] Initializing DataUpdateCoordinator for ResMed myAir
2024-08-25 12:52:07.267 INFO (MainThread) [custom_components.resmed_myair.coordinator] Updating from myAir
2024-08-25 12:52:07.267 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [get_user_device_data] Starting Query
2024-08-25 12:52:07.267 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] operation_name: getPatientWrapper, query:
2024-08-25 12:52:07.267 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] country_code: DE
2024-08-25 12:52:07.267 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] appsync_url: https://graphql.hyperdrive.resmed.eu/graphql
2024-08-25 12:52:07.268 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] headers: {'x-api-key': 'da2-o66oo6xdnfh5hlfuw5yw5g2dtm', 'Authorization': '**REDACTED**', 'rmdhandsetid': '02c1c662-c289-41fd-a9ae-196ff15b5166', 'rmdlanguage': 'en', 'rmdhandsetmodel': 'Chrome', 'rmdhandsetosversion': '127.0.6533.119', 'rmdproduct': 'myAir EU', 'rmdappversion': '2.0.0', 'rmdhandsetplatform': 'Web', 'rmdcountry': 'DE', 'accept-language': 'en-US,en;q=0.9'}
2024-08-25 12:52:07.268 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] json_query: {'operationName': 'getPatientWrapper', 'variables': {}, 'query': '\n        query getPatientWrapper {\n            getPatientWrapper {\n                fgDevices {\n                    serialNumber\n                    deviceType\n                    lastSleepDataReportTime\n                    localizedName\n                    fgDeviceManufacturerName\n                    fgDevicePatientId\n                    __typename\n                }\n            }\n        }\n        '}
2024-08-25 12:52:07.501 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] records_res: <ClientResponse(https://graphql.hyperdrive.resmed.eu/graphql) [200 OK]>
2024-08-25 12:52:07.504 DEBUG (MainThread) [custom_components.resmed_myair.client.eu_client] [gql_query] records_dict: {'data': {'getPatientWrapper': None}, 'errors': [{'path': ['getPatientWrapper'], 'data': None, 'errorType': 'myAir:result', 'errorInfo': {'success': False, 'errorType': 'unauthorized', 'errorCode': 'unauthorized'}, 'locations': [{'line': 3, 'column': 13, 'sourceName': None}], 'message': 'Error'}]}
2024-08-25 12:52:07.504 ERROR (MainThread) [custom_components.resmed_myair.coordinator] Authentication Error while updating. AuthenticationError: Getting unauthorized error on gql_query step. unauthorized: unauthorized
2024-08-25 12:52:07.504 DEBUG (MainThread) [custom_components.resmed_myair.coordinator] Finished fetching myAir update data in 0.237 seconds (success: False)
2024-08-25 12:52:07.506 ERROR (MainThread) [homeassistant.helpers.entity_platform] resmed_myair raises exception ConfigEntryAuthFailed in forwarded platform sensor; Instead raise ConfigEntryAuthFailed before calling async_forward_entry_setups
[core-ssh config]$
Snuffy2 commented 3 months ago

Ok! Glad to hear we're making progress!

I had tried to build it to trigger a Home Assistant Reauthentication Flow when it timed out. However, it looks like I missed significant parts of that code (I've never built a Reauth before). I'm working on adding it now.

However, one of the primary reasons I moved forward with this approach was that I presumed that once you logged into the myAir Website and checked the box saying Do not challenge me on this device again, it would remain logged in for days. Looking at the access_token data, it appears to only remain valid for 2 hours (7200 seconds). If the myAir website does indeed continue to work for days, then I'll need to sort out how this is working. Maybe with a valid cookie, it can get a get a new access_token without logging in again, not sure.

Please login to the myair.resmed.eu website with Do not challenge me on this device again checked and see how long you remain logged in for.

Anyway, I'll put out an update soon that will hopefully trigger the reauth properly. I also am unable to really test this on my end. Once it does work, it should prompt to reauth whenever it expires, but hopefully we can sort out how to make it last more than 2 hours.

@dhover, not sure what is going on with your account or how to further troubleshoot/resolve. The only thing I see is that the error notes that 'additionalRegistrationRequired': True but no clue what or how. It probably needs to be a separate issue from this one.

fmeus commented 3 months ago

You need to login on the website again, but when 'Do not challenge me on this device again' has been checked you do not need the e-mailed code. It is not related to being authenticated or not. or how long you stay logged in.

Looking at the logging from HA I get max 4 hours. Will check with a regular browser session as well and report back.

fmeus commented 3 months ago

Started a session at 19:14, was still logged in at 20:24, but was no longer logged in at 22:03. So the web session was less than three hours valid.

Snuffy2 commented 3 months ago

v0.0.8-2FA Released - Save cookies, redo auth logic

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

A lot of code movement from v0.0.7-2FA. It may have introduced some unanticipated errors.

Please send me both working and failing debug logs so I can continue to refine as needed. If if is working, I'd appreciate several hours of logs (>2 hours) to review how it is updating the access token. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

fmeus commented 3 months ago

After entering the one-time verification code I get an error, "Unknown error occurred".

2024-08-26 14:39:59.100 INFO (MainThread) [custom_components.resmed_myair.config_flow] Setting up ResMed myAir Integration Version: v0.0.8-2FA
2024-08-26 14:40:08.880 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**REDACTED**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-26 14:40:08.880 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-26 14:40:08.881 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 14:40:08.881 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**REDACTED**', 'password': '**REDACTED**'}
2024-08-26 14:40:09.284 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 12:40:09 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zsx3qaU2kA7aAh5-EMLDcAAACKU', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2993', 'x-rate-limit-reset': '1724676060', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=C8A12FB91D416A0287E012B2C47FFAD0; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-26 14:40:09.291 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '00pPR7nwNjp_5waNqubDAAC8pAfz6iPrq-4CGyKGdx', 'expiresAt': '2024-08-26T12:45:09.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-26 14:40:09.291 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emfbkslbpeHhFKimG417
2024-08-26 14:40:09.292 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-26 14:40:09.292 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-26 14:40:09.292 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 14:40:09.292 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] json_query: {'passCode': '', 'stateToken': '00pPR7nwNjp_5waNqubDAAC8pAfz6iPrq-4CGyKGdx'}
2024-08-26 14:40:09.439 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 12:40:09 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zsx3qaU2kA7aAh5-EMLDcwAACKU', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'; report-uri https://oktacsp.report-uri.com/r/t/csp/enforce; report-to csp", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2997', 'x-rate-limit-reset': '1724676064', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=4BDAA20ED6FC0765C13CB4A9E5FCF057; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-26 14:40:09.439 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_dict: {'stateToken': '00pPR7nwNjp_5waNqubDAAC8pAfz6iPrq-4CGyKGdx', 'expiresAt': '2024-08-26T12:45:09.000Z', 'status': 'MFA_CHALLENGE', 'factorResult': 'CHALLENGE', 'challengeType': 'FACTOR', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factor': {'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}}, 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'next': {'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}, 'resend': [{'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify/resend', 'hints': {'allow': ['POST']}}], 'prev': {'href': 'https://id.resmed.eu/api/v1/authn/previous', 'hints': {'allow': ['POST']}}, 'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-26 14:40:18.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/config_flow.py", line 147, in async_step_verify_2fa
    status, device = await get_2fa_device(
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/config_flow.py", line 50, in get_2fa_device
    status = await client.verify_2fa_and_get_access_token(verification_code)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'verify_2fa_and_get_access_token'
Snuffy2 commented 3 months ago

v0.0.9-2FA Release - Fix a bug with client in 2FA

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Dumb bug

Please send me both working and failing debug logs so I can continue to refine as needed. If if is working, I'd appreciate several hours of logs (>2 hours) to review how it is updating the access token. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

lampje25 commented 3 months ago

fmeus ff in nederlands: waar vindt ik de code die ik in moet vullen? Heb overal gezocht op de resmed pagina terwijl ik ingelogd ben (en F12).

fmeus commented 3 months ago

fmeus ff in nederlands: waar vindt ik de code die ik in moet vullen?

Heb overal gezocht op de resmed pagina terwijl ik ingelogd ben (en F12).

Dat is de code die je via mail ontvangt

lampje25 commented 3 months ago

fmeus ff in nederlands: waar vindt ik de code die ik in moet vullen? Heb overal gezocht op de resmed pagina terwijl ik ingelogd ben (en F12).

Dat is de code die je via mail ontvangt

de cijfercode heb ik wel gevonden. Gaat om de code die ik moet invullen in HA. Is dat nu de code bij authorization: en dan zonder Bearer???

fmeus commented 3 months ago

fmeus ff in nederlands: waar vindt ik de code die ik in moet vullen? Heb overal gezocht op de resmed pagina terwijl ik ingelogd ben (en F12).

Dat is de code die je via mail ontvangt

de cijfercode heb ik wel gevonden. Gaat om de code die ik moet invullen in HA. Is dat nu de code bij authorization: en dan zonder Bearer???

Vanaf v0.0.1-2FA heb je de bearer token niet meer nodig. Gebruik je een oudere versie dan moet je in de developer tools (F12) naar het netwerk tabje gaan VOOR dat je de 2fa code invoert en dan zoeken naar het eerste zoekresultaat met graphql.hyperdrive.resmed.eu. In de headers tab kun je bearer token vinden. Hopelijk met het screenshot kun je er verder wijs uit worden.

SCR-20240826-supm

fmeus commented 3 months ago

v0.0.9-2FA Release - Fix a bug with client in 2FA

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Dumb bug

Please send me both working and failing debug logs so I can continue to refine as needed. If if is working, I'd appreciate several hours of logs (>2 hours) to review how it is updating the access token. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

I am now asked to enter the 2FA code twice. First time no error, the second time the "Unknown error occurred" occurs again.

Also noticed that within the code the version is still v0.0.8.2FA (const.py)

2024-08-26 21:53:12.604 INFO (MainThread) [custom_components.resmed_myair.config_flow] Setting up ResMed myAir Integration Version: v0.0.8-2FA
2024-08-26 21:53:21.460 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**REDACTED**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-26 21:53:21.460 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-26 21:53:21.460 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 21:53:21.460 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**REDACTED**', 'password': '**REDACTED**'}
2024-08-26 21:53:21.845 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 19:53:21 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'ZszdMVDHNQml5D_N697MogAAA2c', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2991', 'x-rate-limit-reset': '1724702032', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=1DA249AD7725803901E5007F7135FF50; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-26 21:53:21.846 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '00FiJ3mBAqYcSnAlkuvF8gMI6OipCoU_1wvtMhNo3g', 'expiresAt': '2024-08-26T19:58:21.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-26 21:53:21.846 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emfbkslbpeHhFKimG417
2024-08-26 21:53:21.846 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-26 21:53:21.846 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-26 21:53:21.846 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 21:53:21.846 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] json_query: {'passCode': '', 'stateToken': '00FiJ3mBAqYcSnAlkuvF8gMI6OipCoU_1wvtMhNo3g'}
2024-08-26 21:53:21.994 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 19:53:21 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'ZszdMVDHNQml5D_N697MqAAAA2c', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2996', 'x-rate-limit-reset': '1724702038', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=50F114213CC53E42C12E67A1D6FAAD86; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-26 21:53:21.994 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_dict: {'stateToken': '00FiJ3mBAqYcSnAlkuvF8gMI6OipCoU_1wvtMhNo3g', 'expiresAt': '2024-08-26T19:58:21.000Z', 'status': 'MFA_CHALLENGE', 'factorResult': 'CHALLENGE', 'challengeType': 'FACTOR', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factor': {'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}}, 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'next': {'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}, 'resend': [{'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify/resend', 'hints': {'allow': ['POST']}}], 'prev': {'href': 'https://id.resmed.eu/api/v1/authn/previous', 'hints': {'allow': ['POST']}}, 'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-26 21:53:37.304 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verification_code: 349164
2024-08-26 21:53:37.305 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-26 21:53:37.305 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 21:53:37.305 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] json_query: {'passCode': '349164', 'stateToken': '00FiJ3mBAqYcSnAlkuvF8gMI6OipCoU_1wvtMhNo3g'}
2024-08-26 21:53:37.596 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 19:53:37 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'ZszdQTIuK8HgzXgOZuCKQQAABh4', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2994', 'x-rate-limit-reset': '1724702038', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=79627FFADA930E42F9F085E6AB5ACF64; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-26 21:53:37.596 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_dict: {'expiresAt': '2024-08-26T19:58:37.000Z', 'status': 'SUCCESS', 'sessionToken': '20111qNrutwdMAMCcHA8vdW31ZX9BmGzOu63x4xsGf6f32X80KO6mKK', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-26 21:53:37.598 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_verifier: jYt2LAaK6S9ZMO7y2wuOFelVnzCzh0VO7QwpIAhwt2G1QBFPhTbrig
2024-08-26 21:53:37.598 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_challenge: k-E6VWCGzvKDf_NGjOxcm-qbwlJyU3GgfEBEHpx7wis
2024-08-26 21:53:37.598 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] authorize_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize
2024-08-26 21:53:37.599 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 21:53:37.599 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] params_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'code_challenge': 'k-E6VWCGzvKDf_NGjOxcm-qbwlJyU3GgfEBEHpx7wis', 'code_challenge_method': 'S256', 'prompt': 'none', 'redirect_uri': 'https://myair.resmed.eu', 'response_mode': 'fragment', 'response_type': 'code', 'sessionToken': '20111qNrutwdMAMCcHA8vdW31ZX9BmGzOu63x4xsGf6f32X80KO6mKK', 'scope': 'openid profile email', 'state': 'abcdef'}
2024-08-26 21:53:37.749 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize?client_id=0oa2uz04d2Pks2NgR417&code_challenge=k-E6VWCGzvKDf_NGjOxcm-qbwlJyU3GgfEBEHpx7wis&code_challenge_method=S256&prompt=none&redirect_uri=https://myair.resmed.eu&response_mode=fragment&response_type=code&sessionToken=20111qNrutwdMAMCcHA8vdW31ZX9BmGzOu63x4xsGf6f32X80KO6mKK&scope=openid+profile+email&state=abcdef) [302 Found]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 19:53:37 GMT', 'Server': 'nginx', 'Content-Length': '0', 'x-okta-request-id': 'ZszdQTIuK8HgzXgOZuCKQgAABh4', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5997', 'x-rate-limit-reset': '1724702059', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'referrer-policy': 'no-referrer', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'Location': 'https://myair.resmed.eu#code=atOn9UqV2fI9jUVXRQTWr6FyqbycRPoDCf6Dthqg0UQ&state=abcdef', 'Content-Language': 'nl-NL', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=D6EDA81E6DD4B773F70A9245031C028D; Path=/; Secure; HttpOnly', 'Set-Cookie': 't=default; Path=/', 'Set-Cookie': 'DT=DI19hETVjHRTaigHr_GNHGihQ;Version=1;Path=/;Max-Age=63072000;Secure;Expires=Wed, 26 Aug 2026 19:53:37 GMT;HttpOnly', 'Set-Cookie': 'sid=102nh4_AXj8TWyuGMqGBUAeAA;Version=1;Path=/;Secure')>

2024-08-26 21:53:37.750 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] location: https://myair.resmed.eu#code=atOn9UqV2fI9jUVXRQTWr6FyqbycRPoDCf6Dthqg0UQ&state=abcdef
2024-08-26 21:53:37.750 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] fragment: DefragResult(url='https://myair.resmed.eu', fragment='code=atOn9UqV2fI9jUVXRQTWr6FyqbycRPoDCf6Dthqg0UQ&state=abcdef')
2024-08-26 21:53:37.750 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code: ['atOn9UqV2fI9jUVXRQTWr6FyqbycRPoDCf6Dthqg0UQ']
2024-08-26 21:53:37.751 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token
2024-08-26 21:53:37.751 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}
2024-08-26 21:53:37.751 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'redirect_uri': 'https://myair.resmed.eu', 'grant_type': 'authorization_code', 'code_verifier': 'jYt2LAaK6S9ZMO7y2wuOFelVnzCzh0VO7QwpIAhwt2G1QBFPhTbrig', 'code': ['atOn9UqV2fI9jUVXRQTWr6FyqbycRPoDCf6Dthqg0UQ']}
2024-08-26 21:53:37.887 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 19:53:37 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'x-okta-request-id': 'ZszdQTIuK8HgzXgOZuCKQwAABh4', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5715', 'x-rate-limit-reset': '1724702020', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=E7E28FAD0C415C6951DB78EAD5EB914A; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-26 21:53:37.888 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_dict: {'token_type': 'Bearer', 'expires_in': 7200, 'access_token': '**REDACTED**', 'scope': 'openid profile email', 'id_token': '**REDACTED**'}
2024-08-26 21:53:37.888 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] post-token cookie_dict: {'JSESSIONID': 'E7E28FAD0C415C6951DB78EAD5EB914A', 't': 'default', 'DT': 'DI19hETVjHRTaigHr_GNHGihQ', 'sid': '102nh4_AXj8TWyuGMqGBUAeAA'}
2024-08-26 21:53:37.888 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] Starting Query
2024-08-26 21:53:37.888 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] operation_name: getPatientWrapper, query: 
        query getPatientWrapper {
            getPatientWrapper {
                fgDevices {
                    serialNumber
                    deviceType
                    lastSleepDataReportTime
                    localizedName
                    fgDeviceManufacturerName
                    fgDevicePatientId
                    __typename
                }
            }
        }

2024-08-26 21:53:37.888 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] jwt_data: {'sub': '00ubksl8fsaG4JgjT417', 'name': '**REDACTED**', 'email': '**REDACTED**', 'ver': 1, 'iss': 'https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417', 'aud': '0oa2uz04d2Pks2NgR417', 'iat': 1724702017, 'exp': 1724705617, 'jti': 'ID.kyo8MWzkN7sdpf2IHN7VnuOo61pHMWWvqF6cimatXxo', 'amr': ['mfa', 'otp', 'pwd'], 'idp': '00otx7l7fUMUKPgOR416', 'preferred_username': '**REDACTED**', 'auth_time': 1724702001, 'at_hash': 'uamFeKOXMNk6_eSryQm2Lw', 'lastName': '**REDACTED**', 'firstName': '**REDACTED**', 'myAirAnalyticsId': '8b4b8bb4-dbc6-4c40-8da2-7d66d3f4c257', 'myAirAnalyticsMode': 'anonymous', 'countryCode': 'NL', 'myAirCountryId': 'NL'}
2024-08-26 21:53:37.888 INFO (MainThread) [custom_components.resmed_myair.client.rest_client] Country Code: NL
2024-08-26 21:53:37.889 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] country_code: NL
2024-08-26 21:53:37.889 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] appsync_url: https://graphql.hyperdrive.resmed.eu/graphql
2024-08-26 21:53:37.889 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] headers: {'x-api-key': 'da2-o66oo6xdnfh5hlfuw5yw5g2dtm', 'Authorization': '**REDACTED**', 'rmdhandsetid': '02c1c662-c289-41fd-a9ae-196ff15b5166', 'rmdlanguage': 'en', 'rmdhandsetmodel': 'Chrome', 'rmdhandsetosversion': '127.0.6533.119', 'rmdproduct': 'myAir EU', 'rmdappversion': '2.0.0', 'rmdhandsetplatform': 'Web', 'rmdcountry': 'NL', 'accept-language': 'en-US,en;q=0.9'}
2024-08-26 21:53:37.889 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] json_query: {'operationName': 'getPatientWrapper', 'variables': {}, 'query': '\n        query getPatientWrapper {\n            getPatientWrapper {\n                fgDevices {\n                    serialNumber\n                    deviceType\n                    lastSleepDataReportTime\n                    localizedName\n                    fgDeviceManufacturerName\n                    fgDevicePatientId\n                    __typename\n                }\n            }\n        }\n        '}
2024-08-26 21:53:38.079 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_res: <ClientResponse(https://graphql.hyperdrive.resmed.eu/graphql) [200 OK]>
<CIMultiDictProxy('Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '295', 'Connection': 'keep-alive', 'Date': 'Mon, 26 Aug 2024 19:53:38 GMT', 'x-amzn-RequestId': '7551b403-acaf-4553-a92f-806579c2d9b2', 'x-amzn-appsync-TokensConsumed': '1', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 51d16867ea09d1b4c52eca0e090ad4a2.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'AMS54-C1', 'X-Amz-Cf-Id': '377L34EkHS8c347SoF0HF6OOZv28Ze3Kkpk54TrDE4J9umfkMRosFQ==')>

2024-08-26 21:53:38.080 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23232347743', 'deviceType': 'AS11', 'lastSleepDataReportTime': '2024-08-26T05:06:30.000+00:00', 'localizedName': 'AirSense11 AutoSet', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00ubksl8fsaG4JgjT417', '__typename': 'FgDevice'}]}}}
2024-08-26 21:53:38.080 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23232347743', 'deviceType': 'AS11', 'lastSleepDataReportTime': '2024-08-26T05:06:30.000+00:00', 'localizedName': 'AirSense11 AutoSet', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00ubksl8fsaG4JgjT417', '__typename': 'FgDevice'}]}}}
2024-08-26 21:53:38.080 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] device: {'serialNumber': '23232347743', 'deviceType': 'AS11', 'lastSleepDataReportTime': '2024-08-26T05:06:30.000+00:00', 'localizedName': 'AirSense11 AutoSet', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00ubksl8fsaG4JgjT417', '__typename': 'FgDevice'}
2024-08-26 21:53:42.852 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verification_code: 349164
2024-08-26 21:53:42.852 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-26 21:53:42.852 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-26 21:53:42.852 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] json_query: {'passCode': '349164', 'stateToken': '00FiJ3mBAqYcSnAlkuvF8gMI6OipCoU_1wvtMhNo3g'}
2024-08-26 21:53:42.943 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/config_flow.py", line 146, in async_step_verify_2fa
    status, device = await get_2fa_device(
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/config_flow.py", line 49, in get_2fa_device
    status = await client.verify_2fa_and_get_access_token(verification_code)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/resmed_myair/client/rest_client.py", line 155, in verify_2fa_and_get_access_token
    await self.verify_2fa(verification_code)
  File "/config/custom_components/resmed_myair/client/rest_client.py", line 295, in verify_2fa
    f"Verify 2FA Connection Issue. Status {verify_2fa_res.status} {verify_2fa_res.message}"
                                                                   ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'HassClientResponse' object has no attribute 'message'
lampje25 commented 3 months ago

fmeus ff in nederlands: waar vindt ik de code die ik in moet vullen? Heb overal gezocht op de resmed pagina terwijl ik ingelogd ben (en F12).

Dat is de code die je via mail ontvangt

de cijfercode heb ik wel gevonden. Gaat om de code die ik moet invullen in HA. Is dat nu de code bij authorization: en dan zonder Bearer???

Vanaf v0.0.1-2FA heb je de bearer token niet meer nodig. Gebruik je een oudere versie dan moet je in de developer tools (F12) naar het netwerk tabje gaan VOOR dat je de 2fa code invoert en dan zoeken naar het eerste zoekresultaat met graphql.hyperdrive.resmed.eu. In de headers tab kun je bearer token vinden. Hopelijk met het screenshot kun je er verder wijs uit worden.

Schermafbeelding 2024-08-26 215803

Ik heb nu ook de laatste versie: v0.0.9-2FA. Ik heb mijn screenshot ook toegevoegd (als het goed is). de geselecteerde vul ik dan in.

fmeus commented 3 months ago

Bij de meest recente versie is dat niet meer van toepassing. Je hebt je mailadres, wachtwoord en de gemailde code nodig.

lampje25 commented 3 months ago

Deze foutmelding krijg ik: ResMed myAir (Snuffy2 EU 2FA Dev) ResMed myAir Account Setup is Incomplete. Login to the myAir website and ensure that CPAP data is showing. Also, ensure that the Time Zone is set under My Account.

Schermafbeelding 2024-08-26 224728

Snuffy2 commented 3 months ago

v0.0.10-2FA - Fix issue with verify_2fa in config_flow

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Please send me both working and failing debug logs so I can continue to refine as needed. If if is working, I'd appreciate several hours of logs (>2 hours) to review how it is updating the access token. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

dhover commented 2 months ago

Same error with 0.10-2FA as before. "ResMed myAir Account Setup is Incomplete. Login to the myAir website and ensure that CPAP data is showing. Also, ensure that the Time Zone is set under My Account." Logfile sent. I've tried to choose another timezone (Brussel) but still the same error. I don't think it has something to do with the timezone. Maybe the privacy options?

afbeelding

londondev77 commented 2 months ago

With v0.0.10, it is now accepting the 2FA code however it is not finding any devices or entities. Here are the current logs.

Any chance you can add username to the list of fields that get redacted?

2024-08-27 06:18:46.886 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration resmed_myair which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-27 06:19:26.974 INFO (MainThread) [custom_components.resmed_myair.config_flow] Setting up ResMed myAir Integration Version: v0.0.10-2FA
2024-08-27 06:19:39.440 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [get_device] Starting
2024-08-27 06:19:39.441 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**scrubbed**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-27 06:19:39.441 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-27 06:19:39.441 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 06:19:39.441 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**scrubbed**', 'password': '**REDACTED**'}
2024-08-27 06:19:39.762 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 05:19:39 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs1h65QlaiyY-TzRX-lNZAAAAhE', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2957', 'x-rate-limit-reset': '1724735987', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=7508107DB681DD8E366B7DD257447F23; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 06:19:39.763 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '00OjGNGpoi6aUYieN2GvIgYIUEtN2k1mCIwU8an7ts', 'expiresAt': '2024-08-27T05:24:39.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**scrubbed**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emf6c38n74h97QBuT417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': 'a...t@antlane.co.uk'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 06:19:39.763 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emf6c38n74h97QBuT417
2024-08-27 06:19:39.763 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 06:19:39.763 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 06:19:39.763 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 06:19:39.763 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] json_query: {'passCode': '', 'stateToken': '00OjGNGpoi6aUYieN2GvIgYIUEtN2k1mCIwU8an7ts'}
2024-08-27 06:19:39.884 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 05:19:39 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs1h65QlaiyY-TzRX-lNZQAAAhE', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2992', 'x-rate-limit-reset': '1724736018', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=0AADFC1255071E177B7D8A39CEE78E9A; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 06:19:39.884 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_dict: {'stateToken': '00OjGNGpoi6aUYieN2GvIgYIUEtN2k1mCIwU8an7ts', 'expiresAt': '2024-08-27T05:24:39.000Z', 'status': 'MFA_CHALLENGE', 'factorResult': 'CHALLENGE', 'challengeType': 'FACTOR', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**scrubbed**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}, 'factor': {'id': 'emf6c38n74h97QBuT417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': 'a...t@antlane.co.uk'}}, 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'next': {'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify', 'hints': {'allow': ['POST']}}, 'resend': [{'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify/resend', 'hints': {'allow': ['POST']}}], 'prev': {'href': 'https://id.resmed.eu/api/v1/authn/previous', 'hints': {'allow': ['POST']}}, 'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 06:19:39.884 INFO (MainThread) [custom_components.resmed_myair.config_flow] 2FA Needed. Triggered Email
2024-08-27 06:19:39.885 INFO (MainThread) [custom_components.resmed_myair.config_flow] Showing Verify 2FA Form
2024-08-27 06:19:53.183 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [get_2fa_device] Starting
2024-08-27 06:19:53.183 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verification_code: 718982
2024-08-27 06:19:53.183 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 06:19:53.183 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 06:19:53.183 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] json_query: {'passCode': '718982', 'stateToken': '00OjGNGpoi6aUYieN2GvIgYIUEtN2k1mCIwU8an7ts'}
2024-08-27 06:19:53.359 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 05:19:53 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs1h-USwVguxhQDPG3YPKwAABZY', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2990', 'x-rate-limit-reset': '1724736018', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=1C872B8796EAC7151195CFB648FF6A34; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 06:19:53.359 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_dict: {'expiresAt': '2024-08-27T05:24:53.000Z', 'status': 'SUCCESS', 'sessionToken': '20111a_T2I6RjeMcc4tCqgozhms1J9mr2m9Wm7kU6cgJWwlj9KhHzCR', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**scrubbed**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 06:19:53.360 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_verifier: OFRh3AqTIuSNgmvrMmvavSYEGyMQQvLfqT12Lha3mbZ2wDCxzEbFw
2024-08-27 06:19:53.360 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_challenge: EpI2urVmTeiEmF0604USkyCL6bgyAfEBi7JOm4kRRew
2024-08-27 06:19:53.360 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] authorize_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize
2024-08-27 06:19:53.360 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 06:19:53.360 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] params_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'code_challenge': 'EpI2urVmTeiEmF0604USkyCL6bgyAfEBi7JOm4kRRew', 'code_challenge_method': 'S256', 'prompt': 'none', 'redirect_uri': 'https://myair.resmed.eu', 'response_mode': 'fragment', 'response_type': 'code', 'sessionToken': '20111a_T2I6RjeMcc4tCqgozhms1J9mr2m9Wm7kU6cgJWwlj9KhHzCR', 'scope': 'openid profile email', 'state': 'abcdef'}
2024-08-27 06:19:53.480 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize?client_id=0oa2uz04d2Pks2NgR417&code_challenge=EpI2urVmTeiEmF0604USkyCL6bgyAfEBi7JOm4kRRew&code_challenge_method=S256&prompt=none&redirect_uri=https://myair.resmed.eu&response_mode=fragment&response_type=code&sessionToken=20111a_T2I6RjeMcc4tCqgozhms1J9mr2m9Wm7kU6cgJWwlj9KhHzCR&scope=openid+profile+email&state=abcdef) [302 Found]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 05:19:53 GMT', 'Server': 'nginx', 'Content-Length': '0', 'x-okta-request-id': 'Zs1h-USwVguxhQDPG3YPLwAABZY', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5955', 'x-rate-limit-reset': '1724736001', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'referrer-policy': 'no-referrer', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'Location': 'https://myair.resmed.eu#code=8Ly_R4VrZ_hqXT1UlwAIMKEzjxsbs3Miw53woDXH3uA&state=abcdef', 'Content-Language': 'en', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 't=default; Path=/', 'Set-Cookie': 'DT=DI1uBedta9HRgG30lFWSJuWEg;Version=1;Path=/;Max-Age=63072000;Secure;Expires=Thu, 27 Aug 2026 05:19:53 GMT;HttpOnly', 'Set-Cookie': 'sid=102WeOFwyTJRH2KUQ_OcmBeUw;Version=1;Path=/;Secure')>
2024-08-27 06:19:53.480 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] location: https://myair.resmed.eu#code=8Ly_R4VrZ_hqXT1UlwAIMKEzjxsbs3Miw53woDXH3uA&state=abcdef
2024-08-27 06:19:53.480 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] fragment: DefragResult(url='https://myair.resmed.eu', fragment='code=8Ly_R4VrZ_hqXT1UlwAIMKEzjxsbs3Miw53woDXH3uA&state=abcdef')
2024-08-27 06:19:53.481 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code: ['8Ly_R4VrZ_hqXT1UlwAIMKEzjxsbs3Miw53woDXH3uA']
2024-08-27 06:19:53.481 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token
2024-08-27 06:19:53.481 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}
2024-08-27 06:19:53.481 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'redirect_uri': 'https://myair.resmed.eu', 'grant_type': 'authorization_code', 'code_verifier': 'OFRh3AqTIuSNgmvrMmvavSYEGyMQQvLfqT12Lha3mbZ2wDCxzEbFw', 'code': ['8Ly_R4VrZ_hqXT1UlwAIMKEzjxsbs3Miw53woDXH3uA']}
2024-08-27 06:19:53.592 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 05:19:53 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'x-okta-request-id': 'Zs1h-USwVguxhQDPG3YPMgAABZY', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5765', 'x-rate-limit-reset': '1724736031', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=662333C835C4C32698DAC0FE4B098599; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 06:19:53.593 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_dict: {'token_type': 'Bearer', 'expires_in': 7200, 'access_token': '**REDACTED**', 'scope': 'profile email openid', 'id_token': '**REDACTED**'}
2024-08-27 06:19:53.593 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] post-token cookie_dict: {'JSESSIONID': '662333C835C4C32698DAC0FE4B098599', 't': 'default', 'DT': 'DI1uBedta9HRgG30lFWSJuWEg', 'sid': '102WeOFwyTJRH2KUQ_OcmBeUw'}
2024-08-27 06:19:53.593 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] Starting Query
2024-08-27 06:19:53.593 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] operation_name: getPatientWrapper, query: 
2024-08-27 06:19:53.593 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] jwt_data: {'sub': '00u381vsh6dnZ7x1I417', 'name': '**REDACTED**', 'email': '**scrubbed**', 'ver': 1, 'iss': 'https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417', 'aud': '0oa2uz04d2Pks2NgR417', 'iat': 1724735993, 'exp': 1724739593, 'jti': 'ID.2mujhFergwXYzz2ALWeaOe2JcjYoqFyON9JSFHNgdSM', 'amr': ['mfa', 'otp', 'pwd'], 'idp': '00otx7l7fUMUKPgOR416', 'preferred_username': '**scrubbed**', 'auth_time': 1724735979, 'at_hash': 'sTXK_7BrGFhpmuEVt6Y1Vw', 'lastName': '**REDACTED**', 'firstName': '**REDACTED**', 'myAirAnalyticsId': '', 'myAirAnalyticsMode': 'anonymous', 'countryCode': 'GB', 'myAirCountryId': 'GB'}
2024-08-27 06:19:53.594 INFO (MainThread) [custom_components.resmed_myair.client.rest_client] Country Code: GB
2024-08-27 06:19:53.594 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] country_code: GB
2024-08-27 06:19:53.594 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] appsync_url: https://graphql.hyperdrive.resmed.eu/graphql
2024-08-27 06:19:53.594 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] headers: {'x-api-key': 'da2-o66oo6xdnfh5hlfuw5yw5g2dtm', 'Authorization': '**REDACTED**', 'rmdhandsetid': '02c1c662-c289-41fd-a9ae-196ff15b5166', 'rmdlanguage': 'en', 'rmdhandsetmodel': 'Chrome', 'rmdhandsetosversion': '127.0.6533.119', 'rmdproduct': 'myAir EU', 'rmdappversion': '2.0.0', 'rmdhandsetplatform': 'Web', 'rmdcountry': 'GB', 'accept-language': 'en-US,en;q=0.9'}
2024-08-27 06:19:53.594 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] json_query: {'operationName': 'getPatientWrapper', 'variables': {}, 'query': '\n        query getPatientWrapper {\n            getPatientWrapper {\n                fgDevices {\n                    serialNumber\n                    deviceType\n                    lastSleepDataReportTime\n                    localizedName\n                    fgDeviceManufacturerName\n                    fgDevicePatientId\n                    __typename\n                }\n            }\n        }\n        '}
2024-08-27 06:19:53.756 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_res: <ClientResponse(https://graphql.hyperdrive.resmed.eu/graphql) [200 OK]>
2024-08-27 06:19:53.757 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23234144292', 'deviceType': 'AS10', 'lastSleepDataReportTime': '2024-08-26T07:02:52.000+00:00', 'localizedName': 'AirSense 10 Autoset', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00u381vsh6dnZ7x1I417', '__typename': 'FgDevice'}]}}}
2024-08-27 06:19:53.757 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23234144292', 'deviceType': 'AS10', 'lastSleepDataReportTime': '2024-08-26T07:02:52.000+00:00', 'localizedName': 'AirSense 10 Autoset', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00u381vsh6dnZ7x1I417', '__typename': 'FgDevice'}]}}}
2024-08-27 06:19:53.757 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] device: {'serialNumber': '23234144292', 'deviceType': 'AS10', 'lastSleepDataReportTime': '2024-08-26T07:02:52.000+00:00', 'localizedName': 'AirSense 10 Autoset', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00u381vsh6dnZ7x1I417', '__typename': 'FgDevice'}
2024-08-27 06:19:53.757 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [async_step_verify_2fa] user_input: {'Username': '**scrubbed**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'JSESSIONID': '662333C835C4C32698DAC0FE4B098599', 't': 'default', 'DT': 'DI1uBedta9HRgG30lFWSJuWEg', 'sid': '102WeOFwyTJRH2KUQ_OcmBeUw'}}
2024-08-27 06:19:53.758 INFO (MainThread) [custom_components.resmed_myair] Starting ResMed myAir Integration Version: v0.0.10-2FA
2024-08-27 06:19:53.758 DEBUG (MainThread) [custom_components.resmed_myair] [init async_setup_entry] config_entry.data: {'Username': '**scrubbed**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'JSESSIONID': '662333C835C4C32698DAC0FE4B098599', 't': 'default', 'DT': 'DI1uBedta9HRgG30lFWSJuWEg', 'sid': '102WeOFwyTJRH2KUQ_OcmBeUw'}}
2024-08-27 06:19:53.769 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] config_entry.data: {'Username': '**scrubbed**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'JSESSIONID': '662333C835C4C32698DAC0FE4B098599', 't': 'default', 'DT': 'DI1uBedta9HRgG30lFWSJuWEg', 'sid': '102WeOFwyTJRH2KUQ_OcmBeUw'}}
2024-08-27 06:19:53.770 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**scrubbed**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-27 06:19:53.770 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] cookies: {'JSESSIONID': '662333C835C4C32698DAC0FE4B098599', 't': 'default', 'DT': 'DI1uBedta9HRgG30lFWSJuWEg', 'sid': '102WeOFwyTJRH2KUQ_OcmBeUw'}
2024-08-27 06:19:53.770 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] cookies: {'JSESSIONID': '662333C835C4C32698DAC0FE4B098599', 't': 'default', 'DT': 'DI1uBedta9HRgG30lFWSJuWEg', 'sid': '102WeOFwyTJRH2KUQ_OcmBeUw'}
2024-08-27 06:19:53.770 INFO (MainThread) [custom_components.resmed_myair.coordinator] Initializing DataUpdateCoordinator for ResMed myAir
2024-08-27 06:19:53.770 INFO (MainThread) [custom_components.resmed_myair.coordinator] Updating from myAir
2024-08-27 06:19:53.771 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-27 06:19:53.771 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 06:19:53.771 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**scrubbed**', 'password': '**REDACTED**'}
2024-08-27 06:19:53.991 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 05:19:53 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs1h-USwVguxhQDPG3YPNQAABZY', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2994', 'x-rate-limit-reset': '1724736047', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'JSESSIONID=1DFAC3CC1C87D294D1A0FB1FFFA526E9; Path=/; Secure; HttpOnly', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Transfer-Encoding': 'chunked')>
2024-08-27 06:19:53.991 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '00OVoP2cyrW6dTTOw8zYu7Ou-eswAs_7iwfWA2esw4', 'expiresAt': '2024-08-27T05:24:53.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**scrubbed**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emf6c38n74h97QBuT417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': 'a...t@antlane.co.uk'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 06:19:53.992 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emf6c38n74h97QBuT417
2024-08-27 06:19:53.992 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 06:19:53.992 ERROR (MainThread) [custom_components.resmed_myair.coordinator] Authentication Error while updating. AuthenticationError: Need to Re-Verify 2FA
2024-08-27 06:19:53.992 DEBUG (MainThread) [custom_components.resmed_myair.coordinator] Finished fetching myAir update data in 0.221 seconds (success: False)
2024-08-27 06:19:53.992 ERROR (MainThread) [homeassistant.helpers.entity_platform] resmed_myair raises exception ConfigEntryAuthFailed in forwarded platform sensor; Instead raise ConfigEntryAuthFailed before calling async_forward_entry_setups
aeble commented 2 months ago

Any chance you can add username to the list of fields that get redacted?

in my 0.0.10 version the usernames are redacted (though not completely, but enough for my liking)

dhover commented 2 months ago

Any chance you can add username to the list of fields that get redacted?

That would be a nice option so you can paste the logfiles without any modification.

Snuffy2 commented 2 months ago

v0.0.11-2FA - Fix sending cookies in requests

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Hopefully the cookies are now being saved and sent in the requests properly.

Please send me both working and failing debug logs so I can continue to refine as needed. If if is working, I'd appreciate several hours of logs (>2 hours) to review how it is updating the access token. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

fmeus commented 2 months ago

With v0.0.11 the 2FA code is accepted but not finding any devices or entities. Loggin below

2024-08-27 18:53:31.467 INFO (MainThread) [custom_components.resmed_myair.config_flow] Setting up ResMed myAir Integration Version: v0.0.11-2FA
2024-08-27 18:53:40.590 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [get_device] Starting
2024-08-27 18:53:40.591 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**REDACTED**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-27 18:53:40.591 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-27 18:53:40.591 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 18:53:40.591 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**REDACTED**', 'password': '**REDACTED**'}
2024-08-27 18:53:40.995 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:53:40 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs4ElP4qJ_ELJ-grJw2oSgAABxA', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2967', 'x-rate-limit-reset': '1724777620', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=CB2731C45A76CE0956AF88F253C52000; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-27 18:53:40.996 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '00mmtHyh33sCSGPlZQoCLhnIpWcqzO5HOD-it650e_', 'expiresAt': '2024-08-27T16:58:40.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 18:53:40.996 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emfbkslbpeHhFKimG417
2024-08-27 18:53:40.996 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-27 18:53:40.996 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-27 18:53:40.996 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 18:53:40.996 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] json_query: {'passCode': '', 'stateToken': '00mmtHyh33sCSGPlZQoCLhnIpWcqzO5HOD-it650e_'}
2024-08-27 18:53:41.157 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:53:41 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs4Elf4qJ_ELJ-grJw2oUwAABxA', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2996', 'x-rate-limit-reset': '1724777674', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=363B5CA2A3956C646AA5EF4629FC04B5; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-27 18:53:41.157 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_dict: {'stateToken': '00mmtHyh33sCSGPlZQoCLhnIpWcqzO5HOD-it650e_', 'expiresAt': '2024-08-27T16:58:41.000Z', 'status': 'MFA_CHALLENGE', 'factorResult': 'CHALLENGE', 'challengeType': 'FACTOR', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factor': {'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}}, 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'next': {'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}, 'resend': [{'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify/resend', 'hints': {'allow': ['POST']}}], 'prev': {'href': 'https://id.resmed.eu/api/v1/authn/previous', 'hints': {'allow': ['POST']}}, 'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 18:53:41.157 INFO (MainThread) [custom_components.resmed_myair.config_flow] 2FA Needed. Triggered Email
2024-08-27 18:53:41.157 INFO (MainThread) [custom_components.resmed_myair.config_flow] Showing Verify 2FA Form
2024-08-27 18:53:56.254 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [get_2fa_device] Starting
2024-08-27 18:53:56.254 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verification_code: 561401
2024-08-27 18:53:56.254 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-27 18:53:56.254 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 18:53:56.254 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] json_query: {'passCode': '561401', 'stateToken': '00mmtHyh33sCSGPlZQoCLhnIpWcqzO5HOD-it650e_'}
2024-08-27 18:53:56.518 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:53:56 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs4EpNXr5dU7aZmM6KCqNQAAAAQ', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2994', 'x-rate-limit-reset': '1724777674', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=234725AB9B0690E7D49F6901090C3BCA; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-27 18:53:56.519 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_dict: {'expiresAt': '2024-08-27T16:58:56.000Z', 'status': 'SUCCESS', 'sessionToken': '20111jpF13ZH2ljMyZ2GDEN2Red-xgca4VML6lQRMC1VMIs9VuAxXy5', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 18:53:56.522 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_verifier: uMHinq73Nne3MT7t1j0fpW7sseJEN7UkkHEAgy3OISAR3F6IfmszQ
2024-08-27 18:53:56.522 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_challenge: 0djAA606wHf59-usFDRwun8lGLBeeIKfXeHvE-oi0eI
2024-08-27 18:53:56.523 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] authorize_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize
2024-08-27 18:53:56.523 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 18:53:56.524 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] params_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'code_challenge': '0djAA606wHf59-usFDRwun8lGLBeeIKfXeHvE-oi0eI', 'code_challenge_method': 'S256', 'prompt': 'none', 'redirect_uri': 'https://myair.resmed.eu', 'response_mode': 'fragment', 'response_type': 'code', 'sessionToken': '20111jpF13ZH2ljMyZ2GDEN2Red-xgca4VML6lQRMC1VMIs9VuAxXy5', 'scope': 'openid profile email', 'state': 'abcdef'}
2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize?client_id=0oa2uz04d2Pks2NgR417&code_challenge=0djAA606wHf59-usFDRwun8lGLBeeIKfXeHvE-oi0eI&code_challenge_method=S256&prompt=none&redirect_uri=https://myair.resmed.eu&response_mode=fragment&response_type=code&sessionToken=20111jpF13ZH2ljMyZ2GDEN2Red-xgca4VML6lQRMC1VMIs9VuAxXy5&scope=openid+profile+email&state=abcdef) [302 Found]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:53:56 GMT', 'Server': 'nginx', 'Content-Length': '0', 'x-okta-request-id': 'Zs4EpNXr5dU7aZmM6KCqNwAAAAQ', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5999', 'x-rate-limit-reset': '1724777696', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'referrer-policy': 'no-referrer', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'Location': 'https://myair.resmed.eu#code=y9sCAc5nxpbuAmMXtaHRykR4Iy1XgM2VpzxNoC2vxpk&state=abcdef', 'Content-Language': 'nl-NL', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=73715CC4101F40A0EBA96EC0C59AA46A; Path=/; Secure; HttpOnly', 'Set-Cookie': 't=default; Path=/', 'Set-Cookie': 'DT=DI1CNpSt-8ERhyGok6MWwVv_w;Version=1;Path=/;Max-Age=63072000;Secure;Expires=Thu, 27 Aug 2026 16:53:56 GMT;HttpOnly', 'Set-Cookie': 'sid=102mgoUk4B2S2umJvuws1iF0g;Version=1;Path=/;Secure')>

2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] location: https://myair.resmed.eu#code=y9sCAc5nxpbuAmMXtaHRykR4Iy1XgM2VpzxNoC2vxpk&state=abcdef
2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] fragment: DefragResult(url='https://myair.resmed.eu', fragment='code=y9sCAc5nxpbuAmMXtaHRykR4Iy1XgM2VpzxNoC2vxpk&state=abcdef')
2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code: ['y9sCAc5nxpbuAmMXtaHRykR4Iy1XgM2VpzxNoC2vxpk']
2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token
2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}
2024-08-27 18:53:56.709 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'redirect_uri': 'https://myair.resmed.eu', 'grant_type': 'authorization_code', 'code_verifier': 'uMHinq73Nne3MT7t1j0fpW7sseJEN7UkkHEAgy3OISAR3F6IfmszQ', 'code': ['y9sCAc5nxpbuAmMXtaHRykR4Iy1XgM2VpzxNoC2vxpk']}
2024-08-27 18:53:56.838 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:53:56 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'x-okta-request-id': 'Zs4EpNXr5dU7aZmM6KCqOgAAAAQ', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5818', 'x-rate-limit-reset': '1724777656', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=AD457761DE63EE2B79BCA734DDFE0313; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>

2024-08-27 18:53:56.838 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_dict: {'token_type': 'Bearer', 'expires_in': 7200, 'access_token': '**REDACTED**', 'scope': 'profile openid email', 'id_token': '**REDACTED**'}
2024-08-27 18:53:56.839 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] post-token cookie_dict: {'JSESSIONID': 'AD457761DE63EE2B79BCA734DDFE0313', 't': 'default', 'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}
2024-08-27 18:53:56.839 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] post-token cookie_dict post-cleanup: {'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}
2024-08-27 18:53:56.839 INFO (MainThread) [custom_components.resmed_myair.client.rest_client] Setting saved cookies
2024-08-27 18:53:56.840 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] Starting Query
2024-08-27 18:53:56.840 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] operation_name: getPatientWrapper, query: 
        query getPatientWrapper {
            getPatientWrapper {
                fgDevices {
                    serialNumber
                    deviceType
                    lastSleepDataReportTime
                    localizedName
                    fgDeviceManufacturerName
                    fgDevicePatientId
                    __typename
                }
            }
        }

2024-08-27 18:53:56.841 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] jwt_data: {'sub': '00ubksl8fsaG4JgjT417', 'name': '**REDACTED**', 'email': '**REDACTED**', 'ver': 1, 'iss': 'https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417', 'aud': '0oa2uz04d2Pks2NgR417', 'iat': 1724777636, 'exp': 1724781236, 'jti': 'ID.mDZBzdZj1uxLxYmEHWnfIvcAOJAAjMYTdOFjnXqLT7I', 'amr': ['mfa', 'otp', 'pwd'], 'idp': '00otx7l7fUMUKPgOR416', 'preferred_username': '**REDACTED**', 'auth_time': 1724777620, 'at_hash': '8umFbYbdsfCOjxwibFzvKA', 'lastName': '**REDACTED**', 'firstName': '**REDACTED**', 'myAirAnalyticsId': '8b4b8bb4-dbc6-4c40-8da2-7d66d3f4c257', 'myAirAnalyticsMode': 'anonymous', 'countryCode': 'NL', 'myAirCountryId': 'NL'}
2024-08-27 18:53:56.841 INFO (MainThread) [custom_components.resmed_myair.client.rest_client] Country Code: NL
2024-08-27 18:53:56.841 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] country_code: NL
2024-08-27 18:53:56.841 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] graphql_url: https://graphql.hyperdrive.resmed.eu/graphql
2024-08-27 18:53:56.842 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] headers: {'x-api-key': 'da2-o66oo6xdnfh5hlfuw5yw5g2dtm', 'Authorization': '**REDACTED**', 'rmdhandsetid': '02c1c662-c289-41fd-a9ae-196ff15b5166', 'rmdlanguage': 'en', 'rmdhandsetmodel': 'Chrome', 'rmdhandsetosversion': '127.0.6533.119', 'rmdproduct': 'myAir EU', 'rmdappversion': '2.0.0', 'rmdhandsetplatform': 'Web', 'rmdcountry': 'NL', 'accept-language': 'en-US,en;q=0.9'}
2024-08-27 18:53:56.842 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] json_query: {'operationName': 'getPatientWrapper', 'variables': {}, 'query': '\n        query getPatientWrapper {\n            getPatientWrapper {\n                fgDevices {\n                    serialNumber\n                    deviceType\n                    lastSleepDataReportTime\n                    localizedName\n                    fgDeviceManufacturerName\n                    fgDevicePatientId\n                    __typename\n                }\n            }\n        }\n        '}
2024-08-27 18:53:57.003 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_res: <ClientResponse(https://graphql.hyperdrive.resmed.eu/graphql) [200 OK]>
<CIMultiDictProxy('Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '295', 'Connection': 'keep-alive', 'Date': 'Tue, 27 Aug 2024 16:53:56 GMT', 'x-amzn-RequestId': '02126a46-1348-4f4c-9453-ea834036cd5f', 'x-amzn-appsync-TokensConsumed': '1', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 2e0227ef3f0af98f7b4e1f8452f59f84.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'AMS54-C1', 'X-Amz-Cf-Id': 'xK7v_up6jAQvbJqrrm3qFoCSguxNxqAGDNPVznA_zk1IyNWEH6Q1jQ==')>

2024-08-27 18:53:57.003 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23232347743', 'deviceType': 'AS11', 'lastSleepDataReportTime': '2024-08-27T04:51:05.000+00:00', 'localizedName': 'AirSense11 AutoSet', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00ubksl8fsaG4JgjT417', '__typename': 'FgDevice'}]}}}
2024-08-27 18:53:57.003 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23232347743', 'deviceType': 'AS11', 'lastSleepDataReportTime': '2024-08-27T04:51:05.000+00:00', 'localizedName': 'AirSense11 AutoSet', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00ubksl8fsaG4JgjT417', '__typename': 'FgDevice'}]}}}
2024-08-27 18:53:57.003 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] device: {'serialNumber': '23232347743', 'deviceType': 'AS11', 'lastSleepDataReportTime': '2024-08-27T04:51:05.000+00:00', 'localizedName': 'AirSense11 AutoSet', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00ubksl8fsaG4JgjT417', '__typename': 'FgDevice'}
2024-08-27 18:53:57.003 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [async_step_verify_2fa] user_input: {'Username': '**REDACTED**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}}
2024-08-27 18:53:57.010 INFO (MainThread) [custom_components.resmed_myair] Starting ResMed myAir Integration Version: v0.0.11-2FA
2024-08-27 18:53:57.010 DEBUG (MainThread) [custom_components.resmed_myair] [init async_setup_entry] config_entry.data: {'Username': '**REDACTED**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}}
2024-08-27 18:53:57.030 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] config_entry.data: {'Username': '**REDACTED**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}}
2024-08-27 18:53:57.031 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**REDACTED**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-27 18:53:57.031 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] cookies: {'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}
2024-08-27 18:53:57.031 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] cookies to load: {'DT': 'DI1CNpSt-8ERhyGok6MWwVv_w', 'sid': '102mgoUk4B2S2umJvuws1iF0g'}
2024-08-27 18:53:57.031 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] All Loaded Cookies:
2024-08-27 18:53:57.031 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] Set-Cookie: DT=DI1CNpSt-8ERhyGok6MWwVv_w; Path=/
2024-08-27 18:53:57.032 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] Set-Cookie: sid=102mgoUk4B2S2umJvuws1iF0g; Path=/
2024-08-27 18:53:57.032 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] loaded cookies for https://id.resmed.eu: Set-Cookie: DT=DI1CNpSt-8ERhyGok6MWwVv_w
Set-Cookie: sid=102mgoUk4B2S2umJvuws1iF0g
2024-08-27 18:53:57.032 INFO (MainThread) [custom_components.resmed_myair.coordinator] Initializing DataUpdateCoordinator for ResMed myAir
2024-08-27 18:53:57.032 INFO (MainThread) [custom_components.resmed_myair.coordinator] Updating from myAir
2024-08-27 18:53:57.032 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-27 18:53:57.032 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 18:53:57.032 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**REDACTED**', 'password': '**REDACTED**'}
2024-08-27 18:53:57.490 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:53:57 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs4EpdXr5dU7aZmM6KCqPAAAAAQ', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2993', 'x-rate-limit-reset': '1724777682', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'JSESSIONID=0274567CB3CFC6894347574AC5A7EC46; Path=/; Secure; HttpOnly', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Transfer-Encoding': 'chunked')>

2024-08-27 18:53:57.491 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '001rp3olNF0KB8WFqWoAjCOHB-FMcQpzN1xE6G3SA6', 'expiresAt': '2024-08-27T16:58:57.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00ubksl8fsaG4JgjT417', 'passwordChanged': '2024-02-19T11:06:27.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'nl_NL', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emfbkslbpeHhFKimG417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 18:53:57.491 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emfbkslbpeHhFKimG417
2024-08-27 18:53:57.491 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emfbkslbpeHhFKimG417/verify?rememberDevice=true
2024-08-27 18:53:57.492 ERROR (MainThread) [custom_components.resmed_myair.coordinator] Authentication Error while updating. AuthenticationError: Need to Re-Verify 2FA
2024-08-27 18:53:57.492 DEBUG (MainThread) [custom_components.resmed_myair.coordinator] Finished fetching myAir update data in 0.460 seconds (success: False)
2024-08-27 18:53:57.495 ERROR (MainThread) [homeassistant.helpers.entity_platform] resmed_myair raises exception ConfigEntryAuthFailed in forwarded platform sensor; Instead raise ConfigEntryAuthFailed before calling async_forward_entry_setups
londondev77 commented 2 months ago

With v0.0.11 the 2FA code is accepted but not finding any devices or entities. Loggin below

Same for me:

2024-08-27 17:16:31.436 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration resmed_myair which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-27 17:17:41.957 INFO (MainThread) [custom_components.resmed_myair.config_flow] Setting up ResMed myAir Integration Version: v0.0.11-2FA
2024-08-27 17:17:51.689 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [get_device] Starting
2024-08-27 17:17:51.690 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**REDACTED**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-27 17:17:51.690 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-27 17:17:51.690 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 17:17:51.690 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**REDACTED**', 'password': '**REDACTED**'}
2024-08-27 17:17:52.005 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:17:51 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs38L5WGL_txwR6eyG2t_QAABH4', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2978', 'x-rate-limit-reset': '1724775482', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=56EA4A3A29F9F698843DBB38440ED239; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 17:17:52.006 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '00MNy7HkJZ6m63x6tgbyncqso_DQo2KPdsHbMb1U4l', 'expiresAt': '2024-08-27T16:22:51.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emf6c38n74h97QBuT417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 17:17:52.006 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emf6c38n74h97QBuT417
2024-08-27 17:17:52.006 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 17:17:52.006 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 17:17:52.006 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 17:17:52.006 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] json_query: {'passCode': '', 'stateToken': '00MNy7HkJZ6m63x6tgbyncqso_DQo2KPdsHbMb1U4l'}
2024-08-27 17:17:52.145 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:17:52 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs38MJWGL_txwR6eyG2t_wAABH4', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2992', 'x-rate-limit-reset': '1724775486', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=AEDDA277AAFC9ABD9ADD6F75EE2A048E; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 17:17:52.146 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [trigger_2fa] trigger_2fa_dict: {'stateToken': '00MNy7HkJZ6m63x6tgbyncqso_DQo2KPdsHbMb1U4l', 'expiresAt': '2024-08-27T16:22:52.000Z', 'status': 'MFA_CHALLENGE', 'factorResult': 'CHALLENGE', 'challengeType': 'FACTOR', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}, 'factor': {'id': 'emf6c38n74h97QBuT417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}}, 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'next': {'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify', 'hints': {'allow': ['POST']}}, 'resend': [{'name': '**REDACTED**', 'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify/resend', 'hints': {'allow': ['POST']}}], 'prev': {'href': 'https://id.resmed.eu/api/v1/authn/previous', 'hints': {'allow': ['POST']}}, 'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 17:17:52.146 INFO (MainThread) [custom_components.resmed_myair.config_flow] 2FA Needed. Triggered Email
2024-08-27 17:17:52.146 INFO (MainThread) [custom_components.resmed_myair.config_flow] Showing Verify 2FA Form
2024-08-27 17:18:02.621 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [get_2fa_device] Starting
2024-08-27 17:18:02.621 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verification_code: 852669
2024-08-27 17:18:02.621 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 17:18:02.621 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 17:18:02.621 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] json_query: {'passCode': '852669', 'stateToken': '00MNy7HkJZ6m63x6tgbyncqso_DQo2KPdsHbMb1U4l'}
2024-08-27 17:18:02.791 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_res: <ClientResponse(https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:18:02 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs38OvWEkOKazYvolSnGqgAADgg', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2990', 'x-rate-limit-reset': '1724775486', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Set-Cookie': 'autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/', 'Set-Cookie': 'JSESSIONID=DEFF045179D0370BF7D5410B5BA11818; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 17:18:02.792 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [verify_2fa] verify_2fa_dict: {'expiresAt': '2024-08-27T16:23:02.000Z', 'status': 'SUCCESS', 'sessionToken': '20111JEaLPo6--mMgmDhBifmPxQHdbQb-UILkeGTpXN4t6w64RKwYN2', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 17:18:02.792 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_verifier: Q9Thw6LeG65ruy9f9tkTlTuJ3SHzVkeWxcc2CKC9cny0Ppa0yvQ
2024-08-27 17:18:02.792 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_challenge: cBAIrZyxcJpVb-6uraDqUh093_oxInC4GkbWLHoi3HM
2024-08-27 17:18:02.792 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] authorize_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize
2024-08-27 17:18:02.793 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 17:18:02.793 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] params_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'code_challenge': 'cBAIrZyxcJpVb-6uraDqUh093_oxInC4GkbWLHoi3HM', 'code_challenge_method': 'S256', 'prompt': 'none', 'redirect_uri': 'https://myair.resmed.eu', 'response_mode': 'fragment', 'response_type': 'code', 'sessionToken': '20111JEaLPo6--mMgmDhBifmPxQHdbQb-UILkeGTpXN4t6w64RKwYN2', 'scope': 'openid profile email', 'state': 'abcdef'}
2024-08-27 17:18:02.938 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/authorize?client_id=0oa2uz04d2Pks2NgR417&code_challenge=cBAIrZyxcJpVb-6uraDqUh093_oxInC4GkbWLHoi3HM&code_challenge_method=S256&prompt=none&redirect_uri=https://myair.resmed.eu&response_mode=fragment&response_type=code&sessionToken=20111JEaLPo6--mMgmDhBifmPxQHdbQb-UILkeGTpXN4t6w64RKwYN2&scope=openid+profile+email&state=abcdef) [302 Found]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:18:02 GMT', 'Server': 'nginx', 'Content-Length': '0', 'x-okta-request-id': 'Zs38OvWEkOKazYvolSnGrAAADgg', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5998', 'x-rate-limit-reset': '1724775537', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'referrer-policy': 'no-referrer', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'Location': 'https://myair.resmed.eu#code=a9KzN7y05zflu-wwq6TAZj99dCugb7Z7KgDL4iRlhss&state=abcdef', 'Content-Language': 'en', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=D27564F8C4B86B3739F010F2E582DBB2; Path=/; Secure; HttpOnly', 'Set-Cookie': 't=default; Path=/', 'Set-Cookie': 'DT=DI1tMbBRpEDRLKWUwid7KfAEA;Version=1;Path=/;Max-Age=63072000;Secure;Expires=Thu, 27 Aug 2026 16:18:02 GMT;HttpOnly', 'Set-Cookie': 'sid=102Hq0dx5KpSXKV6kwMwMiOOQ;Version=1;Path=/;Secure')>
2024-08-27 17:18:02.938 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] location: https://myair.resmed.eu#code=a9KzN7y05zflu-wwq6TAZj99dCugb7Z7KgDL4iRlhss&state=abcdef
2024-08-27 17:18:02.938 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token code] fragment: DefragResult(url='https://myair.resmed.eu', fragment='code=a9KzN7y05zflu-wwq6TAZj99dCugb7Z7KgDL4iRlhss&state=abcdef')
2024-08-27 17:18:02.939 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] code: ['a9KzN7y05zflu-wwq6TAZj99dCugb7Z7KgDL4iRlhss']
2024-08-27 17:18:02.939 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_url: https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token
2024-08-27 17:18:02.939 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}
2024-08-27 17:18:02.939 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] token_query: {'client_id': '0oa2uz04d2Pks2NgR417', 'redirect_uri': 'https://myair.resmed.eu', 'grant_type': 'authorization_code', 'code_verifier': 'Q9Thw6LeG65ruy9f9tkTlTuJ3SHzVkeWxcc2CKC9cny0Ppa0yvQ', 'code': ['a9KzN7y05zflu-wwq6TAZj99dCugb7Z7KgDL4iRlhss']}
2024-08-27 17:18:03.056 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_res: <ClientResponse(https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417/v1/token) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:18:03 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'x-okta-request-id': 'Zs38OvWEkOKazYvolSnGrgAADgg', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '6000', 'x-rate-limit-remaining': '5741', 'x-rate-limit-reset': '1724775484', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'X-Robots-Tag': 'noindex,nofollow', 'Set-Cookie': 'JSESSIONID=6C3CFA66690808D8F6A875F6B7689DD1; Path=/; Secure; HttpOnly', 'Transfer-Encoding': 'chunked')>
2024-08-27 17:18:03.056 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token] token_dict: {'token_type': 'Bearer', 'expires_in': 7200, 'access_token': '**REDACTED**', 'scope': 'profile openid email', 'id_token': '**REDACTED**'}
2024-08-27 17:18:03.056 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] post-token cookie_dict: {'JSESSIONID': '6C3CFA66690808D8F6A875F6B7689DD1', 't': 'default', 'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}
2024-08-27 17:18:03.056 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_access_token token] post-token cookie_dict post-cleanup: {'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}
2024-08-27 17:18:03.056 INFO (MainThread) [custom_components.resmed_myair.client.rest_client] Setting saved cookies
2024-08-27 17:18:03.056 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] Starting Query
2024-08-27 17:18:03.056 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] operation_name: getPatientWrapper, query: 
2024-08-27 17:18:03.057 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] jwt_data: {'sub': '00u381vsh6dnZ7x1I417', 'name': '**REDACTED**', 'email': '**REDACTED**', 'ver': 1, 'iss': 'https://id.resmed.eu/oauth2/aus2uznux2sYKTsEg417', 'aud': '0oa2uz04d2Pks2NgR417', 'iat': 1724775483, 'exp': 1724779083, 'jti': 'ID.f5_zpFfrl5ILxYClAj6tcBvsH2hk771MHdBN5gXHzV8', 'amr': ['mfa', 'otp', 'pwd'], 'idp': '00otx7l7fUMUKPgOR416', 'preferred_username': '**REDACTED**', 'auth_time': 1724775471, 'at_hash': 'Nt_aNkmXLc6YxqPcVBW2Nw', 'lastName': '**REDACTED**', 'firstName': '**REDACTED**', 'myAirAnalyticsId': '', 'myAirAnalyticsMode': 'anonymous', 'countryCode': 'GB', 'myAirCountryId': 'GB'}
2024-08-27 17:18:03.057 INFO (MainThread) [custom_components.resmed_myair.client.rest_client] Country Code: GB
2024-08-27 17:18:03.057 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] country_code: GB
2024-08-27 17:18:03.057 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] graphql_url: https://graphql.hyperdrive.resmed.eu/graphql
2024-08-27 17:18:03.057 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] headers: {'x-api-key': 'da2-o66oo6xdnfh5hlfuw5yw5g2dtm', 'Authorization': '**REDACTED**', 'rmdhandsetid': '02c1c662-c289-41fd-a9ae-196ff15b5166', 'rmdlanguage': 'en', 'rmdhandsetmodel': 'Chrome', 'rmdhandsetosversion': '127.0.6533.119', 'rmdproduct': 'myAir EU', 'rmdappversion': '2.0.0', 'rmdhandsetplatform': 'Web', 'rmdcountry': 'GB', 'accept-language': 'en-US,en;q=0.9'}
2024-08-27 17:18:03.057 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] json_query: {'operationName': 'getPatientWrapper', 'variables': {}, 'query': '\n        query getPatientWrapper {\n            getPatientWrapper {\n                fgDevices {\n                    serialNumber\n                    deviceType\n                    lastSleepDataReportTime\n                    localizedName\n                    fgDeviceManufacturerName\n                    fgDevicePatientId\n                    __typename\n                }\n            }\n        }\n        '}
2024-08-27 17:18:03.230 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_res: <ClientResponse(https://graphql.hyperdrive.resmed.eu/graphql) [200 OK]>
2024-08-27 17:18:03.230 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [gql_query] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23234144292', 'deviceType': 'AS10', 'lastSleepDataReportTime': '2024-08-27T07:01:55.000+00:00', 'localizedName': 'AirSense 10 Autoset', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00u381vsh6dnZ7x1I417', '__typename': 'FgDevice'}]}}}
2024-08-27 17:18:03.230 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] records_dict: {'data': {'getPatientWrapper': {'fgDevices': [{'serialNumber': '23234144292', 'deviceType': 'AS10', 'lastSleepDataReportTime': '2024-08-27T07:01:55.000+00:00', 'localizedName': 'AirSense 10 Autoset', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00u381vsh6dnZ7x1I417', '__typename': 'FgDevice'}]}}}
2024-08-27 17:18:03.230 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [get_user_device_data] device: {'serialNumber': '23234144292', 'deviceType': 'AS10', 'lastSleepDataReportTime': '2024-08-27T07:01:55.000+00:00', 'localizedName': 'AirSense 10 Autoset', 'fgDeviceManufacturerName': 'ResMed', 'fgDevicePatientId': '00u381vsh6dnZ7x1I417', '__typename': 'FgDevice'}
2024-08-27 17:18:03.230 DEBUG (MainThread) [custom_components.resmed_myair.config_flow] [async_step_verify_2fa] user_input: {'Username': '**REDACTED**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}}
2024-08-27 17:18:03.231 INFO (MainThread) [custom_components.resmed_myair] Starting ResMed myAir Integration Version: v0.0.11-2FA
2024-08-27 17:18:03.231 DEBUG (MainThread) [custom_components.resmed_myair] [init async_setup_entry] config_entry.data: {'Username': '**REDACTED**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}}
2024-08-27 17:18:03.246 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] config_entry.data: {'Username': '**REDACTED**', 'Password': '**REDACTED**', 'Region': 'EU', 'cookies': {'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}}
2024-08-27 17:18:03.247 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [RESTClient init] config: {'username': '**REDACTED**', 'password': '**REDACTED**', 'region': 'EU'}
2024-08-27 17:18:03.247 DEBUG (MainThread) [custom_components.resmed_myair.sensor] [sensor async_setup_entry] cookies: {'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}
2024-08-27 17:18:03.247 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] cookies to load: {'DT': 'DI1tMbBRpEDRLKWUwid7KfAEA', 'sid': '102Hq0dx5KpSXKV6kwMwMiOOQ'}
2024-08-27 17:18:03.247 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] All Loaded Cookies:
2024-08-27 17:18:03.247 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] Set-Cookie: DT=DI1tMbBRpEDRLKWUwid7KfAEA; Path=/
2024-08-27 17:18:03.247 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] Set-Cookie: sid=102Hq0dx5KpSXKV6kwMwMiOOQ; Path=/
2024-08-27 17:18:03.248 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [load_cookies] loaded cookies for https://id.resmed.eu: Set-Cookie: DT=DI1tMbBRpEDRLKWUwid7KfAEA
2024-08-27 17:18:03.248 INFO (MainThread) [custom_components.resmed_myair.coordinator] Initializing DataUpdateCoordinator for ResMed myAir
2024-08-27 17:18:03.248 INFO (MainThread) [custom_components.resmed_myair.coordinator] Updating from myAir
2024-08-27 17:18:03.248 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_url: https://id.resmed.eu/api/v1/authn
2024-08-27 17:18:03.248 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2024-08-27 17:18:03.248 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] json_query: {'username': '**REDACTED**', 'password': '**REDACTED**'}
2024-08-27 17:18:03.473 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_res: <ClientResponse(https://id.resmed.eu/api/v1/authn) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 27 Aug 2024 16:18:03 GMT', 'Server': 'nginx', 'Content-Type': 'application/json', 'Vary': 'Accept-Encoding', 'x-okta-request-id': 'Zs38O_WEkOKazYvolSnGtQAADgg', 'x-xss-protection': '0', 'p3p': 'CP="HONK"', 'content-security-policy': "default-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; connect-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu *.oktacdn.com *.mixpanel.com *.mapbox.com *.mtls.okta.com resmed-ext-eu.kerberos.okta.com https://oinmanager.okta.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com; script-src 'unsafe-inline' 'unsafe-eval' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; style-src 'unsafe-inline' 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com; frame-src 'self' resmed-ext-eu.okta.com resmed-ext-eu-admin.okta.com id.resmed.eu login.okta.com; img-src 'self' resmed-ext-eu.okta.com id.resmed.eu *.oktacdn.com *.tiles.mapbox.com *.mapbox.com data: data.pendo.io pendo-static-5634101834153984.storage.googleapis.com pendo-static-5391521872216064.storage.googleapis.com blob:; font-src 'self' resmed-ext-eu.okta.com id.resmed.eu data: *.oktacdn.com fonts.gstatic.com; frame-ancestors 'self'", 'x-rate-limit-limit': '3000', 'x-rate-limit-remaining': '2999', 'x-rate-limit-reset': '1724775543', 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache', 'Expires': '0', 'referrer-policy': 'strict-origin-when-cross-origin', 'accept-ch': 'Sec-CH-UA-Platform-Version', 'x-content-type-options': 'nosniff', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains', 'Content-Encoding': 'gzip', 'Set-Cookie': 'JSESSIONID=0215584D751F43918988E23C00ACF308; Path=/; Secure; HttpOnly', 'Set-Cookie': 'sid="";Version=1;Path=/;Max-Age=0', 'Transfer-Encoding': 'chunked')>
2024-08-27 17:18:03.473 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_dict: {'stateToken': '007sfflqMNgibmyogoBy3cu8I-bJQ4-QwV9JAHbWy_', 'expiresAt': '2024-08-27T16:23:03.000Z', 'status': 'MFA_REQUIRED', '_embedded': {'user': {'id': '00u381vsh6dnZ7x1I417', 'passwordChanged': '2022-02-15T21:10:03.000Z', 'profile': {'login': '**REDACTED**', 'firstName': '**REDACTED**', 'lastName': '**REDACTED**', 'locale': 'en_GB', 'timeZone': 'America/Los_Angeles'}}, 'factors': [{'id': 'emf6c38n74h97QBuT417', 'factorType': 'email', 'provider': 'OKTA', 'vendorName': 'OKTA', 'profile': {'email': '**REDACTED**'}, '_links': {'verify': {'href': 'https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify', 'hints': {'allow': ['POST']}}}}], 'policy': {'allowRememberDevice': True, 'rememberDeviceLifetimeInMinutes': 0, 'rememberDeviceByDefault': False, 'factorsPolicyInfo': {}}}, '_links': {'cancel': {'href': 'https://id.resmed.eu/api/v1/authn/cancel', 'hints': {'allow': ['POST']}}}}
2024-08-27 17:18:03.473 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] authn_client_id: emf6c38n74h97QBuT417
2024-08-27 17:18:03.473 DEBUG (MainThread) [custom_components.resmed_myair.client.rest_client] [authn_check] 2fa_url: https://id.resmed.eu/api/v1/authn/factors/emf6c38n74h97QBuT417/verify?rememberDevice=true
2024-08-27 17:18:03.474 ERROR (MainThread) [custom_components.resmed_myair.coordinator] Authentication Error while updating. AuthenticationError: Need to Re-Verify 2FA
2024-08-27 17:18:03.474 DEBUG (MainThread) [custom_components.resmed_myair.coordinator] Finished fetching myAir update data in 0.226 seconds (success: False)
2024-08-27 17:18:03.474 ERROR (MainThread) [homeassistant.helpers.entity_platform] resmed_myair raises exception ConfigEntryAuthFailed in forwarded platform sensor; Instead raise ConfigEntryAuthFailed before calling async_forward_entry_setups
lampje25 commented 2 months ago

Same error with 0.10-2FA as before. "ResMed myAir Account Setup is Incomplete. Login to the myAir website and ensure that CPAP data is showing. Also, ensure that the Time Zone is set under My Account." Logfile sent. I've tried to choose another timezone (Brussel) but still the same error. I don't think it has something to do with the timezone. Maybe the privacy options?

afbeelding

Ah, setting gewijzigd. Inloggen is nu wel gelukt. Helaas hier zelfde probleem.

@Snuffy2: send a mail with log

Snuffy2 commented 2 months ago

v0.0.12-2FA - Always use device token

If upgrading from any previous 2FA test version (v0.0.x-2FA) you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before upgrading. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

I spent a very long time looking at the Okta oauth2 workflows and looking at what is sent/received with each auth step. I finally found that an initial device token was not being generated and used in subsequent queries. I believe this was causing it to want to reauthenticate immediately after.

Please send me both working and failing debug logs so I can continue to refine as needed. If if is working, I'd appreciate several hours of logs (>2 hours) to review how it is updating the access token. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.

fmeus commented 2 months ago

Just installed 0.0.12 and the setup worked perfectly for me.

See attached logging resmed_success.log

londondev77 commented 2 months ago

Looking good for me too!

Log file removed due to it still containing some data that hasn't been redacted

Snuffy2 commented 2 months ago

Thanks @fmeus and @londondev77 for the logs. Looking specifically at the ones from @londondev77 >3 hours.

Overall, this looks really good. Hopefully it continues to work and get new access tokens as needed.

I see a couple of small things I need to change/improve, but if it continues to work for people, I'll get it packaged up into a PR and a release on the main repo.

I have also built a device reauthentication workflow that should prompt the user to redo the config flow setup if the authorization stops working (ex. if the MFA needs to be redone), but I've not really been able to test that at all. I'll likely release that part as is and will have to wait to see if it works or not down the line.

aeble commented 2 months ago

Awesome work, @snuffy2 - thanks so much for this!

On Thu, Aug 29, 2024 at 4:18 PM Snuffy2 @.***> wrote:

Thanks @fmeus https://github.com/fmeus and @londondev77 https://github.com/londondev77 for the logs. Looking specifically at the ones from @londondev77 https://github.com/londondev77 >3 hours.

  • The successful MFA from setting up the integration is being carried over into the data update coordinator successfully
  • The check for an active access token to reuse is working
  • When the access token expires (after 2 hours), a new one is properly being obtained without triggering MFA

Overall, this looks really good. Hopefully it continues to work and get new access tokens as needed.

I see a couple of small things I need to change/improve, but if it continues to work for people, I'll get it packaged up into a PR and a release on the main repo.

I have also built a device reauthentication workflow that should prompt the user to redo the config flow setup if the authorization stops working (ex. if the MFA needs to be redone), but I've not really been able to test that at all. I'll likely release that part as is and will have to wait to see if it works or not down the line.

— Reply to this email directly, view it on GitHub https://github.com/prestomation/resmed_myair_sensors/issues/25#issuecomment-2317821329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5HJJLUMMBZMU7DSPNST4TZT4UR5AVCNFSM5YWTR66KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMZRG44DEMJTGI4Q . You are receiving this because you were mentioned.Message ID: @.***>

-- Axel Eble Schützenallee 70 79102 Freiburg Germany cell: +49.160.666-5028

dhover commented 2 months ago

Yes, now v0.0.12-2FA works for me too!! Thanks a lot!

lampje25 commented 2 months ago

Yes, now v0.0.12-2FA works for me too!! Thanks a lot!

Snuffy2 commented 2 months ago

@dhover & @lampje25 interesting. You were both getting Incomplete Account errors. I didn't change anything that I'm aware of that would have fixed that. Glad it is working for you though.

dhover commented 2 months ago

I also didn't change anything. It's a miracle!

One question about the entity "CPAP Sleep Data Last Collected". The last value shown is "2024-08-29T05:23:15+00:00". If I compare this with the value shown in the web interface "Laatste synchronisatie 29 augustus 07:23". So it looks like the entity time is UTC time am I right? A minor suggestion would be to convert this time to the local timezone of HA.

dhover commented 2 months ago

In the logfile I still see a dictionary with key 'sub' which is better to redact! It contains the login name/mail address.

Snuffy2 commented 2 months ago

@dhover Yes, I missed a couple of things to redact that I'll fix in the next release. Please open a separate Issue for CPAP Sleep Data Last Collected

dhover commented 2 months ago

Yes, I missed a couple of things to redact that I'll fix in the next release. I think "fgDevicePatientId" is also a good one to redact.

dhover commented 2 months ago

Please open a separate Issue for CPAP Sleep Data Last Collected

57

londondev77 commented 2 months ago

I had to reauthenticate this morning. Have emailed the logs as there is still data that needs to be redacted so don't want to post it publicly.

Snuffy2 commented 2 months ago

v0.0.13-MFA - Don't trigger reauth if GraphQL update fails

If updating from a 2FA test version v0.0.12-2FA or higher, you can just update like normal

If updating from 2FA test version < v0.0.12-2FA, you must delete the existing ResMed myAir (Snuffy2 EU 2FA Dev) integration before updating. You don't need to delete the actual files, just the Integration Entries. Then you need to re-Add the integration.

2024-08-22_19-24-45

Looking at the logs from @londondev77, it triggered a reauth when getting sleep data failed at 2024-08-29 23:08. However, the authentication steps had succeeded. I changed the logic to not trigger a reauth if getting the sleep data fails but instead to just trigger an update fails error. Then, at the next update if the authentication fails it will trigger a reauth but at least we will know that authentication actually failed.

Please send me both working and failing debug logs so I can continue to refine as needed. If if is asking for reauthentication, please try to include the logs before it asked for reauth and while you reauthenticate. You can post them to this issue or email them to me at resmed2fatest@mail.snuffy2.com if you prefer.