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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Google Nest Device Access / SDM integration #41119
Add Google Nest Device Access / SDM integration #41119
Conversation
63fb0ae
to
bdacce0
Compare
6e60660
to
3a039d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should update or existing nest
integration, and not implement a new domain.
In the documentation pull request the question was asked: Why a new integration? Below is some context for thatrationale. Background:
Nothing too surprising here though, as different APIs obviously will have differences. Approach: Separate integrations: Alternative Approach: Update existing integration:
Alternative Approach: Replace existing integration: The existing nest API is not accepting new integrations, but still works for anyone who was already authorized to use it. Assumption: This is a non-starter as many members of the community would be upset by this given the above differences in the API (and the US$5 fee!) Alternative Approach: Custom Component: Another alternative could be to develop this as an entirely separate custom component, so that the complexity of diverging Nest APIs does not get introduced into the Home Assistant core. My impression is that Nest devices are popular enough that it is worth the effort to do the upfront design work to make this a core integration. I suspect that doing more development in a silo will also make review more difficult later. I am not pursuing this, but it is still a viable option. Python Library API: When examining the existing A compatibility layer here could theoretically abstract away the API differences, but I think the APIs differ enough that leaning into the recommended approach makes more sense here. Some user discussion: |
I'm scoping out more of what it would take to update
Question: Is it possible to have a single split point at the start of the integration, then load an entirely different set of platforms depending on a configuration setting? e.g. load sensory.py for old API and sensor_foo.py for new API? Using separate files (for everything but init) could be a path towards managing the complexity of having two separate API integrations within (Maybe I can try and find someone to work through some of this in more detail or an early review to understand preferred approaches, as I think its going to be a pretty painful review otherwise) |
In the end, the old API will not be supported. No new users can migrate to it and its a matter of time now. The |
I think the question is: Over what time frame? My assumption is that Home Assistant cares about keeping these existing users happy. I am too new to the community to make that judgement call, though I am happy to do the work. |
If I may weigh in as a fellow software engineer and current user of Home Assistant with a Nest Thermostat on the old API, I think that @allenporter has the right idea. While its true that the old API will eventually be fully deprecated, I imagine that is a year or more away. Creating this as a new integration allows both old and new integrations to co-exist without logistical nightmares. The old (let's call it legacy) integration could then be independently deprecated in the future when appropriate and user's directed to configure the new API prior to removing the legacy one. At that point the new integration would become the defacto standard and both would no longer be supported. That allows for a clean migration path allowing new users to get setup, existing users to not be forced into convolution, and more advanced/picky users to be satisfied with access to both in the meantime. |
I must agree with @WisdomWolf. I too am a software engineer and things like this always come back around in a nasty way. Having a completely new model of the Nest integration using the existing As much as it would be nice to keep the current integration, maybe using something to differentiate the old from the new wouldn't hurt. |
I would argue that adding a new integration is in line with the eventual goal of replacement and not at all at odds with that goal. If you think about the idea of replacement with physical objects, you first must have a new one to replace the old. I intend to replace my current vehicle with a Tesla, but I need to ensure that at no point do I have no vehicle. So I will first buy the Tesla prior to the end of my current lease and then after some time my existing vehicle will be removed from my garage and will effectively have been replaced by the newer Tesla. |
My first idea would be to tell people to just migrate to the new one. But less data + $5 is a non-starter for that. So the best option is that we keep it as 1 integration. Just because it is 1 integration, we don't need to have the code be intertwined. We can have 2 entity classes. # __init__.py
async def async_setup_entry(hass, entry):
if "SDM" not in entry.data:
return await async_setup_legacy_entry(hass, entry) # climate.py
from .climate_dsm import async_setup_dsm_entry
from .climate_legacy import async_setup_legacy_entry
async def async_setup_entry(hass, entry):
if "SDM" not in entry.data:
return await async_setup_legacy_entry(hass, entry)
return await async_setup_dsm_entry(hass, entry) And in |
cd4e935
to
896f64d
Compare
Why was this closed? |
I think it closed automatically when I reset my branch to address the comments. I'm fairly new to github, so apologies. Rest assured I'm still working on this, just rewriting some bits. I'll still go with a "one platform at a time" approach. Stay tuned. |
I'm with @balloob here; the existing integration can handle legacy and new approaches in one integration; understanding which users are on could be the complication/challenge. Adding the integration through UI/YAML should allow the user to choose which they are using (and also allow for the addition of two instances of the Nest integration (for users of Nest protect since that does not seem to be present on the new API). All existing integrations could be assumed to be Legacy when updating the integration/core version of HA. |
Yeah the split within the integration via separate files was my best thought for how to manage the complexity. Thanks for spelling it out balloob, I agree it should be possible. I don't yet see how to support both integrations at once giving my limited understanding of how config works. Can you have the same integration twice with two separate configs? If so, a pointer would help me. (Just want to make sure you aren't saying we want extra a degrees of freedom within the config to support both with one config stanza. ) |
To make it possible to set up two config flows, we should make the YAML config parameters different for the new client ID/secret, ie |
OK, that is what I was afraid of in
I'm happy to do this, but may be hesitant to go super configurable. |
I will definitely start with only supporting just new or old but not both concurrently. |
I realize this is already closed and things have already moved forward with th coexisting, but FWIW (and also as a software engineer), it seems google refers to the ecosystem as "Google Nest" (see screenshots) rather than just Nest. This helps them to separate it (slightly, but nonetheless it is different) from the original company. So IMO having it a separate integration under the name |
This has already been resolved and released. |
Breaking change
Proposed change
Create an integration with for the Google Nest Device Access program, using the Smart Device Management API. This is fairly bones with a single sensor platform for temperature and humidity sensors, using a polling API call using the pypi library google-nest-sdm. Authentication with Nest happens via OAuth and requires a decent amount of custom setup following the Google Nest Device Access instructions (requires a fee, creating a project id, and setting up oauth client credentials to get a client id and secret). Future planned enhancements include using a pull API, handling camera events, and controlling climate devices.
I have not yet added documentation for the integration, but the change contains a README.md for early developer instructions.
Type of change
Example entry for
configuration.yaml
:Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: