Dialogic Systems GmbH & Co. KG

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleplay Soundfile
[{"id":"b1c625f2403bc611","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"0515ee65edcc16bc","type":"knxUltimate","z":"b1c625f2403bc611","server":"27611a104f249f78","topic":"5/0/1","outputtopic":"","dpt":"5.001","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"Volume 5/0/1","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":150,"y":80,"wires":[["2a13c1ddebbc3566"]]},{"id":"dd55ade03233be28","type":"knxUltimate","z":"b1c625f2403bc611","server":"27611a104f249f78","topic":"5/0/2","outputtopic":"","dpt":"5.010","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"SoundFile 1 - X (0 = Stop) 5/0/2","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":210,"y":140,"wires":[["9398b11d98a7dc0d"]]},{"id":"9398b11d98a7dc0d","type":"function","z":"b1c625f2403bc611","name":"Set pattern","func":"msg.payload = msg.payload + \"_*.*\";\nmsg.path = \"c:/audio2/\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":140,"wires":[["e8ceb930a6e6f8e0","535c2b0a1fbaee2a"]]},{"id":"2a13c1ddebbc3566","type":"audio","z":"b1c625f2403bc611","topic":"","command":"setVolume","path":"","playTime":0,"volume":0,"blockEvent":true,"muteAnotherApps":false,"name":"Volume","x":1060,"y":80,"wires":[["3c92f6707b2b36a7"]]},{"id":"c559abbd6621be04","type":"function","z":"b1c625f2403bc611","d":true,"name":"File Auswahl ","func":"switch (msg.payload) {\n    case 0: msg.payload = \"stop\"; break;\n    case 1: msg.payload = \"play:c:/audio/alarm.mp3\"; break;\n    case 2: msg.payload = \"play:c:/audio/Dreiklang.wav\"; break;\n    case 3: msg.payload = \"play:c:/audio/gartentor.wav\"; break;\n    case 4: msg.payload = \"play:c:/audio/haustuere.wav\"; break;\n    case 5: msg.payload = \"play:c:/audio/InternAlarm.wav\"; break;  \n    case 6: msg.payload = \"play:c:/audio/InternAlarm.wav\"; break;  \n    case 7: msg.payload = \"play:c:/audio/InternAlarm.wav\"; break;  \n    case 8: msg.payload = \"play:c:/audio/InternAlarm.wav\"; break;  \n    case 9: msg.payload = \"play:c:/audio/InternAlarm.wav\"; break;  \n    case 10: msg.payload = \"play:c:/audio/InternAlarm.wav\"; break;   \n    default:     \n} \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":280,"wires":[[]]},{"id":"68afaf5e81f031ec","type":"function","z":"b1c625f2403bc611","name":"Set sound File","func":"if (msg.list.length === 0) {\n    msg.payload = \"stop\";\n    return msg;\n};\n\nmsg.payload = \"play:\" + msg.path + msg.list[0]; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":140,"wires":[["f066ead112803729","f45295d16205816a"]]},{"id":"3c92f6707b2b36a7","type":"debug","z":"b1c625f2403bc611","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1260,"y":100,"wires":[]},{"id":"f066ead112803729","type":"audio","z":"b1c625f2403bc611","topic":"","command":"cmdInput","path":"","playTime":0,"volume":0,"blockEvent":true,"muteAnotherApps":false,"name":"über Input","x":1060,"y":140,"wires":[["3c92f6707b2b36a7"]]},{"id":"f45295d16205816a","type":"debug","z":"b1c625f2403bc611","name":"debug 8","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":180,"wires":[]},{"id":"e8ceb930a6e6f8e0","type":"debug","z":"b1c625f2403bc611","name":"debug 10","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":180,"wires":[]},{"id":"535c2b0a1fbaee2a","type":"fs-list","z":"b1c625f2403bc611","name":"","path":"path","pathType":"msg","pattern":"payload","patternType":"msg","filter":"files","recursive":false,"follow":false,"property":"list","propertyType":"msg","x":680,"y":140,"wires":[["68afaf5e81f031ec"]]},{"id":"27611a104f249f78","type":"knxUltimate-config","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","hostProtocol":"Multicast","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","stopETSImportIfNoDatapoint":"stop","loglevel":"error","name":"KNX Gateway","localEchoInTunneling":true,"delaybetweentelegrams":"50","delaybetweentelegramsfurtherdelayREAD":"1","ignoreTelegramsWithRepeatedFlag":false,"autoReconnect":true}]


Image Added


node-red-contrib-filesystem wird hier nicht benötigt

Code Block
languagejs
titleplay Soundfile (ab nodeRed 3.0)
[{"id":"0515ee65edcc16bc","type":"knxUltimate","z":"b1c625f2403bc611","server":"27611a104f249f78","topic":"5/0/1","outputtopic":"","dpt":"5.001","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"Volume 5/0/1","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":150,"y":80,"wires":[["2a13c1ddebbc3566"]]},{"id":"2a13c1ddebbc3566","type":"audio","z":"b1c625f2403bc611","topic":"","command":"setVolume","path":"","playTime":0,"volume":0,"blockEvent":true,"muteAnotherApps":false,"name":"Volume","x":640,"y":80,"wires":[["3c92f6707b2b36a7"]]},{"id":"3c92f6707b2b36a7","type":"debug","z":"b1c625f2403bc611","name":"debug 7","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":140,"wires":[]},{"id":"b91a3693f9e64f3c","type":"function","z":"b1c625f2403bc611","name":"Set pattern","func":"const directoryPath = 'c:/audio2/'; // Ersetzen Sie dies durch den Pfad zu Ihrem Verzeichnis\nconst cmd = msg.payload\n\nfs.readdir(directoryPath, (err, files) => {\n if (err) {\n node.error('Fehler beim Lesen des Verzeichnisses:', err);\n return;\n }\n\n // Filtert Dateien, die mit einer ein- oder zweistelligen Zahl beginnen\n const filteredFiles = files.filter(filename => new RegExp(`^${cmd}_`).test(filename));\n\n if (filteredFiles.length > 0) {\n // Erstellt den vollständigen Pfad für die gefilterten Dateien\n const filePaths = filteredFiles.map(filename => path.join(directoryPath, filename));\n\n msg.payload = \"play:\" + filePaths[0];\n node.send(msg);\n return;\n }\n msg.payload = \"stop\";\n node.send(msg);\n});","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"fs","module":"fs"},{"var":"path","module":"path"}],"x":470,"y":140,"wires":[["136409c862978c22"]]},{"id":"2fd91e9d0a3e4bb3","type":"knxUltimate","z":"b1c625f2403bc611","server":"27611a104f249f78","topic":"5/0/2","outputtopic":"","dpt":"5.010","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"SoundFile 1 - X (0 = Stop) 5/0/2","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":210,"y":140,"wires":[["b91a3693f9e64f3c"]]},{"id":"136409c862978c22","type":"audio","z":"b1c625f2403bc611","topic":"","command":"cmdInput","path":"","playTime":0,"volume":0,"blockEvent":true,"muteAnotherApps":false,"name":"über Input","x":640,"y":140,"wires":[["3c92f6707b2b36a7"]]},{"id":"27611a104f249f78","type":"knxUltimate-config","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","hostProtocol":"Multicast","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","stopETSImportIfNoDatapoint":"stop","loglevel":"error","name":"KNX Gateway","localEchoInTunneling":true,"delaybetweentelegrams":"50","delaybetweentelegramsfurtherdelayREAD":"1","ignoreTelegramsWithRepeatedFlag":false,"autoReconnect":true}]