This is a flow to show how the node-red-contrib-dmxusbpro node can be used. It uses dashboard sliders to set DMX values, stores presets in a mongodb collection, and recalls the presets which can control DMX hardware using the Enntec dmx usb pro. You will need to set the serialport port-name in node-red-contrib-dmxusbpro node. You also set the DMX starting address in the node-red-contrib-dmxusbpro node. Adapted and simplified from node-dmx package https://www.npmjs.com/package/dmx requires node-serialport module.
-
-
Save blechdom/ee7539d6d6734806a9f5825efd991cf9 to your computer and use it in GitHub Desktop.
DMX Presets with MongoDB2 and DMXUSBPRO node
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":"f4712c5.f832cd","type":"dmxusbpro","z":"5d352559.e549fc","name":"","port":"COM4","DMX_starting_address":"1","x":1811.5,"y":469,"wires":[[]]},{"id":"fcf929df.7d1858","type":"ui_button","z":"5d352559.e549fc","name":"Save Community Storytelling Preset","group":"69708049.f2d","order":1,"width":0,"height":0,"passthru":false,"label":"Save Community Storytelling Preset","color":"#FFFFFF","bgcolor":"#FF0000","icon":"fa-circle","payload":"Community Storytelling","payloadType":"str","topic":"Community Storytelling","x":160,"y":268,"wires":[["8d3463cd.c787b"]]},{"id":"4c6a1c62.2c2284","type":"ui_button","z":"5d352559.e549fc","name":"Load Community Storytelling Preset","group":"d9f281b5.b72ef","order":1,"width":0,"height":0,"passthru":false,"label":"Load Community Storytelling Preset","color":"#FFF","bgcolor":"#33CC00","icon":"fa-play","payload":"Community Storytelling","payloadType":"str","topic":"Community Storytelling","x":166,"y":22,"wires":[["c8260730.a9cd88"]]},{"id":"ffcf7265.94e24","type":"ui_button","z":"5d352559.e549fc","name":"Load Talk of the Town Preset","group":"d9f281b5.b72ef","order":2,"width":0,"height":0,"passthru":false,"label":"Load Talk of the Town Preset","color":"#FFF","bgcolor":"#33CC00","icon":"fa-play","payload":"Talk of the Town","payloadType":"str","topic":"Talk of the Town","x":136,"y":94,"wires":[["c8260730.a9cd88"]]},{"id":"cb919dcf.63aeb","type":"ui_button","z":"5d352559.e549fc","name":"Load Jazz Tonight Preset","group":"d9f281b5.b72ef","order":3,"width":0,"height":0,"passthru":false,"label":"Load Jazz Tonight Preset","color":"#FFF","bgcolor":"#33CC00","icon":"fa-play","payload":"Jazz Tonight","payloadType":"str","topic":"Jazz Tonight","x":118,"y":161,"wires":[["c8260730.a9cd88"]]},{"id":"3f70f4eb.e83a6c","type":"ui_slider","z":"5d352559.e549fc","name":"DMX2","label":"DMX 2","group":"2dbdcf8a.020f","order":2,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1106,"y":344,"wires":[["c3a5ef4d.46e88","3a07bede.a1ee32"]]},{"id":"c42cf28.270991","type":"ui_slider","z":"5d352559.e549fc","name":"DMX12","label":"DMX 12","group":"2dbdcf8a.020f","order":12,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1109,"y":710,"wires":[["666ad6ab.261188","3a07bede.a1ee32"]]},{"id":"153bee85.54c781","type":"ui_slider","z":"5d352559.e549fc","name":"DMX11","label":"DMX 11","group":"2dbdcf8a.020f","order":11,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1110,"y":673,"wires":[["311937c3.1041b8","3a07bede.a1ee32"]]},{"id":"449bdd50.1a3a04","type":"ui_slider","z":"5d352559.e549fc","name":"DMX10","label":"DMX 10","group":"2dbdcf8a.020f","order":10,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1109,"y":637,"wires":[["759227ef.bb90b8","3a07bede.a1ee32"]]},{"id":"1653d524.1119db","type":"ui_slider","z":"5d352559.e549fc","name":"DMX9","label":"DMX 9","group":"2dbdcf8a.020f","order":9,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1101,"y":600,"wires":[["65eb407e.20052","3a07bede.a1ee32"]]},{"id":"5ed0ee8d.57d3c","type":"ui_slider","z":"5d352559.e549fc","name":"DMX8","label":"DMX 8","group":"2dbdcf8a.020f","order":8,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1101,"y":564,"wires":[["c1adc102.c986e","3a07bede.a1ee32"]]},{"id":"3a2df3a2.8862fc","type":"ui_slider","z":"5d352559.e549fc","name":"DMX7","label":"DMX 7","group":"2dbdcf8a.020f","order":7,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1100,"y":527,"wires":[["a514c801.b9bf18","3a07bede.a1ee32"]]},{"id":"b97f153a.cc0cf8","type":"ui_slider","z":"5d352559.e549fc","name":"DMX6","label":"DMX 6","group":"2dbdcf8a.020f","order":6,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1101,"y":492,"wires":[["652a8d2e.3f9b14","3a07bede.a1ee32"]]},{"id":"ca2e1048.475ac","type":"ui_slider","z":"5d352559.e549fc","name":"DMX5","label":"DMX 5","group":"2dbdcf8a.020f","order":5,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1102,"y":455,"wires":[["c733c751.272098","3a07bede.a1ee32"]]},{"id":"22257e0.1962882","type":"ui_slider","z":"5d352559.e549fc","name":"DMX4","label":"DMX 4","group":"2dbdcf8a.020f","order":4,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1103,"y":419,"wires":[["c7797a5c.b9d308","3a07bede.a1ee32"]]},{"id":"b514390c.5c5a38","type":"ui_slider","z":"5d352559.e549fc","name":"DMX3","label":"DMX 3","group":"2dbdcf8a.020f","order":3,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1104,"y":381,"wires":[["56f449c5.99de78","3a07bede.a1ee32"]]},{"id":"bd01ac6.0119a5","type":"change","z":"5d352559.e549fc","name":"save to Global DMX1","rules":[{"t":"set","p":"dmx_preset[0]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1312,"y":302,"wires":[[]]},{"id":"c3a5ef4d.46e88","type":"change","z":"5d352559.e549fc","name":"save to Global DMX2","rules":[{"t":"set","p":"dmx_preset[1]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1308,"y":344,"wires":[[]]},{"id":"56f449c5.99de78","type":"change","z":"5d352559.e549fc","name":"save to Global DMX3","rules":[{"t":"set","p":"dmx_preset[2]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1306,"y":382,"wires":[[]]},{"id":"c7797a5c.b9d308","type":"change","z":"5d352559.e549fc","name":"save to Global DMX4","rules":[{"t":"set","p":"dmx_preset[3]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1306,"y":419,"wires":[[]]},{"id":"c733c751.272098","type":"change","z":"5d352559.e549fc","name":"save to Global DMX5","rules":[{"t":"set","p":"dmx_preset[4]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1304,"y":457,"wires":[[]]},{"id":"652a8d2e.3f9b14","type":"change","z":"5d352559.e549fc","name":"save to Global DMX6","rules":[{"t":"set","p":"dmx_preset[5]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1305,"y":495,"wires":[[]]},{"id":"a514c801.b9bf18","type":"change","z":"5d352559.e549fc","name":"save to Global DMX7","rules":[{"t":"set","p":"dmx_preset[6]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1303,"y":533,"wires":[[]]},{"id":"c1adc102.c986e","type":"change","z":"5d352559.e549fc","name":"save to Global DMX8","rules":[{"t":"set","p":"dmx_preset[7]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1302,"y":569,"wires":[[]]},{"id":"65eb407e.20052","type":"change","z":"5d352559.e549fc","name":"save to Global DMX9","rules":[{"t":"set","p":"dmx_preset[8]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1302,"y":606,"wires":[[]]},{"id":"759227ef.bb90b8","type":"change","z":"5d352559.e549fc","name":"save to Global DMX10","rules":[{"t":"set","p":"dmx_preset[9]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1300,"y":644,"wires":[[]]},{"id":"311937c3.1041b8","type":"change","z":"5d352559.e549fc","name":"save to Global DMX11","rules":[{"t":"set","p":"dmx_preset[10]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1303,"y":682,"wires":[[]]},{"id":"666ad6ab.261188","type":"change","z":"5d352559.e549fc","name":"save to Global DMX12","rules":[{"t":"set","p":"dmx_preset[11]","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1299,"y":720,"wires":[[]]},{"id":"dd6a6531.c919a8","type":"ui_button","z":"5d352559.e549fc","name":"Save Talk of the Town Preset","group":"69708049.f2d","order":2,"width":0,"height":0,"passthru":false,"label":"Save Talk of the Town Preset","color":"#FFFFFF","bgcolor":"#FF0000","icon":"fa-circle","payload":"Talk of the Town","payloadType":"str","topic":"Talk of the Town","x":129,"y":343,"wires":[["8d3463cd.c787b"]]},{"id":"e7aaeae5.825688","type":"ui_button","z":"5d352559.e549fc","name":"Save Jazz Tonight Preset","group":"69708049.f2d","order":3,"width":0,"height":0,"passthru":false,"label":"Save Jazz Tonight Preset","color":"#FFFFFF","bgcolor":"#FF0000","icon":"fa-circle","payload":"Jazz Tonight","payloadType":"str","topic":"Jazz Tonight","x":118,"y":425,"wires":[["8d3463cd.c787b"]]},{"id":"c8260730.a9cd88","type":"function","z":"5d352559.e549fc","name":"findOne","func":"var newMsg = {};\nnewMsg.operation = 'findOne';\nnewMsg.payload = { 'topic' : msg.payload};\nreturn newMsg;","outputs":1,"noerr":0,"x":444,"y":77,"wires":[["3332517e.41576e"]]},{"id":"9a19e3b8.d9c8b","type":"function","z":"5d352559.e549fc","name":"Just get preset","func":"global.set(\"dmx_preset\", msg.payload.payload);\n\nvar preset = [];\nvar m = [];\npreset = global.get(\"dmx_preset\");\n\n\nfor (var i=0;i<12;i++)\n{\n m[i] = { payload: preset[i] };\n}\nreturn m;\n","outputs":12,"noerr":0,"x":858,"y":372,"wires":[["cdfcdafa.9edcb8"],["3f70f4eb.e83a6c"],["b514390c.5c5a38"],["22257e0.1962882"],["ca2e1048.475ac"],["b97f153a.cc0cf8"],["3a2df3a2.8862fc"],["5ed0ee8d.57d3c"],["1653d524.1119db"],["449bdd50.1a3a04"],["153bee85.54c781"],["c42cf28.270991"]]},{"id":"3332517e.41576e","type":"mongodb2 in","z":"5d352559.e549fc","service":"_ext_","configNode":"4c81c817.220fe8","name":"Mongo DB dynamic operation","collection":"dmx_presets","operation":"","x":664,"y":80,"wires":[["9a19e3b8.d9c8b"]]},{"id":"8d3463cd.c787b","type":"function","z":"5d352559.e549fc","name":"insert preset","func":"var preset = [];\npreset = global.get(\"dmx_preset\");\nvar newMsg = {};\nnewMsg.collection = 'dmx_presets';\nnewMsg.payload = [\n {topic: msg.payload},\n {\n \"$set\": {\n \"payload\": preset\n }\n },\n {upsert:true}\n];\n\nreturn newMsg;\n","outputs":1,"noerr":0,"x":395,"y":375,"wires":[["2d74d2a7.e2bc8e","f4af08a1.7a1cb8"]]},{"id":"2d74d2a7.e2bc8e","type":"mongodb2 in","z":"5d352559.e549fc","service":"_ext_","configNode":"4c81c817.220fe8","name":"Store Data into MongoDB","collection":"dmx_presets","operation":"findOneAndUpdate","x":605,"y":375,"wires":[[]]},{"id":"f4af08a1.7a1cb8","type":"debug","z":"5d352559.e549fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":561,"y":331.5,"wires":[]},{"id":"5861e30f.78ea1c","type":"function","z":"5d352559.e549fc","name":"init global variables","func":"global.set(\"dmx_preset\",[0,0,0,0,0,0,0,0,0,0,0,0]); \nmsg.payload = global.get(\"dmx_preset\");\nreturn msg;","outputs":1,"noerr":0,"x":438,"y":533,"wires":[["aa9ddd8f.5b538","21353d0e.6fb2b2"]]},{"id":"b8470a9c.a6c768","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":93,"y":544.5,"wires":[["5861e30f.78ea1c"]]},{"id":"aa9ddd8f.5b538","type":"debug","z":"5d352559.e549fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":624,"y":532,"wires":[]},{"id":"1a05e05c.f1abc","type":"debug","z":"5d352559.e549fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":629,"y":574,"wires":[]},{"id":"647a04ec.a5540c","type":"function","z":"5d352559.e549fc","name":"check global preset","func":"msg.payload = global.get(\"dmx_preset\");\nreturn msg;","outputs":1,"noerr":0,"x":445,"y":571,"wires":[["1a05e05c.f1abc","21353d0e.6fb2b2"]]},{"id":"fa144b9e.ab2968","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":254,"y":570.5,"wires":[["647a04ec.a5540c"]]},{"id":"21353d0e.6fb2b2","type":"function","z":"5d352559.e549fc","name":"Reset from global","func":"var preset = [];\nvar m = [];\npreset = global.get(\"dmx_preset\");\n\n\nfor (var i=0;i<12;i++)\n{\n m[i] = { payload: preset[i] };\n}\nreturn m;\n","outputs":12,"noerr":0,"x":871.5,"y":584,"wires":[["cdfcdafa.9edcb8"],["3f70f4eb.e83a6c"],["b514390c.5c5a38"],["22257e0.1962882"],["ca2e1048.475ac"],["b97f153a.cc0cf8"],["3a2df3a2.8862fc"],["5ed0ee8d.57d3c"],["1653d524.1119db"],["449bdd50.1a3a04"],["153bee85.54c781"],["c42cf28.270991"]]},{"id":"3a07bede.a1ee32","type":"function","z":"5d352559.e549fc","name":"Send Current Universe","func":"msg.payload = global.get(\"dmx_preset\");\nreturn msg;","outputs":1,"noerr":0,"x":1592,"y":508,"wires":[["62ebe944.b5faa8","f4712c5.f832cd"]]},{"id":"62ebe944.b5faa8","type":"debug","z":"5d352559.e549fc","name":"Current Preset","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1819,"y":532,"wires":[]},{"id":"5c1e2597.f4383c","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"Community Storytelling","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":59,"wires":[["c8260730.a9cd88"]]},{"id":"272779e2.d89f66","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"Talk of the Town","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":114,"y":127,"wires":[["c8260730.a9cd88"]]},{"id":"960b9b6f.db9038","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"Jazz Tonight","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":109,"y":197,"wires":[["c8260730.a9cd88"]]},{"id":"b9d00eb5.9a741","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"Talk of the Town","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":118,"y":380,"wires":[["8d3463cd.c787b"]]},{"id":"8050a653.72bcb8","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"Community Storytelling","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":132,"y":302,"wires":[["8d3463cd.c787b"]]},{"id":"6b9fc39a.8218ac","type":"inject","z":"5d352559.e549fc","name":"","topic":"","payload":"Jazz Tonight","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":102,"y":459,"wires":[["8d3463cd.c787b"]]},{"id":"cdfcdafa.9edcb8","type":"ui_slider","z":"5d352559.e549fc","name":"DMX1","label":"DMX 1","group":"2dbdcf8a.020f","order":1,"width":0,"height":0,"passthru":true,"topic":"Slider","min":0,"max":"255","step":1,"x":1105,"y":306,"wires":[["bd01ac6.0119a5","3a07bede.a1ee32"]]},{"id":"54fafb60.233924","type":"ui_button","z":"5d352559.e549fc","name":"Black Out","group":"d9f281b5.b72ef","order":4,"width":0,"height":0,"passthru":false,"label":"Black Out","color":"#FFFFFF","bgcolor":"#000000","icon":"fa-circle","payload":"BlackOut","payloadType":"str","topic":"Black Out","x":75,"y":505,"wires":[["5861e30f.78ea1c"]]},{"id":"69708049.f2d","type":"ui_group","z":"","name":"RECORD PRESETS","tab":"bef78144.cc0c2","order":2,"disp":true,"width":"6","collapse":true},{"id":"d9f281b5.b72ef","type":"ui_group","z":"","name":"RECALL PRESETS","tab":"bef78144.cc0c2","order":1,"disp":true,"width":"6","collapse":true},{"id":"2dbdcf8a.020f","type":"ui_group","z":"","name":"DMX SLIDERS","tab":"bef78144.cc0c2","order":3,"disp":true,"width":"8","collapse":true},{"id":"4c81c817.220fe8","type":"mongodb2","z":"","uri":"mongodb://127.0.0.1:27017/cinebrain","name":"cinebrain db","options":"","parallelism":"-1"},{"id":"bef78144.cc0c2","type":"ui_tab","z":"","name":"KCAT DMX DASHBOARD","icon":"home","order":2}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment