Created
April 27, 2020 08:05
-
-
Save koenvervloesem/b76bbdbc2cd77c35760c145c2f710f25 to your computer and use it in GitHub Desktop.
Node-RED flow to handle Rhasspy's GetTime intent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id":"6b7fb8b9.b3454", | |
"type":"tab", | |
"label":"Rhasspy", | |
"disabled":false, | |
"info":"" | |
}, | |
{ | |
"id":"537746bb.79e17", | |
"type":"websocket in", | |
"z":"6b7fb8b9.b3454", | |
"name":"Get intent from Rhasspy", | |
"server":"5ad4ffd4.05a5d", | |
"client":"", | |
"x":150, | |
"y":140, | |
"wires":[ | |
[ | |
"d0424b81.9a765", | |
"4483cf7f.5107" | |
] | |
] | |
}, | |
{ | |
"id":"d0424b81.9a765", | |
"type":"debug", | |
"z":"6b7fb8b9.b3454", | |
"name":"", | |
"active":true, | |
"tosidebar":true, | |
"console":false, | |
"tostatus":false, | |
"complete":"true", | |
"targetType":"full", | |
"x":430, | |
"y":140, | |
"wires":[ | |
] | |
}, | |
{ | |
"id":"4483cf7f.5107", | |
"type":"switch", | |
"z":"6b7fb8b9.b3454", | |
"name":"Which intent?", | |
"property":"intent.name", | |
"propertyType":"msg", | |
"rules":[ | |
{ | |
"t":"eq", | |
"v":"", | |
"vt":"str" | |
}, | |
{ | |
"t":"eq", | |
"v":"GetTime", | |
"vt":"str" | |
} | |
], | |
"checkall":"true", | |
"repair":false, | |
"outputs":2, | |
"x":460, | |
"y":280, | |
"wires":[ | |
[ | |
"f306e9e7.a7df8" | |
], | |
[ | |
"4a750c16.d61b8c" | |
] | |
] | |
}, | |
{ | |
"id":"f306e9e7.a7df8", | |
"type":"change", | |
"z":"6b7fb8b9.b3454", | |
"name":"Intent not recognized", | |
"rules":[ | |
{ | |
"t":"set", | |
"p":"payload", | |
"pt":"msg", | |
"to":"What did you say?", | |
"tot":"str" | |
} | |
], | |
"action":"", | |
"property":"", | |
"from":"", | |
"to":"", | |
"reg":false, | |
"x":740, | |
"y":220, | |
"wires":[ | |
[ | |
"500c313e.3ca7e" | |
] | |
] | |
}, | |
{ | |
"id":"500c313e.3ca7e", | |
"type":"http request", | |
"z":"6b7fb8b9.b3454", | |
"name":"Text-to-speech", | |
"method":"POST", | |
"ret":"txt", | |
"paytoqs":false, | |
"url":"http://rhasspy:12101/api/text-to-speech", | |
"tls":"", | |
"persist":false, | |
"proxy":"", | |
"authType":"", | |
"x":1040, | |
"y":280, | |
"wires":[ | |
[ | |
] | |
] | |
}, | |
{ | |
"id":"4a750c16.d61b8c", | |
"type":"function", | |
"z":"6b7fb8b9.b3454", | |
"name":"GetTime", | |
"func":"var timeString = new Date().toLocaleTimeString([],\n{\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false\n})\n\nreturn {\n payload: \"It's \" + timeString.replace(\":\", \" \")\n}", | |
"outputs":1, | |
"noerr":0, | |
"x":700, | |
"y":320, | |
"wires":[ | |
[ | |
"500c313e.3ca7e" | |
] | |
] | |
}, | |
{ | |
"id":"5ad4ffd4.05a5d", | |
"type":"websocket-listener", | |
"z":"", | |
"path":"ws://rhasspy:12101/api/events/intent", | |
"wholemsg":"true" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment