Nest Thermostat Integration - Ready for newbies?

Yes, it sounds like the pub/sub api was the missing link - commands function when run, but rules that trigger on events never ran becaue the events were not received from Google. If you run into any other issues, don't hesitate to post - there is also a lengthy thread for the App/Drivers that you can search through for tips: [Beta] Google SDM API - Nest integration

The pub/sub has 2 sides, in the Device Access project, to enable the topic to publish the events in Google Cloud, but also in the GCP project, to enable the API so that the Hubitat App can create the subscription (telling Google how to send those events to your hub)

1 Like

Okay once again it didn't seem to set the heat set point I see the error message "Cannot setHeatingSetpoint in thermostatMode:off" which makes total sense, except I didn't try and do that.

The code reads

Thermostats:Shop Far -->Mode:heat -->Heat:65.0
delay 0:01:00
Thermostat:Shop Far -->Heat:65.0

so either way it should be on right?

Here are the SDM logs from that time frame:

app:2902021-12-29 10:47:28.858 am debug{ "eventId": "bd4b6801-df46-4b1f-8452-c2c08edc512a", "timestamp": "2021-12-29T18:47:20.200Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA", "traits": { "sdm.devices.traits.ThermostatHvac": { "status": "HEATING" } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA"]}
app:2902021-12-29 10:47:28.856 am debugEvent received from Google pub/sub
app:2902021-12-29 10:47:21.184 am debug{ "eventId": "44fe0712-9642-4b23-abc5-ab1dc30341ef", "timestamp": "2021-12-29T18:47:15.901Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.ThermostatHvac": { "status": "HEATING" } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]}
app:2902021-12-29 10:47:21.182 am debugEvent received from Google pub/sub
app:2902021-12-29 10:47:20.828 am debug{ "eventId": "e4dc5588-3999-4485-82df-967ed0a27055", "timestamp": "2021-12-29T18:47:15.174Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.Temperature": { "ambientTemperatureCelsius": 5.68999 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]}
app:2902021-12-29 10:47:20.826 am debugEvent received from Google pub/sub
app:2902021-12-29 10:47:17.543 am debug{ "eventId": "7b8c748d-3534-49b9-bd87-0667afa557e3", "timestamp": "2021-12-29T18:47:16.716Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA", "traits": { "sdm.devices.traits.Temperature": { "ambientTemperatureCelsius": 5.42 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA"]}
app:2902021-12-29 10:47:17.541 am debugEvent received from Google pub/sub
app:2902021-12-29 10:47:17.373 am debug{ "eventId": "aa989c9e-ba58-4790-bd25-89b348f048bc", "timestamp": "2021-12-29T18:47:12.725Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA", "traits": { "sdm.devices.traits.ThermostatMode": { "mode": "HEAT", "availableModes": ["HEAT", "OFF"] }, "sdm.devices.traits.ThermostatEco": { "availableModes": ["OFF", "MANUAL_ECO"], "mode": "OFF", "heatCelsius": 4.44444, "coolCelsius": 24.44444 }, "sdm.devices.traits.ThermostatTemperatureSetpoint": { "heatCelsius": 12.777778 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA"]}
app:2902021-12-29 10:47:17.371 am debugEvent received from Google pub/sub
app:2902021-12-29 10:47:14.341 am debug{ "eventId": "1cb2a242-e0f5-4c1d-89bd-a9e7041ef85b", "timestamp": "2021-12-29T18:47:12.704Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.ThermostatMode": { "mode": "HEAT", "availableModes": ["HEAT", "OFF"] }, "sdm.devices.traits.ThermostatEco": { "availableModes": ["OFF", "MANUAL_ECO"], "mode": "OFF", "heatCelsius": 4.44444, "coolCelsius": 24.44444 }, "sdm.devices.traits.ThermostatTemperatureSetpoint": { "heatCelsius": 12.777778 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]}
app:2902021-12-29 10:47:14.338 am debugEvent received from Google pub/sub
app:2902021-12-29 10:47:11.953 am infoSending sdm.devices.commands.ThermostatMode.SetMode to Shop Kayak with params: [mode:HEAT]
app:2902021-12-29 10:47:11.934 am infoSending sdm.devices.commands.ThermostatMode.SetMode to Shop Far with params: [mode:HEAT]

Don't have a timestamp from the Thermostat device error, but looking at the App logs, you may need to increase the delay before sending the setpoint command - the code waits for the event from Google confirming the new state before updating Hubitat.

Looks like in this case it took about 2.5 seconds from sending the command to get the event - so at least 3 second delay?

So from my code above I have a 1 minute delay before sending although Iโ€™m setting two thermostats at once could that be the issue?

Sorry, misread the delay as 1s. Re-reading above, you're setting the heat setpoint twice, once immediately after the mode change, then again after the delay? I expect the second attempt should be successful. If not, please post the logs from App and Device, with timestamps, covering the full minute+ of the execution period. A screenshot of the rule (if using Rule Machine) may be helpful to confirm the sequence being executed.

Wouldn't expect manipulation of multiple devices in sequence to cause any issues, unless you're hitting an API rate-limit on Google's side (if so, this should be logged)

No probelem, Just so I get it right which logs do you want? The SDM logs from the timeframe are in the post above, I can snag the thermostat logs as well if thatโ€™s what you want.

Yes, both. SDM logs above only cover about 20 seconds, so we don't see the full 1m delay period.

Ah yeah, sorry there was nothing 1 minute past that in the log.

I just tried running it again and, changing my delay from 1 minute to 10 seconds, It appears to function correctly at the moment, so I'll monitor and report back with the logs again if it fails.

For reference here's a few lines above and below the previous logs:

app:2902021-12-29 11:00:21.375 am debugEvent received from Google pub/sub app:2902021-12-29 10:58:35.378 am debugAuthorized scopes: https://www.googleapis.com/auth/pubsub https://www.googleapis.com/auth/sdm.service app:2902021-12-29 10:58:35.042 am infoRefreshing access_token from Google app:2902021-12-29 10:47:28.858 am debug{ "eventId": "bd4b6801-df46-4b1f-8452-c2c08edc512a", "timestamp": "2021-12-29T18:47:20.200Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA", "traits": { "sdm.devices.traits.ThermostatHvac": { "status": "HEATING" } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA"]} app:2902021-12-29 10:47:28.856 am debugEvent received from Google pub/sub app:2902021-12-29 10:47:21.184 am debug{ "eventId": "44fe0712-9642-4b23-abc5-ab1dc30341ef", "timestamp": "2021-12-29T18:47:15.901Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.ThermostatHvac": { "status": "HEATING" } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]} app:2902021-12-29 10:47:21.182 am debugEvent received from Google pub/sub app:2902021-12-29 10:47:20.828 am debug{ "eventId": "e4dc5588-3999-4485-82df-967ed0a27055", "timestamp": "2021-12-29T18:47:15.174Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.Temperature": { "ambientTemperatureCelsius": 5.68999 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]} app:2902021-12-29 10:47:20.826 am debugEvent received from Google pub/sub app:2902021-12-29 10:47:17.543 am debug{ "eventId": "7b8c748d-3534-49b9-bd87-0667afa557e3", "timestamp": "2021-12-29T18:47:16.716Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA", "traits": { "sdm.devices.traits.Temperature": { "ambientTemperatureCelsius": 5.42 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA"]} app:2902021-12-29 10:47:17.541 am debugEvent received from Google pub/sub app:2902021-12-29 10:47:17.373 am debug{ "eventId": "aa989c9e-ba58-4790-bd25-89b348f048bc", "timestamp": "2021-12-29T18:47:12.725Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA", "traits": { "sdm.devices.traits.ThermostatMode": { "mode": "HEAT", "availableModes": ["HEAT", "OFF"] }, "sdm.devices.traits.ThermostatEco": { "availableModes": ["OFF", "MANUAL_ECO"], "mode": "OFF", "heatCelsius": 4.44444, "coolCelsius": 24.44444 }, "sdm.devices.traits.ThermostatTemperatureSetpoint": { "heatCelsius": 12.777778 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEudHiuIEKQWB49t7DqWtU4dqCpmkToWdIcgEFhpoUwoUsyK1lnsCOMtwY60RxTcRgYTdGvZ6Bq3ba6qbdPRU3yLvA"]} app:2902021-12-29 10:47:17.371 am debugEvent received from Google pub/sub app:2902021-12-29 10:47:14.341 am debug{ "eventId": "1cb2a242-e0f5-4c1d-89bd-a9e7041ef85b", "timestamp": "2021-12-29T18:47:12.704Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.ThermostatMode": { "mode": "HEAT", "availableModes": ["HEAT", "OFF"] }, "sdm.devices.traits.ThermostatEco": { "availableModes": ["OFF", "MANUAL_ECO"], "mode": "OFF", "heatCelsius": 4.44444, "coolCelsius": 24.44444 }, "sdm.devices.traits.ThermostatTemperatureSetpoint": { "heatCelsius": 12.777778 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]} app:2902021-12-29 10:47:14.338 am debugEvent received from Google pub/sub app:2902021-12-29 10:47:11.953 am infoSending sdm.devices.commands.ThermostatMode.SetMode to Shop Kayak with params: [mode:HEAT] app:2902021-12-29 10:47:11.934 am infoSending sdm.devices.commands.ThermostatMode.SetMode to Shop Far with params: [mode:HEAT] app:2902021-12-29 10:28:01.053 am debug{ "eventId": "4a0751db-0f09-44f5-950a-06829ea43396", "timestamp": "2021-12-29T18:27:57.137Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.Temperature": { "ambientTemperatureCelsius": 6.09999 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]} app:2902021-12-29 10:28:01.050 am debugEvent received from Google pub/sub app:2902021-12-29 10:27:58.109 am debug{ "eventId": "1e7049df-21f6-4997-959f-ebe1be882820", "timestamp": "2021-12-29T18:27:56.519Z", "resourceUpdate": { "name": "enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA", "traits": { "sdm.devices.traits.Humidity": { "ambientHumidityPercent": 47.0 } } }, "userId": "AVPHwEv6dqZAvtGa8hvYGnG5mxmUt1A8V6GkIasiW6_M", "resourceGroup": ["enterprises/503a503c-ab6e-4c7e-ae97-8125ff3ffc7e/devices/AVPHwEvsSS2Uf1nobtxUxOwtp4bo4voXp9S5avzNDmBXGT0V306G4JkdRLVITHeWAuy-K6gVclMJ7LcKO1nxIafVnvtUSA"]}