As we know something has changed on home-connect.
When creating an application there are 2 options for OAuth Flow:
1. Authorization Code Grant Flow
2. Device Flow
When visiting the home-connect APi documentatie site https://api-docs.home-connect.com/authorization/ for authorisation then there can be read that both flows require user input.
Therefor I have adjusted the code which can be found on https://github.com/Xavier82/Domoticz-Ho ... ect-Plugin
Modifications:
1. file added (config.py)
2. files modified (plugin.py and homeconnecthelper.py)
I own only a dishwasher so thats the only device I could test with.
But I think the modifications which I did are useable for other devices.
To install use the same instructions as mentioned on https://github.com/mario-peters/Domotic ... ect-Plugin in the wiki.
Make sure to have a login at https://singlekey-id.com/nl/home/ or migrated from home-connect.com to singlekey-id.com and you have the app installed.
Steps to be taken:
go to https://developer.home-connect.com/ create an account, make sure the account has the same username/emailaddress as your home-connect/SinglekeyID account and the same password!
next create an application (based on device flow)
Copy the client_id
In Domoticz the hardware plugin:
paste the client_id in the hardware plugin and make sure you have the correct device E-number and the correct scope.
Do not press "ADD" yet!!
First open the file homeconnecthelper.py on the directory /domoticz/plugins/Domoticz-Home-Connect-Plugin and add the client_ID number.
The add the APP_NAME in the file, which has to be the same name as used in the developer.home-connect.com created application.
Save the file.
go back to Domoticz and press "Add".
Go to the logging.
If everything went ok you will see some logging lines:
Code: Select all
Siemens Home Connect: <Response [200]>
Siemens Home Connect: device_code: XXXXX-AAAAAA-BBBBB-CCCCC-DDDDDDDDDDDDD
Siemens Home Connect: verification_uri_complete: https://api.home-connect.com/security/oauth/device_verify?user_code=XXXX-XXXX
Siemens Home Connect: Device "XXXXX-AAAAAA-BBBBB-CCCCC-DDDDDDDDDDDDD" is authorized by Home-Connect.
Siemens Home Connect: {
"error": "authorization_pending",
"error_description": "The authorization request is still pending as the end-user hasn't yet completed the user interaction steps"
}
Siemens Home Connect: Device "XXXXX-AAAAAA-BBBBB-CCCCC-DDDDDDDDDDDDD" has token:
Siemens Home Connect: Visit the following URL to complete the authorization: https://api.home-connect.com/security/oauth/device_verify?user_code=XXXX-XXXX
Code: Select all
https://api.home-connect.com/security/oauth/device_verify?user_code=XXXX-XXXX
You will need to login with username/email on home-connect.com after pressing login you will be forwarded to singlekey-id.com and you will be requested to enter the password. After password you need to grant access, press the approve button, you will now see the remark notification "You have granted access to the device. Please check your device for next steps."
Next go back quickly to Domoticz logging...if everything went well you will now see something like:
Code: Select all
Siemens Home Connect: Access Token: REALLY.LONG.TOKEN_CODE
Siemens Home Connect: Enumber: SNxxxxxxx/14
Siemens Home Connect: haId: haIdnumber
Siemens Home Connect: Listen on Home-Connect Webserver - Port: 8085
Not all devices are in the code yet, nor their features.
Main script is owned by MarioPeters.
I can't give a lot of support, sorry for that.
Things to fix:
Code: Select all
Error: Siemens Home Connect: HTTP Error: 429 Client Error: Too Many Requests for url: https://api.home-connect.com/api/homeappliances/XXXXXXXXXXXX/settings/BSH.Common.Setting.PowerState
Code: Select all
Amount-based Rate Limits
Generally if too many requests are sent, further requests are rejected with the HTTP status code 429.
The following limits are currently configured:
10 event monitoring channels per client and Home Connect user account at any time (the request for further channels will be blocked)
10 requests per second on average (20 requests max. burst) with leaky bucket algorithm, otherwise HTTP 429 error