Where can I find (or enable) an "interactive" console in node-red?

You could achieve this with a simple pre & code block. You can even have syntax highlighting and a MAX LENGTH buffer for scroll back.

example...

xSa2xxlzm7

Demo flow...

[{"id":"ca8f65c0.635a58","type":"ui_template","z":"553814a2.1248ec","group":"6d01ec93.b1d374","name":"","order":7,"width":"12","height":"8","format":"\n<!--<pre><code id=\"shell\" class=\"language-bash bash\" ng-bind=\"msg.payload\"></code></pre>-->\n<pre><code id=\"shell\" class=\"language-bash bash\"></code></pre>\n\n<script>\n    $(document).ready(function() {\n      $('#shell').each(function(i, e) {hljs.highlightElement(e)});\n    }); \n</script>\n\n\n<script>\n(function(scope) {\n  scope.$watch('msg', function(msg) {\n    if (msg) {\n        debugger\n      $(\"#shell\").text(msg.payload);\n      $('#shell').each(function(i, e) {hljs.highlightElement(e)});\n      //$(\"#shell\").scrollTop(function() { return this.scrollHeight; });\n      $(\"#shell\").closest(\".nr-dashboard-template\").scrollTop(function() { return this.scrollHeight; });\n    }\n  });\n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":960,"y":1540,"wires":[[]]},{"id":"72d6a0f1.8fba2","type":"exec","z":"553814a2.1248ec","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":750,"y":1560,"wires":[["bad9531a.ac42d"],[],[]]},{"id":"d42cac7d.f026a","type":"ui_template","z":"553814a2.1248ec","group":"dce9e7a2.d20c78","name":"highlighter","order":7,"width":0,"height":0,"format":"<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.0.0/build/styles/default.min.css\">\n<script src=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.0.0/build/highlight.min.js\"></script>\n<!-- and it's easy to individually load additional languages -->\n<script src=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.0.0/build/languages/shell.min.js\"></script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","x":970,"y":1500,"wires":[[]]},{"id":"c0cb8d83.a207b","type":"ui_button","z":"553814a2.1248ec","name":"","group":"6d01ec93.b1d374","order":3,"width":"3","height":"1","passthru":false,"label":"time /T","tooltip":"","color":"","bgcolor":"","icon":"","payload":"time /T","payloadType":"str","topic":"topic","topicType":"msg","x":450,"y":1500,"wires":[["72d6a0f1.8fba2","bad9531a.ac42d"]]},{"id":"bad9531a.ac42d","type":"function","z":"553814a2.1248ec","name":"","func":"if(!msg.payload) return;\n\nconst MAXLINES = 200;\nlet data = context.get(\"data\") || [];\nif(msg.topic==\"clear\") {\n    data = [];\n} else {\n    const lines = msg.payload.split(\"\\n\");\n    data.push(...lines);\n    data = data.slice(-MAXLINES);\n}\ncontext.set(\"data\", data);\nmsg.payload = data.join(\"\\n\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":1500,"wires":[["ca8f65c0.635a58"]]},{"id":"9f411e65.0e5dd","type":"ui_button","z":"553814a2.1248ec","name":"","group":"6d01ec93.b1d374","order":3,"width":"3","height":"1","passthru":false,"label":"where node","tooltip":"","color":"","bgcolor":"","icon":"","payload":"where node","payloadType":"str","topic":"topic","topicType":"msg","x":470,"y":1540,"wires":[["72d6a0f1.8fba2","bad9531a.ac42d"]]},{"id":"e1e64aad.590368","type":"ui_button","z":"553814a2.1248ec","name":"","group":"6d01ec93.b1d374","order":3,"width":"3","height":"1","passthru":false,"label":"where cmd","tooltip":"","color":"","bgcolor":"","icon":"","payload":"where cmd","payloadType":"str","topic":"topic","topicType":"msg","x":470,"y":1580,"wires":[["72d6a0f1.8fba2","bad9531a.ac42d"]]},{"id":"6750853f.a3036c","type":"ui_button","z":"553814a2.1248ec","name":"","group":"6d01ec93.b1d374","order":3,"width":"3","height":"1","passthru":false,"label":"clear","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"clear","topicType":"str","x":450,"y":1620,"wires":[["bad9531a.ac42d"]]},{"id":"6d01ec93.b1d374","type":"ui_group","name":"UserEntry","tab":"5132060d.4cde48","order":2,"disp":true,"width":"12","collapse":false},{"id":"dce9e7a2.d20c78","type":"ui_group","name":"Object detection","tab":"5132060d.4cde48","order":1,"disp":true,"width":"7","collapse":false},{"id":"5132060d.4cde48","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
1 Like