智能家居温控器指南

action.devices.types.THERMOSTAT - 温控器属于温度管理设备,具有设定的点和模式。这将它们与加热器和空调设备区分开来,后者可能只具有模式和设置(例如高/低),但不能设置温度目标值。

此类型表示设备会获得 Thermostat 图标以及一些相关的同义词和别名。

此类设备用于控制温度,而一些供暖/制冷室设备具有不同的控件和高/低模式,但不能进行温度控制。

设备功能

如需了解实现详情(例如您的服务应支持的属性和状态),以及如何构建 EXECUTE 和 QUERY 响应,请参阅相应的特征文档。

必需的特征

这些特征和命令是必需的(如果适用于您的设备)。如果您的设备不支持这些特征,请在 QUERY 或 EXECUTE 响应中输入错误代码 functionNotSupported。如需了解详情,请参阅错误和异常

温控器命令经常链接到 EXECUTE intent 中。如果用户说“将供暖温度设为 72 度*”,系统会生成一个模式命令,后跟一个温度设定值。

质量要求

  • 延迟时间:必须小于或等于 700 毫秒
  • 可靠性:必须大于或等于 97%

示例设备:简易温控器

本部分包含示例 intent 载荷,这些 intent 载荷代表基于上述设备类型和特征的常见“温控器”。如果您在实现中添加或移除特征,请相应地修改响应以反映这些更改。

SYNC 响应示例

请求
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
响应
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.THERMOSTAT",
        "traits": [
          "action.devices.traits.TemperatureSetting"
        ],
        "name": {
          "name": "Simple thermostat"
        },
        "willReportState": true,
        "attributes": {
          "availableThermostatModes": [
            "off",
            "heat",
            "cool",
            "heatcool",
            "on"
          ],
          "thermostatTemperatureRange": {
            "minThresholdCelsius": 15,
            "maxThresholdCelsius": 30
          },
          "thermostatTemperatureUnit": "F"
        },
        "deviceInfo": {
          "manufacturer": "smart-home-inc",
          "model": "hs1234",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        }
      }
    ]
  }
}

示例 QUERY 响应

请求
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
响应
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true,
        "thermostatMode": "cool",
        "thermostatTemperatureSetpoint": 23,
        "thermostatTemperatureAmbient": 25.1,
        "thermostatHumidityAmbient": 45.3
      }
    }
  }
}

EXECUTE 命令示例

ThermostatTemperatureSetpoint

如需详细了解命令参数,请参阅 action.devices.traits.TemperatureSetting 参考文档。

请求
{
  "requestId": "6894439706274654516",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.ThermostatTemperatureSetpoint",
                "params": {
                  "thermostatTemperatureSetpoint": 22
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
响应
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "thermostatMode": "cool",
          "thermostatTemperatureSetpoint": 22,
          "thermostatTemperatureAmbient": 25.1
        }
      }
    ]
  }
}

ThermostatTemperatureSetRange

如需详细了解命令参数,请参阅 action.devices.traits.TemperatureSetting 参考文档。

请求
{
  "requestId": "6894439706274654518",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.ThermostatTemperatureSetRange",
                "params": {
                  "thermostatTemperatureSetpointHigh": 26,
                  "thermostatTemperatureSetpointLow": 22
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
响应
{
  "requestId": "6894439706274654518",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "thermostatMode": "heatcool",
          "thermostatTemperatureSetpointHigh": 26,
          "thermostatTemperatureSetpointLow": 22,
          "thermostatTemperatureAmbient": 25.1
        }
      }
    ]
  }
}

ThermostatSetMode

如需详细了解命令参数,请参阅 action.devices.traits.TemperatureSetting 参考文档。

请求
{
  "requestId": "6894439706274654520",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.ThermostatSetMode",
                "params": {
                  "thermostatMode": "heatcool"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
响应
{
  "requestId": "6894439706274654520",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "thermostatMode": "heatcool",
          "thermostatTemperatureSetpointHigh": 26,
          "thermostatTemperatureSetpointLow": 22,
          "thermostatTemperatureAmbient": 25.1
        }
      }
    ]
  }
}

设备 ERRORS

查看错误和异常的完整列表。
  • inHeatOrCool - 由于设备处于供暖或制冷状态,供暖/制冷/范围命令失败。
  • inHeatCool - 由于设备处于供暖或制冷状态,供暖或制冷命令失败。
  • lockedToRange - 设备已锁定到某个温度范围或模式,并且无法进行所请求的更改。
  • rangeTooClose - 适温范围内的温度点彼此离得太近。