I'm doing a skill in the Alexa development console.
An intent within the skill is as follows:
activates the output {mySlot} where mySlot is of type AMAZON.NUMBER
I have taken a lambda function provided by the manufacturer of a microntroller from an example.
This function is a JS file where I have written a function for the aforementioned intent as follows:
function setMyOutPut(intent, session, callback)
{
...
const desiredState = intent.slots.mySlot.value;
if ((desiredState === 1))
{
powerOn = 1;
}
else if ((desiredState === 2))
{
powerOn = 2;
}
else if ((desiredState === 3))
{
powerOn = 3;
}
else
{
speechOutput = "There are only three outputs to activate";
repromptText = "I did not understand the exit number, please try again';
callback(sessionAttributes, buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));
}
...
}
When from Alexa I execute the Skill and the intent, when I say "activates the output one", a confirmation Intent is executed in which Alexa responds "The output has been activated correctly".
But if I say, for example "activate the output seven", in the same way it responds that it has been activated correctly.
Or there are times when I say "activates the output three" and the else is produced and it answers "There are only three outputs to activate".
So what I suspect is that intent.slots.mySlot.value is not a numeric variable.
Any suggestions or comments?