-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nest] Add support for Smart Device Management (SDM) API #8947
Conversation
6b224b7
to
1804d20
Compare
6723a3b
to
8b401e7
Compare
fa346c4
to
65bb500
Compare
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/google-nest-device-access-console-now-available/105404/173 |
d719714
to
95a9b0e
Compare
0bbc788
to
1aecb8c
Compare
@wborn Suggestion: In The correct url to get the auth code is: With Also, I forgot to enable the correct API, so it would be nice to see that instruction in the config page as well. If API is not enabled, discovery will fail silently because the resultant json is:
After passing by all these, I can now successfully connect to my Nest thermostat as the old API is not available for me. I'm using your latest code from the source of this PR compiled locally. I don't know yet how to enable Pub/Sub because I can only see the Pub/Sub topic id. Not sure how to fill it out. Thanks for your awesome work and I hope this can get merged to openhab soon. |
Yes adding some docs on how to configure everything is one of the reasons why this PR is still WIP. 🙂 Getting an authorization code for accessing Pub/Sub is very similar to how it is done with Google Cloud TTS. The configuration is a lot easier now it can all be done by creating an account thing using the UI and configuring the authorization code to get the access/refresh tokens. |
13f5057
to
2b3b382
Compare
...ding.nest/src/main/java/org/openhab/binding/nest/internal/sdm/handler/SDMAccountHandler.java
Outdated
Show resolved
Hide resolved
Should the "not backward compatible" label be set? |
Signed-off-by: Wouter Born <[email protected]>
Generating the correct link on settings page after filling out the project id and client id would be awesome IMO |
I've fixed and improved the docs @techie66. That part got lost somewhere while copy/pasting. 👍 |
Hey I've also backported all the Nest SDM changes of my PR to 2.5.x for all the retro openHAB-ers. 🙂 |
Signed-off-by: Wouter Born <[email protected]>
It's nice to see the PR made it into OH 3.1! 🥳🎈 |
Related to openhab/openhab-addons#8947 Signed-off-by: Wouter Born <[email protected]>
Related to openhab/openhab-addons#8947 Signed-off-by: Wouter Born <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]> Signed-off-by: Luca Calcaterra <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]> Signed-off-by: Luca Calcaterra <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]> Signed-off-by: Luca Calcaterra <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]>
* [nest] Add support for Smart Device Management (SDM) API * Reworks WWN implementation so that the thing types have a wwn_ prefix and the classes have a WWN prefix and reside in a 'wwn' package * Adds an SDM implementation which is also based on: https://github.com/bhigg-code/openhab-addons/tree/2.5.x/bundles/org.openhab.binding.nestdeviceaccess * Adds unit tests for (de)serialization of the SDM and Pub/Sub API requests and responses * Updates the binding documentation for the changes and additions Fixes openhab#8664 Also-by: Brian Higginbotham <[email protected]> Signed-off-by: Wouter Born <[email protected]> * Fix and improve documentation Signed-off-by: Wouter Born <[email protected]> * Always use UTF8 when decoding SDM events Signed-off-by: Wouter Born <[email protected]>
is there a reason why OATH2 is implemented as a "web application" instead of a "desktop application". Openhab is certainly is not a web-application, it would make more sense if the OATH2 account is registered as a "desktop application". Is it possible to update the nest_sdm addon to support OATH2 account of type "desktop application" as well. thanks. |
See: https://support.google.com/cloud/answer/6158849#zippy=%2Cweb-applications%2Cnative-applications
It would be nice when we can use openHAB in the redirect URI so it is easier to configure this. |
Wborn, I reviewed the code base of TTS and nest-sdm yesterday. What I observed was that the application type used to be "tv and media devices", which is similar to desktop application type. Since Google OATH2 depreciated OOB (out of bound redirect), openhab began to change the application type to web application, and I believe this was recommended by the SDM api. Regardless, the authentication flow is too complicated for a typical end user. This whole process can be simplified by implementing a redirect backend, that can be hosted on openhab.org or somewhere in the cloud that everyone can use. This whole process of issuing manual post request and then copy/past authorization code is just too tedious, we need to simplify the common OATH2 verification process for OH users. Thanks for the prompt reply, btw. |
I think it should be possible to redirect the browser to your own OH instance even if it does not expose any ports to the Internet. Some bindings already have a servlet for handling such a redirect (see SpotifyAuthServlet). But I think it would be better if such flows are also supported by the openHAB Core so servlets handling the redirect do not have to be duplicated in each binding that uses (Google) OAuth 2. 🙂 |
good idea! Please address it to the core developers. |
Fixes #8664
The following bundles can be used for testing the changes:
For documentation, see the updated README.md.