@Vincent OK, habe es so gemacht.
Bekomme als payload folgenden Wert:
msg.payload : string[81]
“Axis X: 233.68↵Axis Y: 169.28↵Axis Z: 1.84↵Declination: 2° 15’↵Heading: 38° 10’↵↵”
Wollte diesen nun extrahieren, bekomme es aber nicht hin. Werde mit JASON + Change, noch als function.
Anbei meine test nodes:
[{"id":"b6aaa53e0f2a6a6a","type":"debug","z":"0d480fc2f6a2fd31","name":"debug 29","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1340,"y":480,"wires":[]},{"id":"fd7ed752c3b8e12e","type":"inject","z":"0d480fc2f6a2fd31","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":480,"wires":[["1cb6f8c46233fe1d"]]},{"id":"1cb6f8c46233fe1d","type":"exec","z":"0d480fc2f6a2fd31","command":"sudo timeout 5 python3 /home/pi/quick2wire-python-api/GY-271.py","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":500,"y":480,"wires":[["fd5b7003ac65d3f5","b67bc9b08b4f18e4"],[],[]]},{"id":"fd5b7003ac65d3f5","type":"function","z":"0d480fc2f6a2fd31","name":"set result","func":"if (msg.payload.includes(\":\")) {\n\n var lines = msg.payload.split(/\\r?\\n/);\n var outp = [];\n outp[0] = { payload: lines[0] };\n outp[1] = { payload: lines[1] };\n outp[2] = { payload: lines[2] };\n outp[3] = { payload: lines[1] };\n outp[4] = { payload: lines[2] };\n return [outp];\n\n}\nelse {\n msg.payload = \"Test2 \"\n return msg\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":480,"wires":[["b6aaa53e0f2a6a6a"]]},{"id":"b67bc9b08b4f18e4","type":"debug","z":"0d480fc2f6a2fd31","name":"debug 30","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":360,"wires":[]}]
Könntest du mir helfen die Werte in Zahlen und Vraiablen zu extrahieren oder mir ein Beispiel geben?