我正在使用 google-api-nodesj-client 包调用 SDM API,并在尝试设置温度时收到 Enterprise not found 消息。
API 在 nest.enterprises.devices.executeCommand 调用上返回 404,并带有以下错误块:
消息:'企业企业/long-enterprise-id-here not found.',
域:'global',
原因:'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);
}
}
我在 SDM 文档中没有发现任何暗示此错误的内容。感觉像是 GCP 服务帐户配置问题,但我无法理解。