speleolontra / daikin_residential_altherma

Home Assistant Integration specific for BRP069A78 Heat Pump Model, via Daikin App Onecta. Users have good experience also for BRP069A62 and BRP069A61 (but not tested directly).
GNU General Public License v3.0
96 stars 15 forks source link

[Issue]: Failed to retrieve access token #200

Closed SanderDN closed 9 months ago

SanderDN commented 10 months ago

I manually set up the integration, and configured my username and password in homeassistant's configuration.yml. On startup, I see the following error logs:

2023-12-04 12:12:16.628 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration daikin_residential_altherma 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
2023-12-04 12:12:18.461 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Initialing Daikin Residential API...
2023-12-04 12:12:18.461 INFO (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Daikin Residential API initialized.
2023-12-04 12:12:18.461 INFO (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Retrieving new TokenSet...
2023-12-04 12:12:33.704 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] STATE: aiKkf_CGEKVJ4n5dwvGO067u7[redacted]
2023-12-04 12:12:49.228 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] SAMLCONTEXT: eu1_964626835798_9f5e7b11-e55a-[redacted]
2023-12-04 12:12:49.431 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERSION: 15617-3-28361460
2023-12-04 12:12:49.930 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] LOGIN REPLY: {'callId': '[redacted]', 'errorCode': 0, 'apiVersion': 2, 'statusCode': 200, 'statusReason': 'OK', 'time': '2023-12-04T11:12:49.902Z', 'registeredTimestamp': 1700061897, 'UID': '729eb36102[redacted]', 'UIDSignature': 'Abym+zRJfienxKK4z3zEKKRkKkA=', 'signatureTimestamp': '1701688369', 'created': '2023-11-15T15:24:47.609Z', 'createdTimestamp': 1700061887, 'isActive': True, 'isRegistered': True, 'isVerified': True, 'lastLogin': '2023-12-04T11:12:49.849Z', 'lastLoginTimestamp': 1701688369, 'lastUpdated': '2023-11-15T15:33:38.845Z', 'lastUpdatedTimestamp': 1700062418845, 'loginProvider': 'site', 'oldestDataUpdated': '2023-11-15T15:24:47.609Z', 'oldestDataUpdatedTimestamp': 1700061887609, 'profile': {'firstName': 'Sander', 'lastName': '...', 'country': 'BE', 'email': '[redacted]@gmail.com'}, 'registered': '2023-11-15T15:24:57.190Z', 'socialProviders': 'site', 'verified': '2023-11-15T15:25:09.172Z', 'verifiedTimestamp': 1700061909172, 'newUser': False, 'sessionInfo': {'login_token': 'st2.s.AcbHa1sqJQ.og6cKLRSrxgshHfs57vtAaHsjD[redacted]', 'expires_in': '31536000'}}
2023-12-04 12:13:17.049 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:14:17.119 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:15:17.185 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:16:17.247 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:17:17.314 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:17:17.805 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward
2023-12-04 12:18:17.374 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:19:17.424 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:19:22.587 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERIFIER: TrMMyfMJiG0F08rb8xs.C1uleYF5tsQ[redacted]
2023-12-04 12:19:22.588 ERROR (MainThread) [custom_components.daikin_residential_altherma.config_flow] Failed to retrieve Access Token: ('Failed to retrieve access token: %s', KeyError('code'))

Perhaps noteworthy, when starting out with the daikin onecta app, I used the google social login with another email address. I then created a second account (the one configured currently in configuration.yml), and shared the heatpump of the social login with the current email/password account. Perhaps this is causing issues?

jwillemsen commented 10 months ago

See also https://github.com/rospogrigio/daikin_residential#known-issues-and-troubleshooting

SanderDN commented 10 months ago

Recreated my account from scratch, and run into the same I think:

2023-12-04 16:31:34.646 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] RELAYSTATE: H4sIAAAAAAAAAD2R23KqMBSG3yXXxgYCBrxTq45WqgUP4J49TEgChDMoxdrZ777Tm86si2_mP6zMyjegYApEDwdxu0Mt9HYbu902jIARiJSyeF0oYopIl2N7gvQY8ZtV5ChFZPL5KbMqUgauDJzKXFZ9JWMp-PTlpagTWSlNKI3VXCiMFXozZ6cwAdM_oG5EJTn4OwKpUtrs5klj5Rx9I9N2Q_CeWeVhi063BNpm-UjohZQzox8G3VEFUiV2GXFb7VKHQ7X0LP_N3-Vy8zz62PR9hIY2y_a5K5bvi-Qnkf1s182JwlwhbHcXSpfkK3TN6lo0LtZLvXCD9-XejG-uP9t_iIgdmVxW-axanMTxiToyhE9yflvYlvXs5nNvdQzIOsWbNP9y5GXz6PvTx_766NDjOk_lNXUCjgs3CURqr8-rotx0ZwPOD3cWldckXIeeGXQo9w62L0_2qr1svZl3MVaZAxO6StqgIa-HzaBeXPxeGKoTs6LuOWy6mo9pf0_Hvx84piV91hWrk0re6zGrS5UtwVQjSA22bDwCDZjGtLiJEehUaWQKg6IogtjgDBoUIxhpmMIYaZGm64TojKqOu7KGItJ1zpEJGWYYGhPLgpZywIgQKza5oU9sA_z7D1paPNVUAgAA.H4sIAAAAAAAAAHs879Kj6DKHr-aR-dZZB9iqqn4dLZr3WedvSmVD-rkUiTsAvNc5qCAAAAA.3
2023-12-04 16:32:01.158 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:33:01.222 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:34:01.292 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:35:01.363 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:36:01.422 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:36:02.005 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward
2023-12-04 16:37:01.493 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:38:01.566 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 16:38:06.398 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] DAIKINUNIFIED1: <Response [302]>
2023-12-04 16:38:06.399 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] _doAccessTokenRequest: daikinunified://login?error_description=Request+expired&state=qjsSi4FMTX4j1LwYNj8mPJ0Usg-95mxgaW7mA4uww2M&error=access_denied
2023-12-04 16:38:06.399 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERIFIER: giHlNw52nkdUzEk_Zm4Pkz6AKTTQbhUU9QurbbRrdhaC5jlRcI1f_WovgXT59NBZ
2023-12-04 16:38:06.400 ERROR (MainThread) [custom_components.daikin_residential_altherma.config_flow] Failed to retrieve Access Token: ('Failed to retrieve access token: %s', KeyError('code'))
jwillemsen commented 9 months ago

Have you tried to restart HA a few times? Does the onecta app work?

sanderdeneve-tomtom commented 9 months ago

Restarting HA did not work. The Onecta app works.

I was able to run the script at https://github.com/rospogrigio/daikin_residential/blob/master/tools/dump_json.py using my username and password, and the following data popped out:

[
    {
        "_id": "[REDACTED]",
        "deviceModel": "Altherma",
        "embeddedId": "[REDACTED]",
        "id": "[REDACTED]",
        "isCloudConnectionUp": {
            "settable": false,
            "value": true
        },
        "managementPoints": [
            {
                "embeddedId": "gateway",
                "firmwareVersion": {
                    "maxLength": 8,
                    "settable": false,
                    "value": "3.2.5"
                },
                "iconId": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": 3
                },
                "ipAddress": {
                    "maxLength": 15,
                    "settable": false,
                    "value": "[REDACTED]"
                },
                "isFirmwareUpdateSupported": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": true
                },
                "macAddress": {
                    "maxLength": 17,
                    "settable": false,
                    "value": "[REDACTED]"
                },
                "managementPointCategory": "secondary",
                "managementPointType": "gateway",
                "modelInfo": {
                    "maxLength": 9,
                    "settable": false,
                    "value": "BRP069A78"
                },
                "name": {
                    "maxLength": 63,
                    "requiresReboot": false,
                    "settable": true,
                    "value": "Gateway"
                },
                "serialNumber": {
                    "maxLength": 16,
                    "settable": false,
                    "value": "[REDACTED]"
                },
                "ssid": {
                    "maxLength": 9,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "daikin-ap"
                },
                "wifiConnectionSSID": {
                    "maxLength": 32,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "[REDACTED]"
                },
                "wifiConnectionStrength": {
                    "maxValue": 0,
                    "minValue": -90,
                    "requiresReboot": false,
                    "settable": false,
                    "stepValue": 1,
                    "value": -51
                }
            },
            {
                "consumptionData": {
                    "ref": "#consumptionData",
                    "requiresReboot": false,
                    "settable": false,
                    "value": {
                        "electrical": {
                            "heating": {
                                "d": [],
                                "m": [],
                                "w": []
                            }
                        }
                    }
                },
                "controlMode": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": "roomTemperature",
                    "values": [
                        "leavingWaterTemperature",
                        "externalRoomTemperature",
                        "roomTemperature"
                    ]
                },
                "embeddedId": "climateControlMainZone",
                "errorCode": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": ""
                },
                "holidayMode": {
                    "ref": "#holidayMode",
                    "requiresReboot": false,
                    "settable": true,
                    "value": {
                        "enabled": false,
                        "endDate": "2017-01-01",
                        "startDate": "2017-01-01"
                    }
                },
                "iconId": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": 8
                },
                "isHolidayModeActive": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInEmergencyState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInErrorState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInInstallerState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInWarningState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "managementPointCategory": "primary",
                "managementPointSubType": "mainZone",
                "managementPointType": "climateControl",
                "name": {
                    "maxLength": 63,
                    "requiresReboot": false,
                    "settable": true,
                    "value": ""
                },
                "onOffMode": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": "on",
                    "values": [
                        "off",
                        "on"
                    ]
                },
                "operationMode": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": "heating",
                    "values": [
                        "heating"
                    ]
                },
                "schedule": {
                    "ref": "#schedule",
                    "settable": true,
                    "value": {
                        "currentMode": {
                            "settable": false,
                            "value": "heating",
                            "values": [
                                "heating"
                            ]
                        },
                        "modes": {
                            "heating": {
                                "currentSchedule": {
                                    "requiresReboot": false,
                                    "settable": true,
                                    "value": "scheduleHeatingRT1",
                                    "values": [
                                        "scheduleHeatingRT1",
                                        "scheduleHeatingRT2",
                                        "scheduleHeatingRT3"
                                    ]
                                },
                                "enabled": {
                                    "requiresReboot": false,
                                    "settable": true,
                                    "value": true
                                },
                                "meta": {
                                    "actionTypes": {
                                        "roomTemperature": {
                                            "maxValue": 30,
                                            "minValue": 12,
                                            "settable": false,
                                            "stepValue": 1
                                        }
                                    },
                                    "consecutiveActionsAllowed": true,
                                    "maxActionsPerActionPeriod": 6,
                                    "maxSchedules": 3,
                                    "minIntervalBetweenActions": "00:10:00"
                                },
                                "schedules": {
                                    "scheduleHeatingRT1": {
                                        "actions": {},
                                        "meta": {
                                            "actionPeriods": [
                                                "monday",
                                                "tuesday",
                                                "wednesday",
                                                "thursday",
                                                "friday",
                                                "saturday",
                                                "sunday"
                                            ],
                                            "isReadOnly": false
                                        },
                                        "name": {
                                            "requiresReboot": false,
                                            "settable": true,
                                            "value": "User defined 1"
                                        },
                                        "settable": true
                                    },
                                    "scheduleHeatingRT2": {
                                        "actions": {},
                                        "meta": {
                                            "actionPeriods": [
                                                "monday",
                                                "tuesday",
                                                "wednesday",
                                                "thursday",
                                                "friday",
                                                "saturday",
                                                "sunday"
                                            ],
                                            "isReadOnly": false
                                        },
                                        "name": {
                                            "requiresReboot": false,
                                            "settable": true,
                                            "value": "User defined 2"
                                        },
                                        "settable": true
                                    },
                                    "scheduleHeatingRT3": {
                                        "actions": {},
                                        "meta": {
                                            "actionPeriods": [
                                                "monday",
                                                "tuesday",
                                                "wednesday",
                                                "thursday",
                                                "friday",
                                                "saturday",
                                                "sunday"
                                            ],
                                            "isReadOnly": false
                                        },
                                        "name": {
                                            "requiresReboot": false,
                                            "settable": true,
                                            "value": "User defined 3"
                                        },
                                        "settable": true
                                    }
                                }
                            }
                        }
                    }
                },
                "sensoryData": {
                    "ref": "#sensoryData",
                    "settable": false,
                    "value": {
                        "leavingWaterTemperature": {
                            "maxValue": 127,
                            "minValue": -127,
                            "requiresReboot": false,
                            "settable": false,
                            "stepValue": 1,
                            "value": 29
                        },
                        "outdoorTemperature": {
                            "maxValue": 127,
                            "minValue": -127,
                            "requiresReboot": false,
                            "settable": false,
                            "stepValue": 1,
                            "value": 10
                        },
                        "roomTemperature": {
                            "maxValue": 127,
                            "minValue": -127,
                            "requiresReboot": false,
                            "settable": false,
                            "stepValue": 0.1,
                            "value": 23.2
                        }
                    }
                },
                "setpointMode": {
                    "requiresReboot": true,
                    "settable": false,
                    "value": "weatherDependent",
                    "values": [
                        "fixed",
                        "weatherDependent"
                    ]
                },
                "temperatureControl": {
                    "ref": "#temperatureControl",
                    "settable": true,
                    "value": {
                        "operationModes": {
                            "auto": {
                                "setpoints": {
                                    "leavingWaterOffset": {
                                        "maxValue": 10,
                                        "minValue": -10,
                                        "requiresReboot": false,
                                        "settable": true,
                                        "stepValue": 1,
                                        "value": 3
                                    },
                                    "roomTemperature": {
                                        "maxValue": 30,
                                        "minValue": 12,
                                        "requiresReboot": false,
                                        "settable": true,
                                        "stepValue": 0.5,
                                        "value": 23.5
                                    }
                                }
                            },
                            "cooling": {
                                "setpoints": {}
                            },
                            "heating": {
                                "setpoints": {
                                    "leavingWaterOffset": {
                                        "maxValue": 10,
                                        "minValue": -10,
                                        "requiresReboot": false,
                                        "settable": true,
                                        "stepValue": 1,
                                        "value": 3
                                    },
                                    "roomTemperature": {
                                        "maxValue": 30,
                                        "minValue": 12,
                                        "requiresReboot": false,
                                        "settable": true,
                                        "stepValue": 0.5,
                                        "value": 23.5
                                    }
                                }
                            }
                        }
                    }
                }
            },
            {
                "consumptionData": {
                    "ref": "#consumptionData",
                    "requiresReboot": false,
                    "settable": false,
                    "value": {
                        "electrical": {
                            "heating": {
                                "d": [],
                                "m": [],
                                "w": []
                            }
                        }
                    }
                },
                "embeddedId": "domesticHotWaterTank",
                "errorCode": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": ""
                },
                "heatupMode": {
                    "requiresReboot": true,
                    "settable": false,
                    "value": "reheatOnly",
                    "values": [
                        "reheatOnly",
                        "reheatSchedule",
                        "scheduleOnly"
                    ]
                },
                "iconId": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": 9
                },
                "isHolidayModeActive": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInEmergencyState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInErrorState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInInstallerState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isInWarningState": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "isPowerfulModeActive": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": false
                },
                "managementPointCategory": "primary",
                "managementPointType": "domesticHotWaterTank",
                "name": {
                    "maxLength": 63,
                    "requiresReboot": false,
                    "settable": true,
                    "value": ""
                },
                "onOffMode": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": "on",
                    "values": [
                        "off",
                        "on"
                    ]
                },
                "operationMode": {
                    "settable": false,
                    "value": "heating",
                    "values": [
                        "heating"
                    ]
                },
                "powerfulMode": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": "off",
                    "values": [
                        "off",
                        "on"
                    ]
                },
                "sensoryData": {
                    "ref": "#sensoryData",
                    "settable": false,
                    "value": {
                        "tankTemperature": {
                            "maxValue": 127,
                            "minValue": -127,
                            "requiresReboot": false,
                            "settable": false,
                            "stepValue": 1,
                            "value": 50
                        }
                    }
                },
                "setpointMode": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": "fixed",
                    "values": [
                        "fixed",
                        "weatherDependent"
                    ]
                },
                "temperatureControl": {
                    "ref": "#temperatureControl",
                    "settable": true,
                    "value": {
                        "operationModes": {
                            "heating": {
                                "setpoints": {
                                    "domesticHotWaterTemperature": {
                                        "maxValue": 60,
                                        "minValue": 30,
                                        "requiresReboot": false,
                                        "settable": true,
                                        "stepValue": 1,
                                        "value": 50
                                    }
                                }
                            }
                        }
                    }
                }
            },
            {
                "eepromVersion": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "3608726-65D"
                },
                "embeddedId": "indoorUnitHydro",
                "iconId": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": 4
                },
                "managementPointCategory": "secondary",
                "managementPointType": "indoorUnitHydro",
                "modelInfo": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "EHVH08S23EJ6V"
                },
                "name": {
                    "maxLength": 63,
                    "requiresReboot": false,
                    "settable": true,
                    "value": "Indoor Hydro Unit"
                },
                "softwareVersion": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "0223"
                }
            },
            {
                "embeddedId": "outdoorUnit",
                "iconId": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": 5
                },
                "managementPointCategory": "secondary",
                "managementPointType": "outdoorUnit",
                "name": {
                    "maxLength": 63,
                    "requiresReboot": false,
                    "settable": true,
                    "value": "Outdoor Unit"
                },
                "softwareVersion": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "FFFF"
                }
            },
            {
                "dateTime": {
                    "requiresReboot": false,
                    "settable": false,
                    "value": "2023-12-08T16:00:33"
                },
                "embeddedId": "userInterface",
                "firmwareVersion": {
                    "deprecated": "DEPRECATED",
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "7.3.0"
                },
                "iconId": {
                    "requiresReboot": false,
                    "settable": true,
                    "value": 6
                },
                "managementPointCategory": "secondary",
                "managementPointType": "userInterface",
                "miconId": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "20010E09"
                },
                "modelInfo": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "EHVH08S23EJ6V"
                },
                "name": {
                    "maxLength": 63,
                    "requiresReboot": false,
                    "settable": true,
                    "value": "User Interface"
                },
                "softwareVersion": {
                    "maxLength": 16,
                    "requiresReboot": false,
                    "settable": false,
                    "value": "7.3.0"
                }
            }
        ],
        "timestamp": "2023-12-08T15:06:52.101Z",
        "type": "heating-wlan"
    }
]
jwillemsen commented 9 months ago

Ok, so you do get some data, I do see that consumptionData is empty, could you enable debug logging (see readme) and restart HA and attach the logs?

Also I would be interested to get the logs when you use https://github.com/jwillemsen/daikin_residential_altherma/tree/jwi-allsensorsupdate, that contains a lot of refactoring and more logging.

sanderdeneve-tomtom commented 9 months ago

The empty consumptionData was me redacting some data..

I tried that repo & branch, and the issue remains the same. It seems like it goes wrong in the step "Fetch the daikinunified URL".

I added some logging for what the url, headers and data is in the call that goes wrong:

2023-12-08 17:07:22.738 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] calling idpresponse with url: https://daikin-unicloud-prod.auth.eu-west-1.amazoncognito.com/saml2/idpresponse
2023-12-08 17:07:22.738 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] calling idpresponse with headers: {'content-type': 'application/x-www-form-urlencoded', 'cookie': 'csrf-state=DddioYqTO6B6--7F4SfMIRA3ix-Q6Vc9iRapK1u5LnP7rzLNhIWOZSvNybbkZealsuFOOVqT6bJRhlqk[REDACTED]; csrf-state-legacy=DddioYqTO6B6--7F4SfMIRA3ix-Q6Vc9iRapK1u5LnP7rzLNhIWOZSvNybbkZeal[REDACTED]'}
2023-12-08 17:07:22.738 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] calling idpresponse with data: {'SAMLResponse': 'PHNhbWxwOlJlc3BvbnNlIElEPSJfMzFiNWQ0Y2QtMTQ0OC00YTQzLTlkNjgtMWI5OWE4OGRmZmFlIiBJblJlc3BvbnNlVG89Il84ODQ0OWQxZS0yNmIwLTQ3YTMtOGYzNC1kOGNhNjVjNGE2ZDkiIFZlcnNpb249IjIuMCIgSXNzdWVJbnN0YW50PSIyMDIzLTEyLTA4VDE2OjA3OjIyWiIgRGVzdGluYXRpb249Imh0dHBzOi8vZGFpa2luLXVuaWNsb3VkLXByb2QuYXV0aC5ldS13ZXN0LTEuYW1hem9uY29nbml0by5jb20vc2FtbDIvaWRwcmVzcG9uc2UiIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiPjxzYW1sOklzc3VlciB4bWxuczpzYW1sPS[REDACTED]', 'RelayState': 'H4sIAAAAAAAAAD2RS3PiMBCE_4vOiMi2kG1uPJxdCAEbO1Bka4uS9cCKjeU3gdT-91UuuX1V3T0z1fMFKJgC0cObaDtonePNyq_XFXPBCKRGWSwXhpght8kdnyBbIt56RY4y5JJhUB9lagzcGDhVuSr7Ukkl-PTpqdAXVRpNGI1pLgxKg_HsdWPwAqZ_gK[REDACTED]'}
2023-12-08 17:07:49.819 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-08 17:08:49.889 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-08 17:09:49.954 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-08 17:10:50.013 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
V2023-12-08 17:11:50.077 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-08 17:11:50.645 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward
2023-12-08 17:12:50.138 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-08 17:13:54.735 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] DAIKINUNIFIED1: <Response [302]>
2023-12-08 17:13:54.736 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] DAIKINUNIFIED_URL: daikinunified://login?error_description=Request+expired&state=BenNaeUtErQJSDWfRq_Dsn470ToB1kuY_d_-vYLvnTQ&error=access_denied
2023-12-08 17:13:54.737 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] parsing response from open id client
2023-12-08 17:13:54.737 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] _doAccessTokenRequest: daikinunified://login?error_description=Request+expired&state=BenNaeUtErQJSDWfRq_Dsn470ToB1kuY_d_-vYLvnTQ&error=access_denied
2023-12-08 17:13:54.737 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERIFIER: c8j6BJ20S0KEepSrOum2HIj8rLi9y8~OKKMMsZFdAmsGBEBPzm2DW6Cm9f~ss77~
2023-12-08 17:13:54.738 ERROR (MainThread) [custom_components.daikin_residential_altherma.config_flow] Failed to retrieve Access Token: ('Failed to retrieve access token: %s', KeyError('code'))
jwillemsen commented 9 months ago

I see access denies, is your password correct?

sanderdeneve-tomtom commented 9 months ago

Yes of course.. In the previous steps I got a login token successfully

jwillemsen commented 9 months ago

Date/time/timezone also correct, try to synchronise with ntp manually

jens-dambruch commented 9 months ago

I manually set up the integration, and configured my username and password in homeassistant's configuration.yml. On startup, I see the following error logs:

2023-12-04 12:12:16.628 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration daikin_residential_altherma 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
2023-12-04 12:12:18.461 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Initialing Daikin Residential API...
2023-12-04 12:12:18.461 INFO (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Daikin Residential API initialized.
2023-12-04 12:12:18.461 INFO (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Retrieving new TokenSet...
2023-12-04 12:12:33.704 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] STATE: aiKkf_CGEKVJ4n5dwvGO067u7[redacted]
2023-12-04 12:12:49.228 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] SAMLCONTEXT: eu1_964626835798_9f5e7b11-e55a-[redacted]
2023-12-04 12:12:49.431 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERSION: 15617-3-28361460
2023-12-04 12:12:49.930 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] LOGIN REPLY: {'callId': '[redacted]', 'errorCode': 0, 'apiVersion': 2, 'statusCode': 200, 'statusReason': 'OK', 'time': '2023-12-04T11:12:49.902Z', 'registeredTimestamp': 1700061897, 'UID': '729eb36102[redacted]', 'UIDSignature': 'Abym+zRJfienxKK4z3zEKKRkKkA=', 'signatureTimestamp': '1701688369', 'created': '2023-11-15T15:24:47.609Z', 'createdTimestamp': 1700061887, 'isActive': True, 'isRegistered': True, 'isVerified': True, 'lastLogin': '2023-12-04T11:12:49.849Z', 'lastLoginTimestamp': 1701688369, 'lastUpdated': '2023-11-15T15:33:38.845Z', 'lastUpdatedTimestamp': 1700062418845, 'loginProvider': 'site', 'oldestDataUpdated': '2023-11-15T15:24:47.609Z', 'oldestDataUpdatedTimestamp': 1700061887609, 'profile': {'firstName': 'Sander', 'lastName': '...', 'country': 'BE', 'email': '[redacted]@gmail.com'}, 'registered': '2023-11-15T15:24:57.190Z', 'socialProviders': 'site', 'verified': '2023-11-15T15:25:09.172Z', 'verifiedTimestamp': 1700061909172, 'newUser': False, 'sessionInfo': {'login_token': 'st2.s.AcbHa1sqJQ.og6cKLRSrxgshHfs57vtAaHsjD[redacted]', 'expires_in': '31536000'}}
2023-12-04 12:13:17.049 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:14:17.119 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:15:17.185 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:16:17.247 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:17:17.314 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:17:17.805 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward
2023-12-04 12:18:17.374 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:19:17.424 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: daikin_residential_altherma
2023-12-04 12:19:22.587 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERIFIER: TrMMyfMJiG0F08rb8xs.C1uleYF5tsQ[redacted]
2023-12-04 12:19:22.588 ERROR (MainThread) [custom_components.daikin_residential_altherma.config_flow] Failed to retrieve Access Token: ('Failed to retrieve access token: %s', KeyError('code'))

Perhaps noteworthy, when starting out with the daikin onecta app, I used the google social login with another email address. I then created a second account (the one configured currently in configuration.yml), and shared the heatpump of the social login with the current email/password account. Perhaps this is causing issues?

The same happens here... set it up today, Daikin app works normally. The log ends with this: 2023-12-10 16:31:29.609 DEBUG (MainThread) [custom_components.daikin_residential_altherma.daikin_api] VERIFIER: REDACTED 2023-12-10 16:31:29.609 ERROR (MainThread) [custom_components.daikin_residential_altherma.config_flow] Failed to retrieve Access Token: ('Failed to retrieve access token: %s', KeyError('code'))

jwillemsen commented 9 months ago

@daikin-europe Any suggestions?

sanderdeneve-tomtom commented 9 months ago

I found the solution to my issue. As it turns out, the server I'm hosting Home Assistant on had an IPv6 address assigned. It was using that to access the daikin services. Further downstream, my IPv6 setup still has some issues, so it couldn't connect and gave the error message.

@jens-dambruch perhaps you could try to check if the following command works for you: ping daikin-unicloud-prod.auth.eu-west-1.amazoncognito.com

jens-dambruch commented 9 months ago

@sanderdeneve-tomtom ping shows PING daikin-unicloud-prod.auth.eu-west-1.amazoncognito.com(2a05:d018:478:8a02:3adb:515a:45f2:1c05 (2a05:d018:478:8a02:3adb:515a:45f2:1c05)) 56 data bytes --- daikin-unicloud-prod.auth.eu-west-1.amazoncognito.com ping statistics --- 577 packets transmitted, 0 received, 100% packet loss, time 589827ms

But its AWS, maybe they block ICMP so ping won't work. I tried to reach the server via browser and it seems to work... thanks for the hint anyway, does it work for you now? What did you change?

jwillemsen commented 9 months ago

Looks you are using ipv6 @jens-dambruch, can you try to disable ipv6 as @sanderdeneve-tomtom suggests?

sanderdeneve-tomtom commented 9 months ago

@jens-dambruch they probably block ICMP indeed.. The ping itself also fails for me, but doing the ping and seeing the IPv6 ip made me realize my IPv6 set up was being used, and that led me to the solution. Have you tried running the script over at https://github.com/rospogrigio/daikin_residential/blob/master/tools/dump_json.py ?

@jwillemsen I think you made the wrong conclusion, my issues were caused by IPv6, but the root cause was the amazoncognito servers being unreachable, there might be multiple reasons why @jens-dambruch has the same issue (firewall, networking issues, ...)

jens-dambruch commented 9 months ago

@jwillemsen, @sanderdeneve-tomtom i just disabled IPv6 in my HA instance and now it works! Thanks for the hints, but i have no idea what the actual Problem is. I run HA in a VM using QEMU and macvlan, maybe that can be the the problem. Anyway it works with IPv4 :+1:

jwillemsen commented 9 months ago

Great, closing this issue