1

执行:

curl.exe -k -L -X PUT "https://developer-api.nest.com/devices/thermostats/[DEVICE_ID]/hvac_mode.json?auth=[ACCESS_TOKEN]" -H "Content-Type: application/json" -d "heat"

产生错误:

{"error":"Invalid content sent"}

使用完全相同的命令,但用和替换hvac_modetarget_temperature_f任何"heat"数字65都可以,是的,不带引号)可以工作,并且数据会在上游发生变化。我试过"heat"不带引号发送,用 '' 而不是 "" - 没有区别。

权限很好。文档说我应该能够做到这一点。我目前在"off" hvac_mode.

如果我用 替换"heat"'{"target_temperature_f": 73}'我得到:

{"error":"Invalid content sent"}curl: (3) [globbing] unmatched close brace/bracket in column 3
4

1 回答 1

1

以下在 Linux 中有效:

curl.exe -k -L -X PUT "https://developer-api.nest.com/devices/thermostats/[DEVICE_ID]?auth=[ACCESS_TOKEN]" -H "Content-Type: application/json" -d '{"hvac_mode":"heat"}'

在 Windows 中:

curl.exe -k -L -X PUT "https://developer-api.nest.com/devices/thermostats/[DEVICE_ID]?auth=[ACCESS_TOKEN]" -H "Content-Type: application/json" -d "{\"hvac_mode\":\"heat\"}"
于 2014-10-30T05:42:20.693 回答