Google-Nest Offical Device Access Console Finally Released!

subscriber_id should look like this: projects/sdm-prod/topics/enterprise-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and can be found in your project at https://console.nest.google.com/device-access/project-list. It’s called the Pub/Sub topic.

1 Like

Current integration only contains temperature and humidity sensors. If you are not running the appdaemon version then no other component will show up.

Also remove everything after subscriber ID

nest:
  client_id: !secret new_nest_client_id
  client_secret: !secret new_nest_secret
  project_id: !secret new_nest
  subscriber_id: !secret new_nest_sub
1 Like

Ok. Very confusing because:

Anyway, I did change it from here:

Now configuration is:

image

Also removed everything after subsriber_id like Domenic suggested. Restarted again. No nest data under Developer Tools > States.

I am using HassOS 4.15, Supervisor 2020.11.0. Home Assistant 0.117.4.

@ElleshaHackett Follow my instructions on post 263. Much simpler than the Google documentation
https://community.home-assistant.io/t/google-nest-offical-device-access-console-finally-released/229146/263?u=townsmcp

1 Like

For me I was able to leave the subscriber topic as in your case “hassio”. Then you go to the integration and proceed through those steps. If successful you will see a sensor.temperature and sensor.humidity

You are certainly welcome and able to tweak yourself. lines 71 and 72 are where this is set. Just update the file and save. Presto.

Removed all again in HA and Google/Nest portals. Started all over again. Followed exactly your steps, went to intergration page from external ui.nabu.casa domain. Stuck between 31-32 now. Google showing “Please contact the developer of this app if the issue persists.”.

I am also about to throw my Nest thermostat out of the window.

Edit: In the last run I did not change the project_id properly. It does work now. I see humidity and temperature sensors now. I only now need to figure out how to change temperatures. Anyone?

Will do except… Houston, we have a problem! The entities are now gone. I also had this Nest integration installed and it’s two sensors’ names changed to sensor.{my_work_email_address}.humidity and .temperature. That email address is not affiliated with any Google account. WTF?? Very bizarre! I’ve removed the Nest integration but appdaemon/nest.py still is not giving me the entities I had and which were working. I also upgraded HA to 117.4…

Just in case anyone else runs into a similar problem as me, I have my homeassistant set up on a raspberry pi 4 and access it externally using the ducksdns and nginx Home Assistant ssl proxy addons.

If you are setup in a similar manner, the nest integration always fails on the last step when it sets up the callback request address because it registers your internal network address rather than your external duckdns address.

After struggling with this problem for multiple days, I found that if you login to Home assistant while connected to an external network and then run the nest integration setup it will reference your external duckdns address for the callback request and the integration will complete correctly.

Once nest configuration is completed, the data updates in Homeassistant whether I’m connected internally or externally without any problems so far.

Hope this information is found useful to someone else… Thanks for the active work on this integration!

1 Like

I cannot get the thermostat back!
The Nest Integration is fine and I got rid of my work email address as a label.

Thanks for this guide, works perfectly!

1 Like

Integration done but only 2 sensors also.
And after 24h not change value :frowning:

Any idea ?
nest

Thx

1 Like

@Ascari it’s a known issue and being dealt with. A reboot of HA gets new stats - underlying python library for SDM python-google-nest-sdm requires google-cloud-pubsub 2.1.0

1 Like

Yeah, same happend to me, seems to be a known issue, but i dont know if its fixed or any workaround :S

1 Like

My guess is that you are using only 1 client_id, so when you are tinkering with the integration, it is changing the refresh token. When you setup to get the refresh token for the appdaemon app, you break the integration.

I recommend creating a second client_id and secret, and use one for appdaemon and one for the integration.

The appdaemon error logs might help to confirm, though I admittedly didn’t do exhaustive error handling…

Note the “Logs” tab in your AppDaemon dashboard. There are two log tabs. I am betting you have words to the effect of a missing key for “access_token”.

2020-11-05 16:14:33.793664 WARNING nest: ------------------------------------------------------------
2020-11-05 16:14:33.793951 WARNING nest: Unexpected error in worker for App nest:
2020-11-05 16:14:33.794161 WARNING nest: Worker Ags: {'id': '87ce9d49ab3f4c2aaaa90fc7fbbdce9e', 'name': 'nest', 'objectid': '6e103999503840b995ddbf2f43ecd0de', 'type': 'scheduler', 'function': <bound method NESTAPI.update_devices of <nest.NESTAPI object at 0x7fc9a4a16df0>>, 'pin_app': True, 'pin_thread': 1, 'kwargs': {'interval': 30, '__thread_id': 'thread-1'}}
2020-11-05 16:14:33.794346 WARNING nest: ------------------------------------------------------------
2020-11-05 16:14:33.794651 WARNING nest: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 887, in worker
    funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/nest.py", line 53, in update_devices
    device = self.parseThermostat(nest_device)
  File "/config/appdaemon/apps/nest.py", line 76, in parseThermostat
    device["attributes"]["fan_mode"]=nest_device["traits"]["sdm.devices.traits.Fan"]["timerMode"].lower()
KeyError: 'timerMode'
2020-11-05 16:14:33.794815 WARNING nest: ------------------------------------------------------------

I removed the Nest integration, stopped appdaemon, got new access & refresh tokens and successfully ran

curl -X GET 'https://smartdevicemanagement.googleapis.com/v1/enterprises/........-....-....-....-............/devices'     -H 'Content-Type: application/json'     -H 'Authorization: Bearer xx29.x0xxx6xxxxxxxxxxxx5x7x72xx_xxxxxxxx0x_x24xxxxxxxxxxx8xxxxx6-xx3xxxx43xxxxx82x1xxxxx8xxxxxx7xxxxxxx2xxxxx7xxxxxxxxx7xxxx-3xxxxxxxxxxxxxxxxxxxx0x5xxxxxxx8x5xxxxxxxxxxx5xxxx9xx'

which listed the thermostat and traits.
I put the new refresh token into secrets, restarted HA and then started appdaemon. Here is its log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: AppDaemon 4
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.3.1
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 10 (buster)  (amd64 / intel-nuc)
 Home Assistant Core: 0.117.4
 Home Assistant Supervisor: 2020.11.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing... 
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[07:30:51] INFO: Starting AppDaemon...
2020-11-05 16:30:52.454328 INFO AppDaemon: AppDaemon Version 4.0.5 starting
2020-11-05 16:30:52.454481 INFO AppDaemon: Python version is 3.8.5
2020-11-05 16:30:52.454588 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-11-05 16:30:52.454689 INFO AppDaemon: Added log: AppDaemon
2020-11-05 16:30:52.454797 INFO AppDaemon: Added log: Error
2020-11-05 16:30:52.454920 INFO AppDaemon: Added log: Access
2020-11-05 16:30:52.455028 INFO AppDaemon: Added log: Diag
2020-11-05 16:30:52.466940 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-11-05 16:30:52.503522 INFO HASS: HASS Plugin Initializing
2020-11-05 16:30:52.503699 INFO HASS: HASS Plugin initialization complete
2020-11-05 16:30:52.504058 INFO AppDaemon: Initializing HTTP
2020-11-05 16:30:52.504331 INFO AppDaemon: Using 'ws' for event stream
2020-11-05 16:30:52.506408 INFO AppDaemon: Starting API
2020-11-05 16:30:52.508962 INFO AppDaemon: Starting Admin Interface
2020-11-05 16:30:52.509225 INFO AppDaemon: Starting Dashboards
2020-11-05 16:30:52.519942 INFO HASS: Connected to Home Assistant 0.117.4
2020-11-05 16:30:52.527561 INFO AppDaemon: App 'hello_world' added
2020-11-05 16:30:52.527854 INFO AppDaemon: App 'nest' added
2020-11-05 16:30:52.528304 INFO AppDaemon: Found 2 total apps
2020-11-05 16:30:52.528580 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2020-11-05 16:30:52.529177 INFO AppDaemon: Running on port 5050
2020-11-05 16:30:52.661104 INFO HASS: Evaluating startup conditions
2020-11-05 16:30:52.667364 INFO HASS: Startup condition met: hass state=RUNNING
2020-11-05 16:30:52.667595 INFO HASS: All startup conditions met
2020-11-05 16:30:52.686508 INFO AppDaemon: Got initial state from namespace default
2020-11-05 16:30:54.535219 INFO AppDaemon: Scheduler running in realtime
2020-11-05 16:30:54.545163 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-11-05 16:30:54.547380 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/nest2.py - ignoring
2020-11-05 16:30:54.548060 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2020-11-05 16:30:54.551359 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/nest.py
2020-11-05 16:30:54.553491 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2020-11-05 16:30:54.554355 INFO AppDaemon: Initializing app nest using class NESTAPI from module nest
2020-11-05 16:30:54.596222 INFO hello_world: Hello from AppDaemon
2020-11-05 16:30:54.596869 INFO hello_world: You are now ready to run Apps!
2020-11-05 16:30:54.598772 INFO nest: Hello from NEST API
2020-11-05 16:30:54.690505 INFO AppDaemon: App initialization complete
2020-11-05 16:30:55.696206 WARNING nest: ------------------------------------------------------------
2020-11-05 16:30:55.696491 WARNING nest: Unexpected error in worker for App nest:
2020-11-05 16:30:55.696691 WARNING nest: Worker Ags: {'id': '5488181628314842b3c8d39fd30ca1c8', 'name': 'nest', 'objectid': 'd7fe49f28c75470dbce18ced725e1a9b', 'type': 'scheduler', 'function': <bound method NESTAPI.update_devices of <nest.NESTAPI object at 0x7f9070968940>>, 'pin_app': True, 'pin_thread': 1, 'kwargs': {'interval': 30, '__thread_id': 'thread-1'}}
2020-11-05 16:30:55.697801 WARNING nest: ------------------------------------------------------------
2020-11-05 16:30:55.699515 WARNING nest: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 887, in worker
    funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/nest.py", line 53, in update_devices
    device = self.parseThermostat(nest_device)
  File "/config/appdaemon/apps/nest.py", line 76, in parseThermostat
    device["attributes"]["fan_mode"]=nest_device["traits"]["sdm.devices.traits.Fan"]["timerMode"].lower()
KeyError: 'timerMode'
2020-11-05 16:30:55.699704 WARNING nest: ------------------------------------------------------------

Here are the device traits:

      "traits": {
        "sdm.devices.traits.Info": {
          "customName": ""
        },
        "sdm.devices.traits.Humidity": {
          "ambientHumidityPercent": 52
        },
        "sdm.devices.traits.Connectivity": {
          "status": "ONLINE"
        },
        "sdm.devices.traits.Fan": {},
        "sdm.devices.traits.ThermostatMode": {
          "mode": "HEAT",
          "availableModes": [
            "HEAT",
            "OFF"
          ]
        },
        "sdm.devices.traits.ThermostatEco": {
          "availableModes": [
            "OFF",
            "MANUAL_ECO"
          ],
          "mode": "OFF",
          "heatCelsius": 15.31998,
          "coolCelsius": 24.44444
        },
        "sdm.devices.traits.ThermostatHvac": {
          "status": "OFF"
        },
        "sdm.devices.traits.Settings": {
          "temperatureScale": "CELSIUS"
        },
        "sdm.devices.traits.ThermostatTemperatureSetpoint": {
          "heatCelsius": 11.48557
        },
        "sdm.devices.traits.Temperature": {
          "ambientTemperatureCelsius": 22.23999
        }

My furnace fan is not connected to my thermostat so I don’t have [fan_mode]

    ###########################################
    #device["attributes"]["fan_mode"]=nest_device["traits"]["sdm.devices.traits.Fan"]["timerMode"].lower()
    #if device["attributes"]["fan_mode"] == "on":
    #  device["attributes"]["fan_timer_out"]=nest_device["traits"]["sdm.devices.traits.Fan"]["timerTimeout"].lower()
    #else:
    #  device["attributes"]["fan_timer_out"]="off"
    ###########################################

Is there a way to test for that in python?

After commenting out that code, I see this in the log:

2020-11-05 16:59:25.706817 WARNING nest: ------------------------------------------------------------
2020-11-05 16:59:28.740509 INFO AppDaemon: Terminating nest
2020-11-05 16:59:28.742168 INFO AppDaemon: Reloading Module: /config/appdaemon/apps/nest.py
2020-11-05 16:59:28.869147 INFO AppDaemon: Initializing app nest using class NESTAPI from module nest
2020-11-05 16:59:28.871326 INFO nest: Hello from NEST API
2020-11-05 16:59:29.751370 WARNING nest: nest: Entity climate.living_room_nest_thermostat not found in namespace default
2020-11-05 16:59:29.751813 INFO AppDaemon: nest: Entity climate.living_room_nest_thermostat created in namespace: default
2020-11-05 16:59:29.761940 WARNING nest: nest: Entity sensor.living_room_nest_thermostat_temp not found in namespace default
2020-11-05 16:59:29.762387 INFO AppDaemon: nest: Entity sensor.living_room_nest_thermostat_temp created in namespace: default
2020-11-05 16:59:29.770918 WARNING nest: nest: Entity switch.living_room_nest_thermostat_switch not found in namespace default
2020-11-05 16:59:29.771377 INFO AppDaemon: nest: Entity switch.living_room_nest_thermostat_switch created in namespace: default

Nest is Back

But now we’re back to this HA helpers thing…

2020-11-05 08:20:52 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Executing step call service
2020-11-05 08:20:52 INFO (MainThread) [automations/change_thermostat_temperature] Temperature set to 16.0
2020-11-05 08:20:52 INFO (MainThread) [homeassistant.components.automation.change_thermostat_temperature] Change Thermostat Temperature: Executing step call service
2020-11-05 08:20:52 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.living_room_nest_thermostat

Is there something amiss in appdaemon??

OK, this seems to be related to the fan functionality. Does your thermostat not support running just the fan?

I can throw error protection around this. Might help if you insert a line of code to dump the Nest Config to the logs.

My line 59-61 looks like:

def parseThermostat(self, nest_device):
device = {}
device[“attributes”]={}

change it to this, and the it will dump the JSON object to the logs. It will give me a closer look at why it is failing. It looks like you are getting data back from Google, but missing the trait “sdm.devices.traits.Fan” and more precisely, “timerMode”.

def parseThermostat(self, nest_device):
self.log(nest_device)
device = {}
device[“attributes”]={}

Post the data from the AppDaemon log
Here is a sample for me:

2020-11-05 18:04:55.736999 INFO nest: {‘name’: 'enterprises/<snipped/devices/, ‘type’: ‘sdm.devices.types.THERMOSTAT’, ‘assignee’: ‘enterprises//structures/rooms/’, ‘traits’: {‘sdm.devices.traits.Info’: {‘customName’: ‘’}, ‘sdm.devices.traits.Humidity’: {‘ambientHumidityPercent’: 47}, ‘sdm.devices.traits.Connectivity’: {‘status’: ‘ONLINE’}, ‘sdm.devices.traits.Fan’: {‘timerMode’: ‘OFF’}, ‘sdm.devices.traits.ThermostatMode’: {‘mode’: ‘HEATCOOL’, ‘availableModes’: [‘HEAT’, ‘COOL’, ‘HEATCOOL’, ‘OFF’]}, ‘sdm.devices.traits.ThermostatEco’: {‘availableModes’: [‘OFF’, ‘MANUAL_ECO’], ‘mode’: ‘OFF’, ‘heatCelsius’: 15.59176, ‘coolCelsius’: 29.251034}, ‘sdm.devices.traits.ThermostatHvac’: {‘status’: ‘OFF’}, ‘sdm.devices.traits.Settings’: {‘temperatureScale’: ‘FAHRENHEIT’}, ‘sdm.devices.traits.ThermostatTemperatureSetpoint’: {‘heatCelsius’: 19.86403, ‘coolCelsius’: 22.87616}, ‘sdm.devices.traits.Temperature’: {‘ambientTemperatureCelsius’: 21.93999}}, ‘parentRelations’: [{‘parent’: 'enterprises//structures/, ‘displayName’: ‘Family Room’}]}

1 Like

My thermostat supports fan control but since it is only connected via 2 wires, there is no control of the fan therefore the thermostat does not offer fan ‘timerMode’ which would be why it is not included in the device traits from google:

        "sdm.devices.traits.Fan": {},
        "sdm.devices.traits.ThermostatMode": {
          "mode": "HEAT",
          "availableModes": [
            "HEAT",
            "OFF"
          ]
        },

2020-11-06 02:28:43.651317 INFO nest: {‘type’: ‘sdm.devices.types.THERMOSTAT’, ‘traits’: {‘sdm.devices.traits.Info’: {‘customName’: ‘’}, ‘sdm.devices.traits.Humidity’: {‘ambientHumidityPercent’: 50}, ‘sdm.devices.traits.Connectivity’: {‘status’: ‘ONLINE’}, ‘sdm.devices.traits.Fan’: {} , ‘sdm.devices.traits.ThermostatMode’: {‘mode’: ‘HEAT’, ‘availableModes’: [‘HEAT’, ‘OFF’]}, ‘sdm.devices.traits.ThermostatEco’: {‘availableModes’: [‘OFF’, ‘MANUAL_ECO’], ‘mode’: ‘OFF’, ‘heatCelsius’: 15.31998, ‘coolCelsius’: 24.44444}, ‘sdm.devices.traits.ThermostatHvac’: {‘status’: ‘OFF’}, ‘sdm.devices.traits.Settings’: {‘temperatureScale’: ‘CELSIUS’}, ‘sdm.devices.traits.ThermostatTemperatureSetpoint’: {‘heatCelsius’: 17}, ‘sdm.devices.traits.Temperature’: {‘ambientTemperatureCelsius’: 22.20999}}, ‘parentRelations’: ‘displayName’: ‘Living Room’}]}

You would need to test if ‘sdm.devices.traits.Fan’ is {}