-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrhasspy_handler.json
1 lines (1 loc) · 4.62 KB
/
rhasspy_handler.json
1
[{"id":"e96d11eb.e311a8","type":"tab","label":"Rhasspy handler","disabled":false,"info":""},{"id":"cc1ebca2.ab5878","type":"http in","z":"e96d11eb.e311a8","name":"Detect intent","url":"/intent","method":"post","upload":false,"swaggerDoc":"","x":90,"y":40,"wires":[["db568c20.eea688","e94c2398.e72de"]]},{"id":"db568c20.eea688","type":"debug","z":"e96d11eb.e311a8","name":"Print request","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":290,"y":40,"wires":[]},{"id":"e94c2398.e72de","type":"switch","z":"e96d11eb.e311a8","name":"Commands","property":"payload.intent.name","propertyType":"msg","rules":[{"t":"eq","v":"GetTime","vt":"str"},{"t":"eq","v":"GetTemperature","vt":"str"},{"t":"eq","v":"GetTemperatureInRoom","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":290,"y":100,"wires":[["c889fe0a.af0b58"],["e3a76523.684ce8"],["2ce230b8.bc8658"],["ecb3cb86.7fa6"]]},{"id":"ecb3cb86.7fa6","type":"template","z":"e96d11eb.e311a8","name":"Unrecognized","field":"payload","fieldType":"msg","format":"json","syntax":"plain","template":"{\n \"data\": {\n \"intent\": {\n \"name\": \"unrecognized\",\n \"confidence\": 0\n }\n },\n \"speech\": {\n \"text\": \"Kommando nicht erkannt.\"\n }\n}","output":"json","x":500,"y":260,"wires":[["15d31621.c4d1aa"]]},{"id":"15d31621.c4d1aa","type":"http response","z":"e96d11eb.e311a8","name":"Send answer","statusCode":"","headers":{"Content-Type":"application/json"},"x":1050,"y":80,"wires":[]},{"id":"ebbccd83.9781b8","type":"template","z":"e96d11eb.e311a8","name":"Intent response","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"intent\": {\n \"name\": \"GetTime\",\n \"confidence\": 0\n },\n \"speech\": {\n \"text\": \"{{ payload }}\"\n },\n \"wakeId\": \"\",\n \"siteId\": \"default\",\n \"time_sec\": 0.010800838470458984\n}","output":"json","x":660,"y":80,"wires":[["15d31621.c4d1aa"]]},{"id":"c889fe0a.af0b58","type":"function","z":"e96d11eb.e311a8","name":"Tell date/time","func":"// get current time and date\nnow = new Date();\n\n// get day, month, year\nday = now.getDate();\nmonth = now.toLocaleString('default', { month: 'long' });\nyear = now.getFullYear();\nhours = now.getHours();\nminutes = now.getMinutes();\n\n// set-up and return string\nmsg.payload = \"Heute ist der \" + day + \". \" + month + \" \" + year + \" und es ist \" + hours + \" Uhr \" + minutes + \".\";\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":80,"wires":[["ebbccd83.9781b8"]],"outputLabels":["Ausgabe"]},{"id":"e3a76523.684ce8","type":"http request","z":"e96d11eb.e311a8","name":"Weather","method":"GET","ret":"txt","paytoqs":false,"url":"https://www.metaweather.com/api/location/638242/","tls":"","persist":false,"proxy":"","authType":"","x":480,"y":140,"wires":[["91e0a666.943798"]]},{"id":"91e0a666.943798","type":"function","z":"e96d11eb.e311a8","name":"Set values","func":"var weather = msg.payload.consolidated_weather[0];\nflow.set(\"temp_outside\", Math.round(weather.the_temp));\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":140,"wires":[["b4d621f8.d63a2"]]},{"id":"b4d621f8.d63a2","type":"template","z":"e96d11eb.e311a8","name":"Intent response","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"intent\": {\n \"name\": \"GetTemperature\",\n \"confidence\": 0\n },\n \"speech\": {\n \"text\": \"Draußen ist es {{ flow.temp_outside }} Grad warm.\"\n },\n \"wakeId\": \"\",\n \"siteId\": \"default\",\n \"time_sec\": 0.010800838470458984\n}","output":"json","x":820,"y":140,"wires":[["15d31621.c4d1aa"]]},{"id":"2ce230b8.bc8658","type":"function","z":"e96d11eb.e311a8","name":"Set values","func":"// set room\nvar room = msg.payload.tokens.pop();\nflow.set(\"room\", room);\n\n// round values\nvar temperature = global.get(\"temperature\");\nvar humidity = global.get(\"humidity\");\nflow.set(\"temperature\", Math.round(temperature[room]));\nflow.set(\"humidity\", Math.round(humidity[room]));\n\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":200,"wires":[["95c68cb4.aee898"]]},{"id":"95c68cb4.aee898","type":"template","z":"e96d11eb.e311a8","name":"Intent response","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"intent\": {\n \"name\": \"GetTemperatureInRoom\",\n \"confidence\": 0\n },\n \"speech\": {\n \"text\": \"Raum {{ flow.room }} ist {{ flow.temperature }} Grad warm, die Feuchtigkeit liegt bei {{ flow.humidity }}%.\"\n },\n \"wakeId\": \"\",\n \"siteId\": \"default\",\n \"time_sec\": 0.010800838470458984\n}","output":"json","x":820,"y":200,"wires":[["15d31621.c4d1aa"]]}]