You might find node-red is a bit easier, available as a signalk app in the app store.
This is for random wind direction, outputs UDP over port 10112 so you need to create a server connection for nmea0183/UDP port 10112 >
Copy then in the node-red editor press ctrl & i to insert.
Or the SKSIm app is very good for testing.
This is for random wind direction, outputs UDP over port 10112 so you need to create a server connection for nmea0183/UDP port 10112 >
Code:
[{"id":"bf02070e.166bf8","type":"inject","z":"f792bbef.555918","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":340,"wires":[["c66ee625.6bcd28"]]},{"id":"c66ee625.6bcd28","type":"random","z":"f792bbef.555918","name":"","low":"1","high":"10","inte":"true","property":"payload","x":120,"y":400,"wires":[["4f4e9fcd.f86bb"]]},{"id":"4f4e9fcd.f86bb","type":"function","z":"f792bbef.555918","name":"RandomWindDirection","func":"// msg.payload = \"$WIMWV,270.0,R,15.0,N,A*36\\r\\n\";\nvar temp = msg.payload * 36;\n// $ERRPM,E,1,2000,,,,*2\n\nmsg.temp = \"WIMWV,\" + temp + \",R,15.0,N,A\";\n\nvar nmea = msg.temp;\nvar checksum = 0; \n\nfor(var i = 0; i < nmea.length; i++) { \n checksum = checksum ^ nmea.charCodeAt(i); \n}\nchecksum = checksum.toString(16); //convert to hex\nnmea = '$' + nmea + '*' + checksum; //make the full nmea sentence again\n\nmessage = nmea + '\\r\\n';\n\n\nmsg.payload = message;\nreturn msg;\n\n","outputs":1,"noerr":0,"x":300,"y":400,"wires":[["9749b954.a12318","8a03fcb3.c1274"]]},{"id":"9749b954.a12318","type":"debug","z":"f792bbef.555918","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":370,"y":340,"wires":[]},{"id":"8a03fcb3.c1274","type":"udp out","z":"f792bbef.555918","name":"","addr":"127.0.0.1","iface":"","port":"10112","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":540,"y":400,"wires":[]}]
Copy then in the node-red editor press ctrl & i to insert.
Or the SKSIm app is very good for testing.