Home Connect - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Home Connect (/showthread.php?tid=3014) |
Home Connect - tomnord - 24.11.2020 Hello. Has anyone tried to control Home Connect units via the api? https://apiclient.home-connect.com/ There needs to be some authentication, and a key given with registration. If anyone could push me in the right direction regarding the authorization and token I would be greatfull. @Erwin ? RE: Home Connect - Erwin van der Zwart - 25.11.2020 Never tried to connect to this API, but it's RESTful so i have a lot of scripts to do that, there are a lot of them here on the forum.. Try looking for "Tesla" and there you have your starting point how to handle token request and auth header. Home Connect - tomnord - 11.02.2021 Hi Erwin. I've been trying to get the authenticatin part of the script to work, but I am having a hard time figuring out how to get hold of the client-secret. I'm guessing this is a init script that needs to be run once? I have the client-id and other credentials. Sent fra min SM-G980F via Tapatalk RE: Home Connect - admin - 12.02.2021 It should be provided to you when you create a new application in the Developer portal. RE: Home Connect - tomnord - 08.03.2021 I've gotten a bit further here. The HC API requires me to log in to my account and accept the API connection. I have made that part of the script, but the question is how to get this part of the script only to run once when needed. The return is a device_code and a url for logging in to HC account. If the function is run every cycle, the verification url changes, and the device_code also. Documentation: https://api-docs.home-connect.com/authorization?#device-flow Code: function GetDeviceCode() response_decode: Code: * table: RE: Home Connect - admin - 09.03.2021 After getting the device code you should send periodical requests to https://api.home-connect.com/security/oauth/token until you get a "200 OK" response. This will get you an access_token and a refresh_token. Put both into storage and use the access_token for all normal API calls. Since this token expires in one day you will need a scheduled script that will exchange the refresh_token for a new access_token/refresh_token. RE: Home Connect - tomnord - 09.03.2021 (09.03.2021, 06:54)admin Wrote: After getting the device code you should send periodical requests to https://api.home-connect.com/security/oauth/token until you get a "200 OK" response. This will get you an access_token and a refresh_token. Put both into storage and use the access_token for all normal API calls. Since this token expires in one day you will need a scheduled script that will exchange the refresh_token for a newWhat would be the best practice for getting the scrip mentioned above just to run once? Make an event script, and put the code in memory? Sent fra min SM-G980F via Tapatalk RE: Home Connect - Daniel - 09.03.2021 For testing you can paste it in to Sturt-up(init) script and press Run script. |