I found doing this is much easier with node-red. 4 simple nodes uploading data to InfluxDB and using grafana. If anyone is interested in importing the JSON I’ll leave it below. You’ll have to enter your correct serial port number and database credentials.
[{“id”:“9208c24cfbc1368a”,“type”:“tab”,“label”:“SDI-12 to InfluxDB”,“disabled”:false,“info”:“”},{“id”:“365c44977bd7e5d8”,“type”:“influxdb out”,“z”:“9208c24cfbc1368a”,“influxdb”:“39f3b86e.898e82”,“name”:“Store in InfluxDB”,“measurement”:“sensor_data”,“precision”:“”,“retentionPolicy”:“”,“database”:“”,“retentionPolicyV18Flux”:“”,“org”:“”,“bucket”:“”,“x”:770,“y”:80,“wires”:},{“id”:“08a9be70a83aa3cd”,“type”:“inject”,“z”:“9208c24cfbc1368a”,“name”:“Trigger Command”,“props”:[{“p”:“payload”}],“repeat”:“10”,“crontab”:“”,“once”:true,“onceDelay”:0.1,“topic”:“”,“payload”:“1R0!”,“payloadType”:“str”,“x”:130,“y”:80,“wires”:[[“2c86100ae8c196f8”]]},{“id”:“c2891a5cb0dad5b6”,“type”:“debug”,“z”:“9208c24cfbc1368a”,“name”:“debug 2”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“statusVal”:“”,“statusType”:“auto”,“x”:840,“y”:480,“wires”:},{“id”:“2c86100ae8c196f8”,“type”:“serial request”,“z”:“9208c24cfbc1368a”,“name”:“”,“serial”:“ed6024ea.e1b668”,“x”:350,“y”:80,“wires”:[[“52f778e6aa58fb9c”,“c2891a5cb0dad5b6”]]},{“id”:“52f778e6aa58fb9c”,“type”:“function”,“z”:“9208c24cfbc1368a”,“name”:“function 1”,“func”:“var data = msg.payload;\nvar temp = data.split("+");\nvar out = {};\n\n// Extract values and convert to numbers\nout["VWC"] = Number(temp[1]);\nout["Temp"] = Number(temp[2]);\nout["EC"] = Number(temp[3]); // Corrected index for EC\n\n// Calculate dielectric permittivity of the bulk soil (epsilon_b) using VWC\nvar epsilon_b = Math.pow(\n 2.887e-9 * Math.pow(out["VWC"], 3) -\n 2.080e-5 * Math.pow(out["VWC"], 2) +\n 5.276e-2 * out["VWC"] - 43.39, 2\n);\n\n// Set the generic offset for dry soil\nvar epsilon_zero = 4.1;\n\n// Calculate dielectric permittivity of the soil pore water (epsilon_p)\nvar temperature = out["Temp"];\nvar epsilon_p = (80.3 - 0.37 * (temperature - 20));\n\n// Calculate pore water EC\nout["porewaterEC"] = (epsilon_p / (epsilon_b - epsilon_zero));\n\n// Calculate adjustedVWC using the adjusted formula\nout["adjustedVWC"] = (\n (6.771e-10 * Math.pow(out["VWC"], 3) -\n 5.105e-6 * Math.pow(out["VWC"], 2) +\n 1.302e-2 * out["VWC"] - 10.848) * 100\n);\n\n\nmsg.payload = out;\nreturn msg;\n”,“outputs”:1,“timeout”:0,“noerr”:0,“initialize”:“”,“finalize”:“”,“libs”:,“x”:560,“y”:80,“wires”:[[“365c44977bd7e5d8”,“c2891a5cb0dad5b6”]]},{“id”:“39f3b86e.898e82”,“type”:“influxdb”,“hostname”:“111.111.111.111”,“port”:“8086”,“protocol”:“http”,“database”:“enteryourdbhere”,“name”:“InfluxDB”,“usetls”:false,“tls”:“”,“influxdbVersion”:“1.x”,“url”:“”,“rejectUnauthorized”:false},{“id”:“ed6024ea.e1b668”,“type”:“serial-port”,“serialport”:“/dev/ttyUSB0”,“serialbaud”:“9600”,“databits”:“8”,“parity”:“none”,“stopbits”:“1”,“waitfor”:“”,“newline”:“\n”,“bin”:“false”,“out”:“char”,“addchar”:“”,“responsetimeout”:“10000”}]