Hi Nore-red people.
I’m really excited from the possiblites node red has.
I’m trying to have node-red controlling a program called WatchOut
I’ve found a working javascript code and when I tried to migrate it to node-red I failed. The websocket is not properly connecting to the program (while the jacascript little app does).
The funny part is that if I setup a websocket server in Processing both connect and send correct messages.
My flow
[{"id":"80521cc8.7be9c","type":"debug","z":"8bf241d0.87881","name":"Controllo output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1189.88330078125,"y":427.0000305175781,"wires":[]},{"id":"4c1529d.efd3f58","type":"function","z":"8bf241d0.87881","name":"<30: HALT","func":"//recupero nome timeline\nvar timeline = flow.get(\"timeline\");\n\n//costruisco la stringa da inviare\nvar new_payload = 'halt \"' + timeline + '\"\\n';\n\n//la passo al prossimo blocchetto\nmsg.payload = new_payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":880.88330078125,"y":423.0000305175781,"wires":[["80521cc8.7be9c","ee159b60.1d8ff"]]},{"id":"269bc17b.0c26e6","type":"function","z":"8bf241d0.87881","name":">70: gotoControlClue","func":"//recupero nome timeline\nvar timeline = flow.get(\"timeline\");\n\n//creo un comando random tra 0 e 10\nvar command = Math.floor((Math.random() * 10) + 1);\n\n//costruisco la stringa da inviare\nvar new_payload = 'gotoControlCue \"' + command + '\" false ' + timeline + '\\n';\n\n//la passo al prossimo blocchetto\nmsg.payload = new_payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":910.88330078125,"y":463.0000305175781,"wires":[["80521cc8.7be9c","ee159b60.1d8ff"]]},{"id":"8c792880.f13c9","type":"function","z":"8bf241d0.87881","name":"else: PLAY","func":"//recupero nome timeline\nvar timeline = flow.get(\"timeline\");\n\n//costruisco la stringa da inviare\nvar new_payload = 'play \"' + timeline + '\"\\n';\n\n//la passo al prossimo blocchetto\nmsg.payload = new_payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":880.88330078125,"y":503.0000305175781,"wires":[["80521cc8.7be9c","ee159b60.1d8ff"]]},{"id":"a5bb28a1.347f2","type":"switch","z":"8bf241d0.87881","name":"Definisci trigger","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"30","vt":"num"},{"t":"gt","v":"70","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":680.88330078125,"y":463.0000305175781,"wires":[["4c1529d.efd3f58"],["269bc17b.0c26e6"],["8c792880.f13c9"]]},{"id":"a3a93f54.8d2768","type":"range","z":"8bf241d0.87881","minin":"0","maxin":"1080","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload","name":"adatta a range 0-100","x":460.88330078125,"y":503.0000305175781,"wires":[["a5bb28a1.347f2","be1f4478.69748"]]},{"id":"390e3b3f.0d452c","type":"function","z":"8bf241d0.87881","name":"normalizza in numero","func":"var value = parseInt(msg.payload);\n\nmsg.payload = value;\nreturn msg;","outputs":1,"noerr":0,"x":400.88330078125,"y":463.0000305175781,"wires":[["a3a93f54.8d2768"]]},{"id":"be1f4478.69748","type":"debug","z":"8bf241d0.87881","name":"Controllo normalizzazione","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":699.88330078125,"y":367.0000305175781,"wires":[]},{"id":"79cc5548.177ab4","type":"inject","z":"8bf241d0.87881","name":"Simula altro valore","topic":"","payload":"550","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":299.88330078125,"y":387.0000305175781,"wires":[["390e3b3f.0d452c"]]},{"id":"22b07d70.be13da","type":"inject","z":"8bf241d0.87881","name":"Simula valore >70%","topic":"","payload":"850","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":299.88330078125,"y":347.0000305175781,"wires":[["390e3b3f.0d452c"]]},{"id":"4f2dc02d.ecd8a8","type":"inject","z":"8bf241d0.87881","name":"Simula valore <30%","topic":"","payload":"300","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":299.88330078125,"y":307.0000305175781,"wires":[["390e3b3f.0d452c"]]},{"id":"f40724c4.019c48","type":"inject","z":"8bf241d0.87881","name":"Definisci Nome Timeline","topic":"","payload":"Timeline 1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":309.88330078125,"y":187.00003051757812,"wires":[["c8619f85.9193a8"]]},{"id":"c8619f85.9193a8","type":"function","z":"8bf241d0.87881","name":"Salva come variabile il Nome Timeline","func":"flow.set(\"timeline\", msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"x":599.88330078125,"y":187.00003051757812,"wires":[[]]},{"id":"ee159b60.1d8ff","type":"websocket out","z":"8bf241d0.87881","name":"","server":"","client":"5223a05f.bee468","x":1214.1666259765625,"y":569.6666870117188,"wires":[]},{"id":"5223a05f.bee468","type":"websocket-client","z":"","path":"ws://192.168.1.48:3040","tls":"","wholemsg":"false"}]
Any help?
What am I doind wrong?