调用ecobee API的setHold接口未按预期生成Event问题
ecobee API setHold请求未生成预期Hold事件排查
请求详情
已完成身份认证,向https://api.ecobee.com/1/thermostat发送以下POST请求:
{"selection":{"selectionType":"registered","selectonMatch":""},"functions":[{"type":"setHold","params":{"holdType":"indefinite","heatHoldTemp":716,"coolHoldTemp":716}}]}
注意:请求中存在拼写错误:
selectonMatch应为selectionMatch,这可能是核心问题所在。
API响应结果
{ "page": { "page": 1, "totalPages": 1, "pageSize": 1, "total": 1 }, "thermostatList": [ { "identifier": "--hidden--", "name": "Thermostat", "thermostatRev": "230212020022", "isRegistered": true, "modelNumber": "nikeSmart", "brand": "ecobee", "features": "Home,HomeKit", "lastModified": "2023-02-12 02:00:22", "thermostatTime": "2023-02-13 11:36:30", "utcTime": "2023-02-13 16:36:30" } ], "status": { "code": 0, "message": "" } }
设备实际状态
获取到的设备events列表中无预期的Hold事件,仅存在默认模板事件:
"events": [ { "type": "template", "name": "_Default_", "running": false, "startDate": "2037-01-01", "startTime": "01:01:01", "endDate": "2037-01-01", "endTime": "02:01:01", "isOccupied": false, "isCoolOff": false, "isHeatOff": false, "coolHoldTemp": 788, "heatHoldTemp": 644, "fan": "auto", "vent": "off", "ventilatorMinOnTime": 5, "isOptional": true, "isTemperatureRelative": false, "coolRelativeTemp": 40, "heatRelativeTemp": 40, "isTemperatureAbsolute": true, "dutyCyclePercentage": 255, "fanMinOnTime": 20, "occupiedSensorActive": false, "unoccupiedSensorActive": false, "drRampUpTemp": 0, "drRampUpTime": 3600, "linkRef": "", "holdClimateRef": "", "fanSpeed": "low" } ]
同时设备UI无任何变化,与官方文档中执行setHold后生成对应Hold事件的预期不符。
排查方向
- 修正请求拼写错误:将
selectonMatch改为selectionMatch,确保API能正确识别设备选择器,指令能下发到目标设备 - 确认请求方法:确保使用POST方法发送请求,ecobee的function调用仅支持POST
- 验证温度参数:716对应71.6°F,需确认该值在设备允许的温度调节范围内
- 获取完整设备状态:在请求中添加
includeEvents=true参数,确保返回的thermostatList包含最新的events数据 - 检查设备在线状态:响应中
lastModified时间早于thermostatTime,可能存在同步延迟或设备离线,需确认设备在线并正常同步
内容的提问来源于stack exchange,提问作者0x6adb015
相关产品推荐
相关产品推荐

