Alexa智能家居技能开发:设备发现无效

问题描述 投票:0回答:1

我目前正在为百叶窗开发智能家居技能,但是我无法找到设备。我有办法验证“发现”响应消息吗?我认为这是JSON中的逻辑错误。

我正在使用Lambda函数通过node-fetch和async / await执行对我的API的请求,因此我已将所有JS函数标记为异步,这可能是此问题的另一个潜在原因。我在CloudWatch中也没有收到任何错误。

这是我的Lambda函数正在发送的响应:

{
    "event": {
        "header": {
            "namespace": "Alexa.Discovery",
            "name": "Discover.Response",
            "payloadVersion": "3",
            "messageId": "0a58ace0-e6ab-47de-b6af-b600b5ab8a7a"
        },
    "payload": {
        "endpoints": [
            {
                "endpointId": "com-tobisoft-rollos-1",
                "manufacturerName": "tobisoft",
                "description": "Office Blinds",
                "friendlyName": "Office Blinds",
                "displayCategories": [
                    "INTERIOR_BLIND"
                ],
                "capabilities": [
                    {
                        "type": "AlexaInterface",
                        "interface": "Alexa.RangeController",
                        "instance": "Blind.Lift",
                        "version": "3",
                        "properties": {
                            "supported": [
                                {
                                    "name": "rangeValue"
                                }
                            ],
                            "proactivelyReported": true,
                            "retrievable": true
                        },
                        "capabilityResources": {
                            "friendlyNames": [
                                {
                                    "@type": "asset",
                                    "value": {
                                        "assetId": "Alexa.Setting.Opening"
                                    }
                                }
                            ]
                        },
                        "configuration": {
                            "supportedRange": {
                                "minimumValue": 0,
                                "maximumValue": 100,
                                "precision": 1
                            },
                            "unitOfMeasure": "Alexa.Unit.Percent"
                        },
                        "semantics": {
                            "actionMappings": [
                                {
                                    "@type": "ActionsToDirective",
                                    "actions": [
                                        "Alexa.Actions.Close"
                                    ],
                                    "directive": {
                                        "name": "SetRangeValue",
                                        "payload": {
                                            "rangeValue": 100
                                        }
                                    }
                                },
                                {
                                    "@type": "ActionsToDirective",
                                    "actions": [
                                        "Alexa.Actions.Open"
                                    ],
                                    "directive": {
                                        "name": "SetRangeValue",
                                        "payload": {
                                            "rangeValue": 1
                                        }
                                    }
                                },
                                {
                                    "@type": "ActionsToDirective",
                                    "actions": [
                                        "Alexa.Actions.Lower"
                                    ],
                                    "directive": {
                                        "name": "AdjustRangeValue",
                                        "payload": {
                                            "rangeValueDelta": 10,
                                            "rangeValueDeltaDefault": false
                                        }
                                    }
                                },
                                {
                                    "@type": "ActionsToDirective",
                                    "actions": [
                                        "Alexa.Actions.Raise"
                                    ],
                                    "directive": {
                                        "name": "AdjustRangeValue",
                                        "payload": {
                                            "rangeValueDelta": -10,
                                            "rangeValueDeltaDefault": false
                                        }
                                    }
                                }
                            ],
                            "stateMappings": [
                                {
                                    "@type": "StatesToValue",
                                    "states": [
                                        "Alexa.States.Closed"
                                    ],
                                    "value": 100
                                },
                                {
                                    "@type": "StatesToRange",
                                    "states": [
                                        "Alexa.States.Open"
                                    ],
                                    "range": {
                                        "value": 0
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "type": "AlexaInterface",
                        "interface": "Alexa",
                        "version": "3"
                    }
                ]
            }
        ]
    }
    }
}

感谢您的帮助。

amazon-web-services aws-lambda alexa-skills-kit
1个回答
0
投票

我是否可以验证我的发现响应消息?

是,您可以使用Alexa Smart Home Message JSON Schema。此架构可用于技能开发过程中的消息验证,它可验证智能家居技能(视频技能API除外)。

这是我的Lambda函数正在发送的响应

我已经在this steps之后验证了您的响应,结果是:未发现错误,JSON根据模式进行了验证。因此,可能还有另一件事发生。我建议与Alexa Developer Contact Us]联系

© www.soinside.com 2019 - 2024. All rights reserved.