Amazon Echo Node.js Device is not responding

297
July 08, 2017, at 3:35 PM

I´ve created a custom smart home project using Node.js. Alexa is turning on/off devices just fine, but she always replies that the device is not responding. The server responses either

{ "success" : true }

or

{ "success" : false }

Here is my code:

function turnOff(applianceId, callback) {
    GET(applianceId, "turnOff", function(call){
        if (call.toString() === "true")
            return generateResponse('TurnOffConfirmation', {});
        else
            return generateResponse('TargetHardwareMalfunctionError', {});
    });
}
function GET(device, command, callback) {
    var https = require('https');
    var url = '<https get url>/'+device+'/'+command;
    https.get(url, function(res) {
      var body = '';
      res.on('data', function(chunk) {
        body += chunk;
      });
      res.on('end', function() {
        var jsData = JSON.parse(body);
        callback(jsData.success);
      });
    }).on('error', function(e) {
      console.log("Got error: " + e.message);
    }); 
}
Rent Charter Buses Company
READ ALSO
Unable to install an npm package

Unable to install an npm package

I tried many different ways to install this package: npm install cloud-print npm install https://githubcom/postmen/node-cloud-print

451
Next.js redirects when navigating on first page load

Next.js redirects when navigating on first page load

I have a nextjs app with custom server routing on express

358
Sequelize: concat and compare col-values of associated models on top level

Sequelize: concat and compare col-values of associated models on top level

I want to concat cols from my model and joined models in a select

372
Node.js files never work

Node.js files never work

I am having a difficult time getting the most basic things done on Nodejs

338