Alexa 智能家居技能开发:设备发现不起作用

Alexa smart home skill development: Device discovery not working

我目前正在为我的百叶窗开发智能家居技术,但是我无法找到设备。有没有办法验证我的 Discovery 响应消息?我认为这是 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"
                    }
                ]
            }
        ]
    }
    }
}

感谢您的帮助。

Is there a way for me to validate my Discovery response message?

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

This is the response my Lambda function is sending

我已经根据 this steps, the result: no errors found, the JSON validates against the schema. So, there's probably another thing going on. I suggest getting in touch with Alexa Developer Contact Us

验证了您的回复