我目前正在研究 Alexa Smarthome 技能,该技能可以处理多种设备类型,其中一种类型是 HVAC 设备。处理技能请求的服务器无法一次处理多个请求,因此我没有让 Alexa 调用“ReportState”,而是在值更改时给它一个“ChangeReport”。
我使用 Alexa.ThermostatController 接口 v3 功能以及 PowerController、TemperatureSensor 和 EndpointHealth 功能来构建设备。 Discovery 响应示例如下所示:
{
"endpointId": "12-34",
"manufacturerName": "Sample Manufacturer",
"description": "HVAC Control",
"friendlyName": "Office Test HVAC",
"additionalAttributes": {
"manufacturer": "Sample Manufacturer",
"model": "unknown",
"serialNumber": "unknown",
"firmwareVersion": "unknown",
"softwareVersion": "unknown",
"customIdentifier": "12-34"
},
"displayCategories": [
"THERMOSTAT",
"TEMPERATURE_SENSOR"
],
"cookie": {},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": true,
"retrievable": false
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.ThermostatController",
"version": "3.1",
"properties": {
"supported": [
{
"name": "upperSetpoint"
},
{
"name": "lowerSetpoint"
},
{
"name": "thermostatMode"
}
],
"proactivelyReported": true,
"retrievable": false
},
"configuration": {
"supportedModes": [
"OFF",
"HEAT",
"COOL",
"AUTO"
]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.TemperatureSensor",
"version": "3",
"properties": {
"supported": [
{
"name": "temperature"
}
],
"proactivelyReported": true,
"retrievable": false
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": false
}
}
]
}
Discovery 将找到该设备并将其添加到 Alexa Home。但是,当我在应用程序中转到设备时,它不会显示界面,而是说“等待”之类的内容并显示加载图标。当我通过语音设置恒温器时,例如“将办公室测试 HVAC 设置为 74 华氏度”,它会说该设备“不支持该设置”。
有谁知道发生了什么事或如何解决这个问题?
我检查了 Cloudwatch 日志,看看是否有从 Alexa 发送的任何内容,例如 ReportState 指令,但找不到任何内容。我还尝试在恒温器上设置一个值来强制发送 ChangeReport,ChangeReport 似乎已发送,但应用程序中没有更新。我也无法在 Cloudwatch 日志中找到任何错误。为了确定起见,我多次检查了回复和发现消息,但我仍然不确定问题是什么。
我正在尝试让 HVAC 设备以正确的界面显示在应用程序中,并允许用户控制该设备。
我在 3.1 版本中遇到了这个问题。我建议将 Alexa.ThermostatController 功能的版本从 3.1 更改为 3.0。另请记住,用于您技能的智能家居功能应模仿并映射到您设备上的物理按钮。