我在圣诞节得到了一个回音节目。现在我想尝试一下如何定制它。我已经创建了几个传感器,其度量标准存储在AWS DynamoDB中。现在,我想知道有什么可能性,我必须显示图表创建的数据。是否可以直接使用Alexa表示语言(APL)显示图表?是否可以将iframes包括在APL中?我没有找到关于这个话题的多少信息。也许你能给我指明正确的方向。
事先非常感谢
发布于 2021-01-04 19:35:14
作为参考,我将向代码展示一个nodejs函数,它能够导航到URL:
const MetricsChoiceIntentHandler = {
canHandle(handlerInput) {
return Alexa.getIntentName(handlerInput.requestEnvelope) === 'MetricsChoiceIntent';
},
handle(handlerInput) {
const choice = handlerInput.requestEnvelope.request.intent.slots.choice.value;
const speakOutput = `Alles klar. Auf zu ${choice}`;
console.log("Deine Wahl: "+choice);
if (Alexa.getSupportedInterfaces(handlerInput.requestEnvelope)['Alexa.Presentation.APL']) {
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
document: launchDocument,
token: 'jip'
});
var urlToGo="";
switch(choice){
case "gaswarner":
urlToGo="https://www.url1.com";
break;
case "temperatur":
urlToGo="https://www.url2.com"
break;
}
handlerInput.responseBuilder.addDirective({
type: "Alexa.Presentation.APL.ExecuteCommands",
token: 'jip',
commands: [{
type: "OpenURL",
source: urlToGo
}]
});
}
return handlerInput.responseBuilder
.speak(speakOutput)
.getResponse();
}
};有两件重要的事情要提到:
发布于 2021-01-02 07:27:09
不确定这是否是您想要的,但您可以生成SVG图形并使用APL VectorGraphic原语呈现这些图形。
您必须构建一个定制技能,当调用它时,可以为您的指标提取数据,并生成呈现图形的APL。
或者,如果您有一个不同的服务器端呈现API的度量,可以栅格化,您可以产生一个PNG和渲染的回声显示。
https://stackoverflow.com/questions/65517934
复制相似问题