alexa-samples / alexa-smarthome

Resources for Alexa Smart Home developers.
https://alexa.design/smarthome
Other
685 stars 336 forks source link

Discover.Response sent no device appearing in Alexa #41

Closed rsigg closed 6 years ago

rsigg commented 6 years ago

The following Discover.Response is sent however, the device is not appearing in the Alexa Devices list. The json has been validated by following the instructions: https://github.com/alexa/alexa-smarthome/wiki/Validation-Schemas

Request:

{
    "directive": {
        "header": {
            "namespace": "Alexa.Discovery",
            "name": "Discover",
            "payloadVersion": "3",
            "messageId": "7b6207b9-fdd8-4e0f-91c2-cd64ec5204db"
        },
        "payload": {
            "scope": {
                "type": "BearerToken",
                "token": "redacted"
            }
        }
    }
}

Response:

{
    "event": {
        "header": {
            "namespace": "Alexa.Discovery",
            "name": "Discover.Response",
            "payloadVersion": "3",
            "messageId": "7b6207b9-fdd8-4e0f-91c2-cd64ec5204db"
        },
        "payload": {
            "endpoints": [
                {
                    "endpointId": "hikbd321d7d4",
                    "manufacturerName": "momentum",
                    "friendlyName": "Staging",
                    "description": "something",
                    "displayCategories": [
                        "CAMERA"
                    ],
                    "cookie": {
                        "model": "MOCAM-720-01",
                        "manufacturer": "momentum"
                    },
                    "capabilities": [
                        {
                            "type": "AlexaInterface",
                            "interface": "Alexa",
                            "version": "3"
                        },
                        {
                            "type": "AlexaInterface",
                            "interface": "Alexa.CameraStreamController",
                            "version": "3",
                            "cameraStreamConfigurations": [
                                {
                                    "protocols": [
                                        "RTSP"
                                    ],
                                    "resolutions": [
                                        {
                                            "width": 1920,
                                            "height": 1080
                                        },
                                        {
                                            "width": 1280,
                                            "height": 720
                                        }
                                    ],
                                    "authorizationTypes": [
                                        "NONE"
                                    ],
                                    "videoCodecs": [
                                        "H264"
                                    ],
                                    "audioCodecs": [
                                        "AAC"
                                    ]
                                }
                            ]
                        },
                        {
                            "type": "AlexaInterface",
                            "interface": "Alexa.PowerController",
                            "version": "3",
                            "properties": {
                                "supported": [
                                    {
                                        "name": "powerState"
                                    }
                                ],
                                "proactivelyReported": true,
                                "retrievable": true
                            }
                        },
                        {
                            "type": "AlexaInterface",
                            "interface": "Alexa.EndpointHealth",
                            "version": "3",
                            "properties": {
                                "supported": [
                                    {
                                        "name": "connectivity"
                                    }
                                ],
                                "proactivelyReported": true,
                                "retrievable": true
                            }
                        }
                    ]
                }
            ]
        }
    }
}
rsigg commented 6 years ago

Issue has been resolved, I was reusing lambda function code that was wrapping the response incorrectly. Schema is valid and discovery worked.