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

Need help by using your code #1

Open
MaScPe opened this issue Dec 25, 2017 · 0 comments
Open

Need help by using your code #1

MaScPe opened this issue Dec 25, 2017 · 0 comments

Comments

@MaScPe
Copy link

MaScPe commented Dec 25, 2017

Hello HerrDoktorDB,

I do not know how to contact you here, so I use issue. your code does exactly what i need but it does not work with my alexa. I tried to use it with my HTTP-request to control my TV receiver.

This is my code, maybe u like to help me a little bit. I am new in programming Alexa. Maybe you or someone else find my misstakes.

Best regards from germany and merry xmas :-)

var speechOutput;
var reprompt;
var welcomeOutput = "Willkommen, der Skill ist nun aktiviert. Nenne mir einen Sender! ";
var welcomeReprompt = "Sage mir doch einfach einen Sender";

"use strict";

var Alexa = require('alexa-sdk');
var http = require('http');
var APP_ID = '...'; 

var request_ARD = {
    host: '192.168.178.23',
    path: '/api/zap?sRef=1:0:19:283D:3FB:1:C00000:0:0:0:',
    //methode: 'GET'
};

var handlers = {
    //Wird beim öffnen des Skill angefragt, wenn kein Intent verwendet wird:
    'LaunchRequest': function () {
          this.emit(':ask', welcomeOutput, welcomeReprompt);
    },
	'AMAZON.HelpIntent': function () {
        speechOutput = 'Sage mir einen Namen aus deiner Familie!';
        reprompt = 'Welcher Name soll es sein?';
        this.emit(':ask', speechOutput, reprompt);
    },
    'AMAZON.CancelIntent': function () {
        speechOutput = 'Skill wurde abgebrochen';
        this.emit(':tell', speechOutput);
    },
    'AMAZON.StopIntent': function () {
        speechOutput = 'Skill wurde gestoppt';
        this.emit(':tell', speechOutput);
    },
    'SessionEndedRequest': function () {
        speechOutput = 'Skill wurde automatisch deaktivert';
        this.emit(':tell', speechOutput);
    },
    'SetChannelIntent': function () {

        http.get(request_ARD, function (res) {
            console.log("Response: " + res.statusCode);
            response(res.statusCode);
        }).on('error', function (e) {
            console.log("Error message: " + e.message);
        });
    
        speechOutput = "Bis hierhin und nicht weiter";
        this.emit(':tell', speechOutput);
    }
};
exports.handler = (event, context) => {
    var alexa = Alexa.handler(event, context);
    alexa.APP_ID = APP_ID;
    alexa.registerHandlers(handlers);
    alexa.execute();
};`
```
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

1 participant