question

InnovationLab avatar image
InnovationLab asked

Need Help, Alexa “I'm not quite sure what went wrong.”

I've been stuck for a few days now and not sure what's wrong. I am developing an Alexa Smart Home Skill with NodeJs. My Smart Home Skill supports PowerController and ModeController. The skill appears to work correctly with the Discovery and ReportState events. I can turn on/off the device. I can change the modes too. It executes my lambda correctly. However, when I ask Alexa if the device is on/off or what mode its in, it responds with

I'm not quite sure what went wrong.

Do I need to implement something else besides a StateReport or is there something wrong in my discovery? I have searched Google and found a couple of cases on this and one was resolved by putting something in the payload section of the StateReport. I tried it but didn't make any difference. By the way, the logs for Watch Dog look fine. I can see the ReportState call and my StateReport responses in json.


Thank you for you time!

Below are my Discovery and StateReport responses.

Discovery:

{
        "event": {
            "header": {
                "namespace": "Alexa.Discovery",
                "name": "Discover.Response",
                "payloadVersion": "3",
                "messageId": "203a884f-9ff4-4e23-a8f6-34864f4c261b"
            },
            "payload": {
                "endpoints": [
                    {
                        "endpointId": "MySmartSwitch-001",
                        "manufacturerName": "Smart Innovation Company",
                        "description": "My Battery Smart Device Switch",
                        "friendlyName": "MyDevice",
                        "displayCategories": [
                            "OTHER"
                        ],
                        "cookie": {
                            "key1": "arbitrary key/value pairs for skill to reference this endpoint.",
                            "key2": "There can be multiple entries",
                            "key3": "but they should only be used for reference purposes.",
                            "key4": "This is not a suitable place to maintain current endpoint state."
                        },
                        "capabilities": [
                            {
                                "interface": "Alexa.PowerController",
                                "version": "3",
                                "type": "AlexaInterface",
                                "properties": {
                                    "supported": [
                                        {
                                            "name": "powerState"
                                        }
                                    ],
                                    "proactivelyReported": true,
                                    "retrievable": true,
                                    "nonControllable": false
                                }
                            },
                            {
                                "type": "AlexaInterface",
                                "interface": "Alexa.ModeController",
                                "instance": "MyDevice.EnergySetting",
                                "version": "3",
                                "properties": {
                                    "supported": [
                                        {
                                            "name": "mode"
                                        }
                                    ],
                                    "retrievable": true,
                                    "proactivelyReported": true,
                                    "nonControllable": false
                                },
                                "capabilityResources": {
                                    "friendlyNames": [
                                        {
                                            "@type": "text",
                                            "value": {
                                                "text": "Energy Setting",
                                                "locale": "en-US"
                                            }
                                        }
                                    ]
                                },
                                "configuration": {
                                    "ordered": false,
                                    "supportedModes": [
                                        {
                                            "value": "EnergySetting.Backup",
                                            "modeResources": {
                                                "friendlyNames": [
                                                    {
                                                        "@type": "text",
                                                        "value": {
                                                            "text": "Backup",
                                                            "locale": "en-US"
                                                        }
                                                    }
                                                ]
                                            }
                                        },
                                        {
                                            "value": "EnergySetting.Consumption",
                                            "modeResources": {
                                                "friendlyNames": [
                                                    {
                                                        "@type": "text",
                                                        "value": {
                                                            "text": "Consumption",
                                                            "locale": "en-US"
                                                        }
                                                    }
                                                ]
                                            }
                                        },
                                        {
                                            "value": "EnergySetting.Manual",
                                            "modeResources": {
                                                "friendlyNames": [
                                                    {
                                                        "@type": "text",
                                                        "value": {
                                                            "text": "Manual",
                                                            "locale": "en-US"
                                                        }
                                                    }
                                                ]
                                            }
                                        },
                                        {
                                            "value": "EnergySetting.Duration",
                                            "modeResources": {
                                                "friendlyNames": [
                                                    {
                                                        "@type": "text",
                                                        "value": {
                                                            "text": "Duration",
                                                            "locale": "en-US"
                                                        }
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                }
                            },
                            {
                                "type": "AlexaInterface",
                                "interface": "Alexa",
                                "version": "3"
                            }
                        ]
                    }
                ]
            }
        }
    }

StateReport

{
        "event": {
            "header": {
                "namespace": "Alexa",
                "name": "StateReport",
                "payloadVersion": "3",
                "messageId": "ba19a260-494e-40cf-9649-456eda768ef1-R",
                "correlationToken": "AAAAAAA..."
            },
            "endpoint": {
                "scope": {
                    "type": "BearerToken",
                    "token": "Atza|IwEBI..."
                },
                "endpointId": "MySmartSwitch-001"
            },
            "payload": {}
        },
        "context": {
            "properties": [
                {
                    "namespace": "Alexa.EndpointHealth",
                    "name": "connectivity",
                    "value": {
                        "value": "OK"
                    },
                    "timeOfSample": "2019-11-12T15:50:49.431Z",
                    "uncertaintyInMilliseconds": 0
                },
                {
                    "namespace": "Alexa.PowerController",
                    "name": "powerState",
                    "value": {
                        "value": "OFF"
                    },
                    "timeOfSample": "2019-11-12T15:50:49.431Z",
                    "uncertaintyInMilliseconds": 0
                },
                {
                    "namespace": "Alexa.ModeController",
                    "name": "mode",
                    "value": "EnergySetting.Backup",
                    "timeOfSample": "2019-11-12T15:50:49.431Z",
                    "uncertaintyInMilliseconds": 0
                }
            ]
        }
    }
alexa skills kitalexaalexa smart homesmart home
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeremy avatar image
Jeremy answered

You aren't reporting the ModeController interface instance "MyDevice.EnergySetting" in your StateReport response. That would explain your issue with not getting the current mode status. In regards to the power status, I don't believe that the PowerController interface supports these requests.

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks for your reply. The following is included in my StateReport. Isn't this what you are talking about?

  1. {
  2. "namespace": "Alexa.ModeController",
  3. "name": "mode",
  4. "value": "EnergySetting.Backup",
  5. "timeOfSample": "2019-11-12T15:50:49.431Z",
  6. "uncertaintyInMilliseconds": 0
  7. }


0 Likes 0 ·
1574086224811.png (1.4 KiB)

You need to include the instance property which you defined in your discovery response:

{
  "namespace": "Alexa.ModeController",
  "instance": "MyDevice.EnergySetting",
  "name": "mode",
  "value": "EnergySetting.Backup",
  "timeOfSample": "2019-11-12T15:50:49.431Z",
  "uncertaintyInMilliseconds": 0
}
0 Likes 0 ·