Google-Nest Offical Device Access Console Finally Released!

Sorry for the confusion. This is NOT a HACS application. Rather, you need to install and configure AppDaemon.

https://appdaemon.readthedocs.io/en/latest/INSTALL.html

If you are using HASSIO on Raspberry or similar, it is under the “Supervisor” tab, and then “Add-on Store”. Once you have it up and running, you will need to modify the apps.yaml (sample is included in GitHub) file under config/appdaemon/apps, and upload the nest.py file. You will need to add the keys to your secrets.yaml file.

I know it is not pretty, but didn’t feel like doing a build with a test setup for full integration. This lets me prototype faster, and work out the logic. However, the down side is it is not point and click.

Thanks for clarifying that! I managed to figure out the above with some smart googling and got appdaemon installed and your app configured. Just working through the ‘refresh_token’ part now as I did not have that from before…

Got it!

Let me know if you something doesn’t work. For whatever reason, I think it is due to the lack of low level integration, the Lovelace visualization doesn’t allow you to alter the temp, but works fine if you call the service “climate.set_temperature”. I tried to get the error checking for incomplete calls, but I haven’t fully baked the testing.

Maybe some of the logic will help the others.

I don’t have NEST camera’s so I didn’t build any support.

Note that I also create a temp sensor for each. The switch that is created is not fully implemented and really unneeded.

1 Like

First issue I see is…

Nest Thermostat F
I’d prefer C (Canada, eh!)

Set temp in F

OK, try the latest…

Google has a trait with:

“sdm.devices.traits.Settings”: {
“temperatureScale”: “FAHRENHEIT”

I read that and set an attribute called “unit_of_measure”. I think I updated it correctly for celsius, which is really to do no conversion if that trait is “CELSIUS”.

I am not willing to change mine to test, and not sure the attribute is named correctly. I pulled it from an existing temp sensor…

1 Like

And correct, the dev tool will let you call the service. Also, you can call the service from an automation as an action.

Trigger on being home, set action to call service climate.set_temperature…

Trigger on time of day…

Trigger on motion…

Trigger on outdoor temp…

You get the point.

1 Like

There’s conversion somewhere as the entity values and Nest values are slightly different…

Nest Entity Celsius

I created a helper input_number.set_temperature and have added it to lovelace dashboard.
Then an automation triggered by it:

alias: Change Thermostat Temperature
description: ''
trigger:
  - platform: state
    entity_id: input_number.set_temperature
    for: '00:00:03'
condition: []
action:
  - service: system_log.write
    data:
      message: 'Temperature set to {{ trigger.to_state.state | float }}'
      level: info
      logger: automations/change_thermostat_temperature
  - service: climate.set_temperature
    data:
      temperature: '{{ trigger.to_state.state | float }}'
    entity_id: climate.inside_nest_thermostat
mode: single

but the service call to climate.set_temperature is generating an error that it can’t find the referenced entity:

2020-11-02 18:14:45 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Running automation actions
2020-11-02 18:14:45 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Executing step call service
2020-11-02 18:14:45 INFO (MainThread) [automations/change_thermostat_temperature] Temperature set to 21.5
2020-11-02 18:14:45 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Executing step call service
2020-11-02 18:14:45 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.inside_nest_thermostat

Calling the same sequence via Developer Tools works:
dev tool climate.set_temperature

Any ideas?

Hi. I’m having a little problem. I have AppDaemon running and connected to my Nest config. I have 3 thermostats, 2 are showing up fine. 1 is erroring out as follows:

2020-11-03 04:31:02.583921 WARNING nest: nest: Entity climate.theresa’s_room_nest_thermostat not found in namespace default
2020-11-03 04:31:02.584808 INFO AppDaemon: nest: Entity climate.theresa’s_room_nest_thermostat created in namespace: default
2020-11-03 04:31:02.611505 WARNING HASS: Error setting Home Assistant state default.climate.theresa’s_room_nest_thermostat, {‘state’: ‘on’, ‘attributes’: {‘friendly_name’: ‘Theresa’s Room Nest Thermostat’, ‘entity_id’: ‘climate.theresa’s_room_nest_thermostat’, ‘hvac_mode’: ‘heat’, ‘preset_mode’: ‘heat’, ‘hvac_modes’: [‘heat’, ‘cool’, ‘heat_cool’, ‘off’], ‘preset_modes’: [‘heat’, ‘cool’, ‘heat_cool’, ‘off’], ‘current_temperature’: 62.2, ‘current_humidty’: 51, ‘hvac_action’: ‘idle’, ‘supported_features’: 19, ‘temperature’: 60.1}}
2020-11-03 04:31:02.612562 WARNING HASS: Code: 500, error: 500 Internal Server Error
Server got itself in trouble
2020-11-03 04:31:02.614989 WARNING nest: nest: Entity sensor.theresa’s_room_nest_thermostat_temp not found in namespace default
2020-11-03 04:31:02.616069 INFO AppDaemon: nest: Entity sensor.theresa’s_room_nest_thermostat_temp created in namespace: default
2020-11-03 04:31:02.636389 WARNING HASS: Error setting Home Assistant state default.sensor.theresa’s_room_nest_thermostat_temp, {‘state’: 62.2, ‘attributes’: {‘device_class’: ‘temperature’, ‘friendly_name’: ‘Theresa’s Room Nest Thermostat Temperature’}}
2020-11-03 04:31:02.637869 WARNING HASS: Code: 500, error: 500 Internal Server Error
Server got itself in trouble
2020-11-03 04:31:02.641819 WARNING nest: nest: Entity switch.theresa’s_room_nest_thermostat_switch not found in namespace default
2020-11-03 04:31:02.651101 INFO AppDaemon: nest: Entity switch.theresa’s_room_nest_thermostat_switch created in namespace: default
2020-11-03 04:31:02.681280 WARNING HASS: Error setting Home Assistant state default.switch.theresa’s_room_nest_thermostat_switch, {‘state’: ‘on’, ‘attributes’: {‘friendly_name’: ‘Theresa’s Room Nest Thermostat Switch’}}
2020-11-03 04:31:02.682184 WARNING HASS: Code: 500, error: 500 Internal Server Error
Server got itself in trouble

Thanks for your assistance.

This is how I do it in one of my scripts.

    - service: climate.set_temperature
      data_template:
        entity_id: climate.upstairs_thermostat
        temperature: > 
          {{ states('input_number.climate_thermostat_normal_temperature') | float }}
        hvac_mode: heat

Daniel, the temp difference is due to the NEST interface in the app rounding to the nearest .5, but he API provide a reading out to 4 decimal places. I round it to 1 decimal place. You will notice when you turn the dial on your NEST that you get multiple clicks before the number changes, but he API is recording it more precisely. HOWEVER, this set in HASS only updates every 30 seconds, so if you are tinkering, you will need to wait 30 seconds between changes.

dinan5,

Pull the latest from GitHub. I suspect your issue is the presence of an apostrophe, “’”, in the name. As I said, I didn’t thoroughly and robustly error check. But I just added a bit to delete the apostrophe and proactively handle any hyphens in the entity id.

I am certain there are other characters I should look for, but again, this a temporary solution until the awesome developers at HASS get the fully baked solution.

I suspect that Google is looking at the demand analysis before doing more integrations, at least I would if I was in their shoes. So, the more people we have making regular calls to the API and the more registrations they get, the higher the chance that we get NEST Protect API published. At least, that is what I tell myself.

I dont know if this will help anyone, however I have documented the setup in a much easier way than the Google docs show:

Prerequisites - obtain external address and add the subdomain location /auth/external/callback, eg with Nabu Casa (NOTE - do not add a port to the address):
https://[xxx].ui.nabu.casa/auth/external/callback
For non Nabu Casa users (probably need to add your port number):
https://[your_external_url]/auth/external/callback

  1. Browse to https://console.nest.google.com/device-access/project-list
  2. Create a new project.
  3. Enter a project name.
  4. Click on Skip.
  5. Select Enable and Create Project.
  6. Make a note of the Project ID and Pub/Sub Topic ID (full id).
  7. Browse to https://developers.google.com/nest/device-access/get-started.
  8. Find the blue box titled ‘Enable the API and get an OAuth 2.0 Client ID’ and click the button.
  9. Create a new project - call it whatever you want.
  10. Click Next.
  11. Give it a Product name - this will show up on the autorisation screen.
  12. Click Next.
  13. Choose ‘Web Server’ from the drop down.
  14. URL to enter is the external from above, eg https://xxx.ui.nabu.casa/auth/external/callback
  15. Click Create.
  16. Make a note of Client ID and Client Secret.
  17. Browse back to https://console.nest.google.com/device-access/project-list
  18. Go into the project.
  19. At the end of the OAuth Client ID line click the 3 buttons and choose Edit.
  20. Enter the Client ID from step 16 and click Save.
  21. Browse to https://console.developers.google.com/apis/library/pubsub.googleapis.com
  22. In the drop down top left slect your project.
  23. Click on blue box with Enable.
    NEW INSTRUCTIONS AT THIS POINT - SEE BELOW!
  24. Go back to HA, File Editor, configuration.yaml.
  25. Add the following lines and corresponding codes and change to your values:
nest:
  client_id: xxx.apps.googleusercontent.com
  client_secret: xxx
  project_id: xxx-xxx-xxx-xxx-xxx
  subscriber_id:  %SEE POINT N BELOW%
  1. Save the changes.
  2. Reboot HA.
  3. When HA has rebooted, use the external address eg Nabu Casa address, not the local IP address.
  4. Go to Configuration.
  5. Go to Integrations.
  6. Add the Nest integration.
  7. Select your Google account.
  8. Tick all the options and click Next.
  9. Choose your account.
  10. A warning is displayed, click on Advanced and Go To the address.
  11. Allow each popup.
    Done!

ADDITIONAL UPDATE 13/11/2020:
In adidtion to the above, after reading updated release notes (found here) I have the following additional instructions, to perform between point 23 and 24 above:
A. Browse to Device Access Console here: https://console.nest.google.com/device-access.
B. Go into your project.
C. Make a note of the pub/sub topic (eg projects/sdm-prod/topics/enterprise-xxx-xxx-xxx-xxx-xxx).
D. Browse to Google Cloud Platform found here: https://console.cloud.google.com/cloudpubsub/subscription/list
E. Click on ‘Create Subscription’
F. In ‘Subscription ID’ field enter any value, eg ‘Nest’
G. Click the drop down title ‘Select a Cloud Pub/Sub topic’.
H. Click on ‘ENTER TOPIC MANUALLY’
I. Enter the full topic name from step C (eg projects/sdm-prod/topics/enterprise-xxx-xxx-xxx-xxx-xxx)).
J. Change ‘Message Retention’ to 1 hour rather than 7 days.
K. Click ‘Create’
L. Click into your new subscription.
M. Click the copy icon to the right of ‘Subscription name’, eg projects/nest-xxx/subscriptions/Nest
N. This value is the subscriber_id from configuration.yaml

@allenporter happy for you to include these instructions on the Gibhub page and HA Nest Integration page.

66 Likes

I’m okay with that. Any idea why my automation to change the temperature is failing?

Logger: homeassistant.helpers.service
Source: helpers/service.py:447
First occurred: 2:31:04 AM (1 occurrences)
Last logged: 2:31:04 AM

Unable to find referenced entities climate.inside_nest_thermostat
alias: Change Thermostat Temperature
description: ''
trigger:
  - platform: state
    entity_id: input_number.set_temperature
    for: '00:00:03'
condition: []
action:
  - service: system_log.write
    data:
      message: 'Temperature set to {{ trigger.to_state.state | float }}'
      level: info
      logger: automations/change_thermostat_temperature
  - service: climate.set_temperature
    data:
      temperature: '{{ trigger.to_state.state | float }}'
    entity_id: climate.inside_nest_thermostat
mode: single

2020-11-03 02:31:04 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Running automation actions

2020-11-03 02:31:04 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Executing step call service

2020-11-03 02:31:04 INFO (MainThread) [automations/change_thermostat_temperature] Temperature set to 21.0

2020-11-03 02:31:04 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Executing step call service

2020-11-03 02:31:04 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.inside_nest_thermostat

I will look at it later, have to head out. Might be related to the created entity being in the wrong domain? Not sure, will have to tinker when I get some time.

Presently, the entities go into the “default” domain. I know there are others, could be the culprit???

Hi, that’s what I suspected. First I changed the name of the the thermostat and for some reason it’s retaining the old name (in appdaemon not nest), I then replaced nest.py as you suggested and I still have the same issue.

Thanks again for your help.