alexa-samples / alexa-smarthome

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

Having trouble in channelController #53

Closed VijayKrishna91 closed 9 months ago

VijayKrishna91 commented 6 years ago

My skill is working fine for powerController, sceneController etc.. But with channelController i am facing problem, It's very irritating there is no clear message where it's failing,. I checked my lambda for logs i find everything right even channel is changed(Action happening as expected) but alexa says 'my device name' is not responding. This is what i get in payload from alexa directive -

{
    "header": {
        "namespace": "Alexa.ChannelController",
        "name": "ChangeChannel",
        "payloadVersion": "3",
        "messageId": "SOMEID",
        "correlationToken": "SOME_TOKEN"
    },
    "endpoint": {
        "scope": {
            "type": "BearerToken",
            "token": "SomeBearerToken"
        },
        "endpointId": "5a27c092914b9b7dee318fc7",
        "cookie": {
            "kd_id": "6001941a6601",
            "type": "irApp"
        }
    },
    "payload": {
        "channel": {
            "number": "201"
        },
        "channelMetadata": {}
    }
}

And this is what i am sending in response after successful action

{
    "event": {
        "header": {
            "namespace": "Alexa",
            "name": "Response",
            "payloadVersion": "3",
            "messageId": "SOMEID",
            "correlationToken": "SOME_TOKEN"
        },
        "endpoint": {
            "scope": {
                "type": "BearerToken",
                "token": "SomeBearerToken"
            },
            "endpointId": "5a27c092914b9b7dee318fc7",
            "cookie": {
                "remote_codeset": "58c630053c8ab2bc3d3b0284",
                "paired_ud": "5a5711de57a58c0a06c3e432",
                "kd_id": "6001941a6601",
                "type": "irApp"
            }
        },
        "payload": {}
    },
    "context": {
        "properties": [
            {
                "namespace": "Alexa.ChannelController",
                "name": "channel",
                "value": {
                    "number": "201",
                    "callSign": "callsign1",
                    "affiliateCallSign": "callsign2"
                },
                "timeOfSample": "2017-02-03T16:20:50.52Z",
                "uncertaintyInMilliseconds": 0
            },
            {
                "namespace": "Alexa.EndpointHealth",
                "name": "connectivity",
                "value": {
                    "value": "OK"
                },
                "timeOfSample": "Thu Mar 01 2018 17:53:01 GMT+0530 (IST)",
                "uncertaintyInMilliseconds": 200
            }
        ]
    }
}

My server responds to alexa within 200-300ms still alexa tells the 'my device' is not responding.

I am stuck at this thing for 3 days.. Is there something wrong with the response of channelController responseformat.. ?

dievaa commented 9 months ago

According to the ChangeChannel directive you are receiving, you did not have all the channel properties like "callSign" and "affiliateCallSign" for that channel. So, as you need to include in the “context” object the values of all properties that changed, you have to include only the properties received in the ChangeChannel directive, in this case "number": "201".

In addition, you may also need to include "Alexa.PowerController" in the ChangeChannel response, as per the following example: https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-channelcontroller.html#changechannel-response-event

If the suggestions above didn't resolve the issue, please do not hesitate to reach out to us via the Contact Us page providing the Customer ID and Timestamp in UTC of a recent error.