Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device is unresponsive #70

Open
AnimeshBote opened this issue Apr 24, 2018 · 12 comments
Open

Device is unresponsive #70

AnimeshBote opened this issue Apr 24, 2018 · 12 comments
Assignees

Comments

@AnimeshBote
Copy link

I have written response message correctly. Execution is successful for lambda event request.When I test it on emulator it returns me ok status but in the alexa app under device status it doesn't show updated status. It remains off and also I get device is unresponsive message. Please help with this issue.

img-20180424-wa0008

@krishnu9
Copy link

did you solve this yet?

@AnimeshBote
Copy link
Author

I think device will remain unresponsive because we are dealing with virtual device. I am going to try it with yee-light open API device.

@krishnu9
Copy link

Do you know how i can control devices connected to Arduino with this skill? I don't know how to send data to the mCu from the skill.

@raghuveer-s
Copy link

This could be because the ReportState directive needs to be implemented. Check https://developer.amazon.com/docs/device-apis/alexa-interface.html#reportstate and https://developer.amazon.com/docs/smarthome/state-reporting-for-a-smart-home-skill.html for more details.

@pradipshenolkar
Copy link

Me too facing this issue. Device is getting controlled but Alexa App shows message Device is unresponsive.
However Echo Dot is working as expected.
I will implement the ReportState and check if it solves the problem.

@msjonathan
Copy link

I am having the same issue, when the device is controlled it succeeds. But I get the warning device is unresponsive. I've implemented the ReportState and I believe that works - when I open the app the state of the device is fetched. @pradipshenolkar did it solve your problems?

@Prasad491
Copy link

I am facing the same issue since long. Tried all the possible solutions to resolve an issue but couldn't.Although all the devices are included in the same group it is detecting only two devices out of four. I have connected lights through Wemo Device.

@mstn
Copy link

mstn commented May 27, 2019

Similar or same problem here.

  1. ReportState is implemented
  2. Discovery and ReportState responses are valid for https://github.com/alexa/alexa-smarthome/wiki/Validation-Schemas
  3. Bulb is shown with the correct state returned from ReportState
  4. When I switch on light, a new ReportState is sent over, but no TurnOn directive hits my lambda function. The message Device is unresponsive is shown for few secs.

@AnimeshBote I am using a sort of virtual devices, too. I am emulating a real device via API. In theory it shouldn't make any difference for Alexa. Did you find any problem with virtual devices?

@mayank-kanzariya
Copy link

I have used SmartHome skill and implemented "PowerController" and "StateReport" interfaces for Bulb.

In alexa app display actual state of the Bulb.

Reference Link: https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-powercontroller.html

Note: I have used Alexa V3 APIs.

@pixelatedpic
Copy link

@mayank-kanzariya can you share some code for that two functions? i am also using virtual device and API v3. I want to know the flow. What i mean is after sending a TurnOn request for powerController do i have to send StateReport or i have to wait for ReportState request?

@harishajankar
Copy link

please solve my query am trying to setup the device responce but not working
given below program

var https = require('https');
var firebaseHost = "saprahas-d6d9e.firebaseio.com";

exports.handler = function (request, context) {
if (request.directive.header.namespace === 'Alexa.Discovery' && request.directive.header.name === 'Discover') {
log("DEBUG:", "Discover request", JSON.stringify(request));
handleDiscovery(request, context, "");
}
else if (request.directive.header.namespace === 'Alexa.PowerController') {
if (request.directive.header.name === 'TurnOn' || request.directive.header.name === 'TurnOff') {
log("DEBUG:", "TurnOn or TurnOff Request", JSON.stringify(request));
handlePowerControl(request, context);
}
}

function handleDiscovery(request, context) {
    var payload = {
        "endpoints":
        [
            {
                "endpointId": "demo_id",
                "manufacturerName": "Smart Device Company",
                "friendlyName": "Bedroom Outlet",
                "description": "Smart Device Switch",
                "displayCategories": ["SWITCH"],
                "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":
                [
                    {
                      "type": "AlexaInterface",
                      "interface": "Alexa",
                      "version": "3"
                    },
                    {
                        "interface": "Alexa.PowerController",
                        "version": "3",
                        "type": "AlexaInterface",
                        "properties": {
                            "supported": [{
                                "name": "powerState"
                            }],
                             "retrievable": true
                        }
                    }
                ]
            }
        ]
    };
    var header = request.directive.header;
    header.name = "Discover.Response";
    log("DEBUG", "Discovery Response: ", JSON.stringify({ header: header, payload: payload }));
    context.succeed({ event: { header: header, payload: payload } });
}

function log(message, message1, message2) {
    console.log(message + message1 + message2);
}

function handlePowerControl(request, context) {
    // get device ID passed in during discovery
    var requestMethod = request.directive.header.name;
    var responseHeader = request.directive.header;
    responseHeader.namespace = "Alexa";
    responseHeader.name = "Response";
    responseHeader.messageId = responseHeader.messageId + "-R";
    // get user token pass in request
    var requestToken = request.directive.endpoint.scope.token;
    var powerResult;

    if (requestMethod === "TurnOn") {

        // Make the call to your device cloud for control
        // powerResult = stubControlFunctionToYourCloud(endpointId, token, request);
        powerResult = "ON";
         fbPut("/foo/bar",powerResult )
    }
   else if (requestMethod === "TurnOff") {
        // Make the call to your device cloud for control and check for success
        // powerResult = stubControlFunctionToYourCloud(endpointId, token, request);
        powerResult = "OFF";
         fbPut("/foo/bar",powerResult )
    }
    var contextResult = {
        "properties": [{
            "namespace": "Alexa.PowerController",
            "name": "powerState",
            "value": powerResult,
            "timeOfSample": "2017-09-03T16:20:50.52Z", //retrieve from result.
            "uncertaintyInMilliseconds": 50
        }]
    };
    var response = {
        context: contextResult,
        event: {
            header: responseHeader,
            endpoint: {
                scope: {
                    type: "BearerToken",
                    token: requestToken
                },
                endpointId: "demo_id"
            },
            payload: {}
        }
    };
    log("DEBUG", "Alexa.PowerController ", JSON.stringify(response));
    context.succeed(response);
}

};

function fbGet(key){
return new Promise((resolve, reject) => {
var options = {
hostname: firebaseHost,
port: 443,
path: key + ".json",
method: 'GET'
};
var req = https.request(options, function (res) {
res.setEncoding('utf8');
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
resolve(JSON.parse(body))
});
});
req.end();
req.on('error', reject);
});
}

function fbPut(key, value){
return new Promise((resolve, reject) => {
var options = {
hostname: firebaseHost,
port: 443,
path: key + ".json",
method: 'PUT'
};

var req = https.request(options, function (res) {
  console.log("request made")
  res.setEncoding('utf8');
  var body = '';
  res.on('data', function(chunk) {
    body += chunk;
  });
  res.on('end', function() {
    resolve(body)
  });
});
req.end(JSON.stringify(value));
req.on('error', reject);

});
}

//-------Helper Methods---------//
function onLaunch(callback) {
var output = "Welcome to trial firebase skill . what action did you want to perform . ";
var endSession = false;
callback(buildSpeechletResponse(output, endSession));
}

function buildSpeechletResponse(output, shouldEndSession) {
return {
outputSpeech: {
type: "PlainText",
text: output
},
shouldEndSession: shouldEndSession
};
}

function buildResponse(speechletResponse) {
return {
version: "1.0",
response: speechletResponse
};
}

am requesting to please solve my problem what actually i want to do the

@rjpgt
Copy link

rjpgt commented Nov 25, 2021

I was trying to wake up my desktop computer using the WakeOnLan controller. After quite a bit of struggle the skill started working but Alexa's voice response was that the device wasn't responding. After quite a bit of trial and error, I was able to solve this issue by not sending a deferred response. I removed deferred response altogether and it started working.

@gilleswb gilleswb self-assigned this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests