[ { "id": "3b56a5f0.bcff3a", "type": "tab", "label": "STATISTICS", "disabled": false, "info": "" }, { "id": "1aead98e.c48566", "type": "group", "z": "3b56a5f0.bcff3a", "name": "VOICE USAGE STATISTICS", "style": { "label": true }, "nodes": [ "348cbcd9.2d5014", "4673cb18.38576c", "704ed56f.d49ed4", "cee29dee.994f88", "c6a28cf7.118688", "b1875e2e.cc368", "4e6a1d8d.74ee24", "a4d323f7.58f5c", "9dc7701b.21eef8", "ff993fa5.373c28", "56d649e1.75a8e", "8406fb88.6b5838", "1c0bc99f.064e66", "4e9e488f.0548c8", "c3756a7a.4e5fe", "af369de7.93071", "2e724757.61f9b", "54f913f9.943ccc", "62b80250.a48fac", "f8b6fe7.a8ff48", "835d91ee.a45b3", "a2dbce0e.de89a", "135c7e25.207c9a", "945d1b61.8a8a88", "b1da8868.989248", "cd643354.88572", "510222b7.b86a34", "38932c47.52cd94" ], "x": 94, "y": 29, "w": 382, "h": 772 }, { "id": "704ed56f.d49ed4", "type": "mqtt in", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "All intents", "topic": "hermes/intent/+", "qos": "2", "datatype": "auto", "broker": "cacf8967.042428", "x": 180, "y": 480, "wires": [ [ "c6a28cf7.118688" ] ] }, { "id": "cee29dee.994f88", "type": "debug", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 415, "y": 550, "wires": [], "l": false }, { "id": "c6a28cf7.118688", "type": "json", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "property": "payload", "action": "", "pretty": false, "x": 295, "y": 480, "wires": [ [ "4e6a1d8d.74ee24" ] ], "l": false }, { "id": "b1875e2e.cc368", "type": "comment", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "Listen to all mqtt msgs ", "info": "", "x": 230, "y": 440, "wires": [] }, { "id": "4e6a1d8d.74ee24", "type": "function", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "func": "var msgStat = {\n voiceCommands: [], intent: []\n};\n\nif(msg.payload.input === undefined){\n return null;\n}\n\nvar executed = false;\n\nif(msg.payload.intent.confidenceScore > 0.6){\n executed = true;\n}\n\nmsgStat.voiceCommands.push({\"value\": msg.payload.input,\n \"siteId\": msg.payload.siteId,\n \"intentDetected\": msg.payload.intent.intentName,\n \"executed\": executed,\n \"counter\": 1 \n});\n\nif(executed == true){\n msgStat.intent.push({\"intentName\": msg.payload.intent.intentName,\n \"siteId\": msg.payload.siteId,\n \"counter\" : 1\n \n });\n}else{\n msgStat.intent.push({\"intentName\": msg.payload.intent.intentName,\n \"siteId\": msg.payload.siteId,\n \"counter\" : 0\n \n });\n \n}\n\nif(msg.payload.asrTokens!==undefined) {\n for(var i=0; i /etc/logrotate.d/logrotate-statistics'", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "logrotate", "x": 275, "y": 370, "wires": [ [], [], [] ], "l": false }, { "id": "c3756a7a.4e5fe", "type": "inject", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "props": [], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payloadType": "str", "x": 195, "y": 370, "wires": [ [ "4e9e488f.0548c8" ] ], "l": false }, { "id": "af369de7.93071", "type": "inject", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": "3", "topic": "", "payload": "{\"voiceCommands\":[],\"intent\":[],\"unknownword\":0,\"counter\":0}", "payloadType": "json", "x": 195, "y": 155, "wires": [ [ "8406fb88.6b5838" ] ], "l": false }, { "id": "2e724757.61f9b", "type": "comment", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "README - compress the file", "info": "Inject to compress file in an interval time\nNote that this is maybe not what you want ! The file will will no longer be presented in the user interface.\nNOT RECOMMENDED UNLESS YOU UNDERSTAND WHAT YOUR DOING.", "x": 250, "y": 320, "wires": [] }, { "id": "54f913f9.943ccc", "type": "http in", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "url": "/statistics", "method": "get", "upload": false, "swaggerDoc": "", "x": 135, "y": 675, "wires": [ [ "62b80250.a48fac" ] ], "l": false }, { "id": "62b80250.a48fac", "type": "file in", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "in-download", "filename": "statistics", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "x": 215, "y": 675, "wires": [ [ "f8b6fe7.a8ff48" ] ], "l": false }, { "id": "f8b6fe7.a8ff48", "type": "http response", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "statusCode": "", "headers": {}, "x": 295, "y": 675, "wires": [], "l": false }, { "id": "835d91ee.a45b3", "type": "comment", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "Download the file here", "info": "Go to user interface to see/download statistics file\n\n -> http://localhost:1880/ui ", "x": 220, "y": 635, "wires": [] }, { "id": "a2dbce0e.de89a", "type": "ui_template", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "group": "f78aec18.baff9", "name": "Statistics", "order": 1, "width": "0", "height": "0", "format": "\n\n
\n\n\n
\n Download statistics file\n
\n", "storeOutMessages": true, "fwdInMessages": true, "resendOnRefresh": true, "templateScope": "local", "x": 435, "y": 720, "wires": [ [] ], "l": false }, { "id": "135c7e25.207c9a", "type": "file in", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "in-watch", "filename": "statistics", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "x": 215, "y": 720, "wires": [ [ "945d1b61.8a8a88" ] ], "l": false }, { "id": "945d1b61.8a8a88", "type": "json", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "property": "payload", "action": "", "pretty": false, "x": 295, "y": 720, "wires": [ [ "b1da8868.989248" ] ], "l": false }, { "id": "b1da8868.989248", "type": "template", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "\n\n \n \n

Voice Commands\n \n \n {{#payload.voiceCommands}}\n \n {{/payload.voiceCommands}}\n \n
ValueSite IdExecutedIntent detectedCounter
{{value}}{{siteId}}{{executed}}{{intentDetected}}{{counter}}
\n

\n
\n

Intent\n \n \n {{#payload.intent}}\n \n {{/payload.intent}}\n \n
Intent NameSite IdCounter
{{intentName}}{{siteId}}{{counter}}
\n

\n
\n

Unknownword : {{payload.unknownword}}

\n
\n \n\n", "output": "str", "x": 355, "y": 720, "wires": [ [ "a2dbce0e.de89a" ] ], "l": false }, { "id": "cd643354.88572", "type": "watch", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "files": "statistics", "recursive": "", "x": 135, "y": 720, "wires": [ [ "135c7e25.207c9a" ] ], "l": false }, { "id": "510222b7.b86a34", "type": "ui_ui_control", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "events": "all", "x": 135, "y": 760, "wires": [ [ "135c7e25.207c9a" ] ], "l": false }, { "id": "38932c47.52cd94", "type": "comment", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "Version info", "info": "2021-10-19: More Fixes..\n2021-10-16: Fix Handle empty file\n2021-07-07: create the statistics file if it doesn't exist, re-create it if it is corrupt. Warning text in compress flow\n2021-06-21: Bug fix SuperScenes exception when asrTokens not defined\n", "x": 370, "y": 70, "wires": [] }, { "id": "348cbcd9.2d5014", "type": "catch", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "scope": [ "9dc7701b.21eef8" ], "uncaught": false, "x": 175, "y": 590, "wires": [ [ "4673cb18.38576c" ] ], "l": false }, { "id": "4673cb18.38576c", "type": "change", "z": "3b56a5f0.bcff3a", "g": "1aead98e.c48566", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 235, "y": 590, "wires": [ [ "56d649e1.75a8e" ] ], "l": false }, { "id": "cacf8967.042428", "type": "mqtt-broker", "name": "", "broker": "localhost", "port": "1883", "clientid": "", "usetls": false, "compatmode": true, "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "closeTopic": "", "closeQos": "0", "closePayload": "", "willTopic": "", "willQos": "0", "willPayload": "" }, { "id": "f78aec18.baff9", "type": "ui_group", "name": "Voice Usage Statistics", "tab": "927524aa.91d278", "order": 1, "disp": true, "width": "17", "collapse": false }, { "id": "927524aa.91d278", "type": "ui_tab", "name": "STATISTICS", "icon": "dashboard", "order": 1, "disabled": false, "hidden": false } ]