You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法触发Alexa发送GetWeeklySchedule指令的技术咨询

问题:Alexa恒温器接口无法触发GetWeeklySchedule指令且无日程修改选项

我用Node.js开发了对接AWS/Alexa的恒温器接口,目前能在Alexa App中获取设定值、当前温度以及「按日程控制」状态,但无法触发Alexa发送GetWeeklySchedule指令,同时App里也没有日程修改的选项。

以下是我的发现响应和状态报告响应代码:

发现响应

{
    endpointId: endpointId,
    manufacturerName: 'Me',
    description: description,
    friendlyName: friendlyName,
    displayCategories: ["THERMOSTAT"],
    cookie: {},
    capabilities:
    [
      {
        interface: 'Alexa.ThermostatController',
        version: '3.1',
        type: 'AlexaInterface',
        properties: {
          supported: [
            {
              name: 'targetSetpoint'
            },
            {
              name: 'thermostatMode'
            }
          ],
          proactivelyReported: false,
          retrievable: true
        },
        configuration:
        {
          supportedModes: ["HEAT", "OFF"],
          supportsScheduling: true
        }
      },
      {
        type: 'AlexaInterface',
        interface: 'Alexa.TemperatureSensor',
        version: '3',
        properties: {
          supported: [
            {
              name: 'temperature'
            }
          ],
          proactivelyReported: false,
          retrievable: true
        },
      },
      {
        type: "AlexaInterface",
        interface: "Alexa.ThermostatController.Schedule",
        version: "3.2",
        properties: {
          supported: [
            {
              name: "scheduleEnabled"
            }
          ],
          proactivelyReported: false,
          retrievable: true
        },
        configuration: {
          supportedFanModes: ["AUTO"],
          supportsAdaptiveRecovery: false
        }
      },
      {
        type: 'AlexaInterface',
        interface: 'Alexa',
        version: '3'
      }
    ]
  }

状态报告响应

{
  namespace: 'Alexa.ThermostatController',
  name: 'thermostatMode',
  value: info.deviceMode,
  timeOfSample: new Date().toISOString(),
  uncertaintyInMilliseconds: 500
}
{
  namespace: 'Alexa.ThermostatController',
  name: 'targetSetpoint',
  value:
  {
    value: info.deviceSetPoint,
    scale: 'FAHRENHEIT'
  },
  timeOfSample: new Date().toISOString(),
  uncertaintyInMilliseconds: 500
}
{
  namespace: 'Alexa.TemperatureSensor',
  name: 'temperature',
  value:
  {
    value: info.deviceTemperature,
    scale: 'FAHRENHEIT'
  },
  timeOfSample: new Date().toISOString(),
  uncertaintyInMilliseconds: 500
}
{
  namespace: 'Alexa.ThermostatController.Schedule',
  name: 'adaptiveRecoveryEnabled',
  value: false,
  timeOfSample: new Date().toISOString(),
  uncertaintyInMilliseconds: 500
}
{
  namespace: 'Alexa.ThermostatController.Schedule',
  name: 'scheduleEnabled',
  value: true,
  timeOfSample: new Date().toISOString(),
  uncertaintyInMilliseconds: 500
}

问题根源

  1. Alexa.ThermostatController.Schedule接口配置不完整:当前仅声明了scheduleEnabled属性支持,但Alexa需要明确感知到设备支持周度日程的读写能力才会触发GetWeeklySchedule指令,并在App中显示日程修改选项。
  2. 缺少关键配置参数:未在configuration中声明支持日程修改和指定日程类型,导致Alexa无法识别设备的日程交互能力。

修复方案

1. 更新发现响应中的Alexa.ThermostatController.Schedule配置

修改该接口的properties.supported和configuration部分,添加周度日程支持及修改权限:

{
  type: "AlexaInterface",
  interface: "Alexa.ThermostatController.Schedule",
  version: "3.2",
  properties: {
    supported: [
      { name: "scheduleEnabled" },
      { name: "weeklySchedule" } // 新增周度日程属性支持
    ],
    proactivelyReported: false,
    retrievable: true
  },
  configuration: {
    supportedFanModes: ["AUTO"],
    supportsAdaptiveRecovery: false,
    supportsScheduleModification: true, // 明确标记支持日程修改
    supportedScheduleTypes: ["WEEKLY"] // 指定支持周度日程类型
  }
}

2. 实现GetWeeklySchedule指令处理逻辑

在Node.js代码中添加对应指令的处理,返回设备当前的周度日程数据:

// 示例处理逻辑
if (directive.namespace === 'Alexa.ThermostatController.Schedule' && directive.name === 'GetWeeklySchedule') {
  // 从设备或数据库获取周日程数据
  const weeklySchedule = {
    scheduleItems: [
      {
        dayOfWeek: "MONDAY",
        startTime: "07:00:00",
        targetSetpoint: { value: 72, scale: "FAHRENHEIT" },
        thermostatMode: "HEAT"
      },
      // 补充其他日期的日程项
    ]
  };

  return {
    context: {
      properties: [
        {
          namespace: 'Alexa.ThermostatController.Schedule',
          name: 'weeklySchedule',
          value: weeklySchedule,
          timeOfSample: new Date().toISOString(),
          uncertaintyInMilliseconds: 500
        }
      ]
    },
    event: {
      header: {
        namespace: 'Alexa.ThermostatController.Schedule',
        name: 'GetWeeklyScheduleResponse',
        messageId: directive.header.messageId + '-R',
        payloadVersion: '3.2'
      },
      payload: {}
    }
  };
}

3. 可选:添加SetWeeklySchedule指令处理

若需要支持Alexa App修改日程,需实现该指令的处理逻辑,接收并更新设备的日程配置。

验证步骤

  1. 重新部署修改后的发现响应代码。
  2. 在Alexa App中重新发现设备。
  3. 进入设备详情页,检查是否出现日程修改选项。
  4. 通过Alexa开发者控制台测试工具,触发GetWeeklySchedule指令,确认后端能正常响应。

内容的提问来源于stack exchange,提问作者John Smith

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 00:35:15