I'm calling the SDM API using the google-api-nodesj-client package, and receiving an Enterprise not found message when I try to set the temperature.
The API returns a 404 on the nest.enterprises.devices.executeCommand call with the following error block :
message: 'Enterprise enterprises/long-enterprise-id-here not found.',
domain: 'global',
reason: 'notFound'
async function setTemp(device_name, tempFahrenheit) {
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/sdm.service']
});
const authClient = await auth.getClient();
const nest = await google.smartdevicemanagement(
{
version: 'v1',
auth: authClient,
});
// Do the magic
try {
const res = await nest.enterprises.devices.executeCommand({
name: device_name,
requestBody: {
"command" : "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat",
"params" : {
"heatCelsius" : getCelcius(tempFahrenheit)
}
}
});
console.log(res.data);
} catch (e) {
console.dir(e);
}
}
I haven't found anything in the SDM documentation that alludes to this error. It feels like a GCP service account configuration issue but I can't make sense of it.