2017-07-19 70 views
1

我的Alexa Smart Home Skill for Entertainment Devices实现了API版本3的一些功能,包括Alexa.Speaker Interface实现Alexa.Speaker接口无法响应音量变化请求的智能家居设备

据我从文档理解,应该响应语音如命令“的Alexa,装置的体积设定为5”,然而的Alexa总是与响应“对不起,我无法控制您的设备上的音量“

设备的发现响应看起来像这样

{ 
    endpointId: 'music1', 
    friendlyName: 'pillow', 
    description: 'Music on Kodi', 
    manufacturerName: 'Cubox-i', 
    displayCategories: [], 
    capabilities: [ 
     { 
      type: 'AlexaInterface', 
      interface: 'Alexa.PowerController', 
      version: '1.0', 
      properties: { 
       supported: [ 
        { 
         name: 'powerState', 
        }, 
       ], 
      }, 
     }, 
     { 
      type: 'AlexaInterface', 
      interface: 'Alexa.PlaybackController', 
      version: '1.0', 
      properties: {}, 
     }, 
     { 
      type: 'AlexaInterface', 
      interface: 'Alexa.Speaker', 
      version: '1.0', 
      properties: { 
       supported: [ 
        { 
         name: 'volume', 
        }, 
        { 
         name: 'muted', 
        }, 
       ], 
      }, 
     }, 
    ], 
} 

发现似乎很好地工作,因为PowerController接口被响应细(例如“Alexa的,打开枕”)。
我可以在AWS Lambda日志中看到发现,PowerControllerPlaybackController请求和响应。

任何声音命令来Speaker(是否试图音量设置为20,增加它,或询问是否静音取消静音枕头)不产生我的Lambda和结果的任何请求在上面提到的响应中 - 或在屏蔽的情况下“枕头不支持”

回答

1

而不是

properties: { 
      supported: [ 
       { 
        name: 'volume', 
       }, 
       { 
        name: 'muted', 
       }, 
      ], 
     }, 

这个JSON,使用此:

'properties.supported':[{ 
        name: 'volume', 
       }, 
       { 
        name: 'muted', 
       }] 

这是他们正在试图解决一个bug,但直到那时,这将工作,请让我知道,如果这特定的解决方案适用于您。

+0

感谢您的回答。这似乎已经完成了“静音/取消静音”命令。然而,当试图设置音量(“将枕头的体积设置为5”)时,响应仍然是“抱歉,我无法控制设备上的音量” - 或者有时“抱歉,枕头不支持该音量” 这里有趣的是,即使我使用相同的输入命令,错误消息有时是一个,有时是另一个。结合你的提示,这告诉我这个API不稳定,错误可能不是在我的,但在亚马逊的一面。 – WrongAboutMostThings

1

要添加到“properties.supported”,版本应该是1(而不是3)。扬声器接口发现响应应该如下所示:

{ 
    "type": "AlexaInterface", 
    "interface": "Alexa.Speaker", 
    "version": "1.0", 
    "properties.supported":[ 
    { 
     "name": "muted", 
    }, 
    { 
     "name": "volume" 
    }] 
}