欢迎使用 Google Home 开发者中心,您可以在这里学习有关如何开发智能家居 Action 的新平台。注意:你将继续在 Actions 控制台中构建操作。
使用集合让一切井井有条 根据您的偏好保存内容并对其进行分类。

智能家居温控器指南

action.devices.types.THERMOSTAT - 温控器是温度管理设备,设有设定点和模式。这会将这些设备与仅具有模式和设置(例如高/低)而不是温度目标的加热器和空调装置分开。

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

此类型的设备用于控制温度,而一些供暖/制冷房间设备具有不同的控制和高/低模式,但不具备温度控制。

设备功能

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

所需特征

这些特征和指令(若适用于您的设备)是必需的。

温控器命令通常在 EXECUTE intent 中链接。用户说 *将供暖温度设为 72* 后,系统会生成模式命令,后跟温度设置。

质量要求

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

示例设备:简单的温控器

本部分包含一些 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 命令示例

温控器温度设置点

如需详细了解命令参数,请参阅 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
        }
      }
    ]
  }
}

温控器温度范围

如需详细了解命令参数,请参阅 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
        }
      }
    ]
  }
}

温控器模式

如需详细了解命令参数,请参阅 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
        }
      }
    ]
  }
}

设备出错

查看错误和异常的完整列表。
  • inHeatOrCool - 由于设备处于显式供暖或制冷模式,热/冷/范围命令失败。
  • inHeatCool - 由于设备处于发热或制冷状态,适温或制冷命令失败。
  • lockedToRange - 设备锁定在温度范围或模式下,无法执行请求的更改。
  • rangeTooClose - 制冷范围内的温度点彼此太近。