[RELEASE] Google SDM API - Nest integration

Is it possible to not show the fan switch part in HomeKit? I’m in a colder climate so nest is never used to cool.

Has anyone else had issues when trying to discover their Nest devices (after the authorization step was completed)? I'm trying to troubleshoot but I'm not sure where the problem is considering there's no feedback or logs entries after clicking the discover button, other than seeing a single "Discovery started" entry. It appears that the authorization was completed successfully.

Additionally, after every hour, the logs show:
"Refreshing access_token from Google"
AND
"Authorized scopes: https://www.googleapis.com/auth/sdm.service https://www.googleapis.com/auth/pubsub

Thanks for you help!

Hi folks - catching up after being absent for a couple weeks around the holidays...

@curtman3 my first suggestion would be to click through the Auth Link again - there may be permissions that you need to allow for the new doorbell device. Beyond that, please enable debug logs for the App - this will log the raw JSON for each event received from Google, and I can further inspect what may be going wrong.

@minnegopher likewise for you, enabling debug logs for the App will help in troubleshooting. After "Discovery started", we should see "Processing data for ..." logs for each device.

@user6833 I think you DMed me as well - unfortunately I've not implemented the streamUrl for the newer devices using webRtc. Sorry to disappoint, though if anyone is familiar with the protocol I'm happy to accept PRs :star_struck:

@heybridgehouse I think what you are asking for is to remove certain custom commands pertaining to the fan... For this you could comment out the relevant command lines in the thermostat driver (put // at the beginning of the line), e.g. line 41 for command fanOn

@dkilgore90 Thanks for the help! Not sure if I'm doing something wrong but I'm not getting very useful troubleshooting logs (at least from my perspective). Here's what I get after clicking the Auth Link and then the Discover buttons. Again, the Auth Link sends me to the Google page where I can see my "Home" and can select my two Nest thermostats.

[no further log entries after "Discovery started".]

So, it seems that I'm blowing through handleDeviceList(resp, data) without getting any devices. I didn't see any log messages in the code to capture my issue, so I added a log.warn("$respCode") to confirm that I wasn't getting a respError. The log gave me a "200" which I believe indicates the httpGet is STATUS OK, so it didn't go into the error IF.

Next, I added a log.warn("$respJson") at line 429, to see what is being grabbed by handleDeviceList() since it doesn't seem to be running processTraits(dev, it) as I don't get any log entries including "Process data for $...", as you had mentioned. The $respJson var comes back as "[:]". Therefore, it seems that device.type, device.id, and device.label are null. So, processTraits(dev, it) never runs. Is this the issue? If so, how can I troubleshoot further to get devices into the parser?

On the device, page, I set the Status attribute for Devices/Rooms selection to "presence" and ever since then, everything worked fine. :person_shrugging:

Anyone having issues where Google is reporting the thermostat is offline after the Nest schedule runs?
For example:

  • Thermostat is set to 20C
  • At 5:00AM, the Nest schedule will change the temp to 23C
  • I'll get a notification from Google SDM that the thermostat is off (I'm sending myself notifications in case the thermostat isn't in heat or heat/cool mode
  • Seems to (not fully confirmed) happens if I manually adjust the temperature on the thermostat, vs full automation.

Occasionally I'm getting these in the logs as well. Not sure if that is being caused by trying to adjust 2 thermostats back to back (just added a 1-minute delay to see if this error stops happening):

  • 2024-01-13 05:00:01.068 AM info Sending sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange to Living Room Thermostat with params: [coolCelsius:25, heatCelsius:23.0]
  • 2024-01-13 05:00:10.252 AM error executeCommand sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange response code: 400, body: { "error": { "code": 400, "message": "heatCelsius contains an invalid value.", "status": "INVALID_ARGUMENT" }}
  • 2024-01-13 05:00:13.930 AM error executeCommand sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange response code: 400, body: { "error": { "code": 400, "message": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange command not allowed in current thermostat mode.", "status": "FAILED_PRECONDITION" }}

@dkilgore90

I need some assistance troubleshooting my Nest (pre-google) doorbell. It had been working fine until what appears in the logs to be January 2. My Thermostat seems to be working fine.

Nothing has been seen as an event since January 2. Not person detection, or button press. I had been using the camera to display a still image capture on my panels when a person or button press occurs. now nothing.

I do not know for sure, but since I migrated from a C-7 to a C-8 on January 3 it may have something to do with this. Seems strange that the Thermostat appears to be working, so I am skeptical that the migration explains the Doorbell not working.

I have logged into google from the SDM API app. I have validated the google Project, oAuth, and everything I can think of.

Any Ideas would be welcome,

LJ

EDIT: OK so I tried turning on Video Stream in the doorbell device and that entered an event in the event page. I then tried to turn off image capture for the person and chime events and the "broken image" icon disappeared from the state field in the device. So I undid that and turned on both the person and chime image capture again and now the image field is blank and won't seem to refresh. The debug logs show that all other states seem to be processing but not the image. Did google change something? Further, it does not report. Button presses.

EDIT 2: ok I have deleted the app and children, then reloaded and fixed my rules. Everything seems to be working except the image download. All I get is the little blue icon instead of a visible image. In the dashboard same thing. The image is getting properly sent to Google Drive but habitat is not doing something right displaying it.

Not sure if this has been asked before.

Can I use a Zigbee temp sensor to effectively control thermostat Similar to how nest sensor works? Hopefully little more accurate.
Is it possible to have the Zigbee sensor control main thermostat?

@minnegopher your comment that the device list respJson was an empty map jarred my memory a bit... Are these legacy Nest thermostats (gen3 or other model from before the Google branding)? There was an issue that popped up a couple years ago where some thermostats stopped reporting and were no longer discovered in the API -- got lost somewhere in Google's universe. The workaround at the time was to "Reset Works with Nest", though with that program sunset I can't even find that option in my Nest thermostat anymore... If you don't have anything critical set up on Google's side, maybe go the drastic route to reset/remove from your account, then re-add? It sounds drastic, but assuming all permissions have been set during Auth to share the device, I'm running out of ideas :grimacing:

@lpakula I've not noticed my thermostatMode changing to Off -- though my Nest is effectively a very expensive temperature display now, as we keep it set to the same mode/range 24/7/365.

yes, the log errors you mention are likely from stringing together different commands too quickly -- and Google starts processing the next one before it has completed the prior change. Hard to say for sure from the few excerpts you provided :person_shrugging:

Ok, just as long as I'm not alone. Even after slowing down commands, it seems 100% Google side. I have the schedule change the temp at 04:45 and then Google SDM change the temp at 05:00. That's when I see the issue. The one time I checked, Google SDM reported "off" for that device. I ended up doing a bandaid to set the thermostat back to the proper mode, which seems to work for the "off" case. The error seems to went away by slowing things down.

@ljp-hubitat your event issues are puzzling -- but you seem to have addressed that brute force (a little percussive maintenance never hurts!) As to the image display, this seems to be a generic issue -- as I'm seeing the same on my hub. I'll dig into this...

1 Like

Anything is possible with Hubitat!

More specifically (and less cliche) -- probably the easiest way is via the built-in Thermostat Controllers app: Thermostat Controller | Hubitat Documentation

Gen3s work OK. Gen2s have an issue as they don’t have a code on them. I had to contact support via chat and provide the serial number. They pushed some update and then it was discoverable in Google Home and via the API.

If using thermostat scheduler can you adjust the temp from main thermostat anymore for those extra cold/warm moments? I’m find that it just keeps resetting back to what is in the scheduler app.

Thinking May need to make rules and not use the app.

Thoughts?

How do you use the cameras through this integration? Or is this driver really only for the thermostats?

Had this email from Google today.

Can someone confirm if I am likely to incur any costs? I'm hitting the 3 cameras I have quite heavily with live dashboard feeds on Home Assistant as well as more typical use via Hubitat.

5 Likes

I was just coming to ask the same question.

2 Likes

This integration on the whole does not include any manual "actions" for the cameras -- the closest item is generating the stream URL for legacy Nest cameras supporting RTSP. Otherwise it is focused on events -- person, motion, sound -- from camera devices, and action/events from thermostats.

If I haven't answered your question, please elaborate on the use case you're interested in, and perhaps I can better address it.

I saw the same email, and have checked the settings we are using. For the past 4 years, the event subscription request has explicitly set the messageRetentionDuration to 600 seconds (10 minutes) -- and any long-standing installs which were upgraded from before this was set should have been migrated. Therefore we should not run afoul of this rule with the Hubitat integration (I can't speak to what might be configured on the HomeAssistant side).

I'll double-check if there is anything we can/need to do to detect, audit, and possibly auto-delete idle/stale subscriptions, but those would likely only exist if you have manually tinkered with the API.

9 Likes