Mqttt json message modifying while keeping intact

Ok , another question about messages.
so i have this coming in from mqtt and i want to modify each A0,A1,A2,A3
I'm assuming they are considered a json array?
mqttmessage
Can i use one function node to modify the value A0, A1,A2 and so on? adding more to it
aka msg.payload.ads1115.a0.psi , msg.payload.ads1115.a0.volts
this is my function node for modifying one after i split them out. but would be nice to have just one function node doing all at once then split them out into there own message with the attributes i really desire.

const sensorValue = msg.payload;
const volts = sensorValue*0.1875/1000
const psi = (volts - 0.5)*30/4
msg.volts = volts
if(psi < 0){
msg.psi = 0 
} else {
 msg.psi = psi
}

return msg;

Right now I use a change node to separate each Analog input, then i use the function above to add voltage and psi to msg.payload

No, they are an object (as denoted by the grey object after the ADS115 key) not an array.

No, because the value of msg.payload.ADS115.a0 is a number, not an object you can not add arbitrary fields to it.

Ok so I need to keep them the way I have then, was trying to use less nodes.
here is my flow

[{"id":"a65a0e317556cf0b","type":"mqtt in","z":"a34699b03789f7a6","name":"","topic":"tele/tas04/SENSOR","qos":"2","datatype":"json","broker":"31a99116.50a74e","nl":false,"rap":true,"rh":0,"inputs":0,"x":296.0086669921875,"y":863.1128540039062,"wires":[["c7c9c6991b52b664","721fd39e5da13ce8","ba19b1dcf1360792","0a3c36f88f17d3af","f32120c5495d6518"]]},{"id":"c7c9c6991b52b664","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":333.1652526855469,"y":784.3815660476685,"wires":[]},{"id":"721fd39e5da13ce8","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A0","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":544.3894844055176,"y":862.1206655502319,"wires":[["8731d39b5a3cc95d"]]},{"id":"f32120c5495d6518","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":552.2026214599609,"y":962.4788284301758,"wires":[["c93c78a61b0ef122"]]},{"id":"0a3c36f88f17d3af","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560.0086669921875,"y":1042.6128540039062,"wires":[["42125c8bfe939e70"]]},{"id":"ba19b1dcf1360792","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A3","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":559.7251892089844,"y":1142.148838043213,"wires":[["dc2edc7e9f41ba5a"]]},{"id":"42125c8bfe939e70","type":"function","z":"a34699b03789f7a6","name":"","func":"const sensorValue = msg.payload;\nconst volts = sensorValue*0.1875/1000\nconst psi = (volts - 0.5)*30/4\n\nif(psi < 0){\nmsg.psi = 0 \n} else {\n msg.psi = psi\n}\nmsg.volts = volts\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":678.9036445617676,"y":999.6198987960815,"wires":[["ebdb39734f10d8f9"]]},{"id":"09ed183c2dcaa150","type":"smooth","z":"a34699b03789f7a6","name":"","property":"psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":745.2166786193848,"y":859.5607662200928,"wires":[["1867e0f0a8419c07","08e7b453237355a0"]]},{"id":"1867e0f0a8419c07","type":"debug","z":"a34699b03789f7a6","name":"WestFermenter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":869.1833953857422,"y":809.3976516723633,"wires":[]},{"id":"2a194c18ce08b5ec","type":"smooth","z":"a34699b03789f7a6","name":"","property":"psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":759.5710487365723,"y":959.8644523620605,"wires":[["f765f4acb6d54d5d","1c54327895af8d58"]]},{"id":"ebdb39734f10d8f9","type":"smooth","z":"a34699b03789f7a6","name":"","property":"psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":779.1085319519043,"y":1042.2670307159424,"wires":[["daf5a8a591262af5","8e41f0a25559b8ce"]]},{"id":"92473a7d3edcc293","type":"smooth","z":"a34699b03789f7a6","name":"","property":"psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":762.6755981445312,"y":1140.3404426574707,"wires":[["252bcc67f4f0c2c9","53336cd71aebd86f"]]},{"id":"f765f4acb6d54d5d","type":"debug","z":"a34699b03789f7a6","name":"CenterFermenter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":881.4970474243164,"y":910.2374134063721,"wires":[]},{"id":"252bcc67f4f0c2c9","type":"debug","z":"a34699b03789f7a6","name":"Extrainput","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":875.2426300048828,"y":1090.8926830291748,"wires":[]},{"id":"08e7b453237355a0","type":"link out","z":"a34699b03789f7a6","name":"West Fermenter Pressure","mode":"link","links":["5e4137c9fb96d24a"],"x":905.2036380767822,"y":857.4317531585693,"wires":[]},{"id":"1c54327895af8d58","type":"link out","z":"a34699b03789f7a6","name":"Center Fermenter Pressure","mode":"link","links":["64e923c9d54a85a8"],"x":898.4060935974121,"y":955.9090261459351,"wires":[]},{"id":"daf5a8a591262af5","type":"link out","z":"a34699b03789f7a6","name":"East Fermenter Pressure","mode":"link","links":["9ef4a9cf492199bf"],"x":906.8262271881104,"y":1041.043049812317,"wires":[]},{"id":"53336cd71aebd86f","type":"link out","z":"a34699b03789f7a6","name":"extra","mode":"link","links":[],"x":909.4216537475586,"y":1139.571210861206,"wires":[]},{"id":"8e41f0a25559b8ce","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":911.0306930541992,"y":1001.307445526123,"wires":[]},{"id":"c93c78a61b0ef122","type":"function","z":"a34699b03789f7a6","name":"","func":"const sensorValue = msg.payload;\nconst volts = sensorValue*0.1875/1000\nconst psi = (volts - 0.5)*30/4\n\nif(psi < 0){\nmsg.psi = 0 \n} else {\n msg.psi = psi\n}\nmsg.volts = volts\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":676.6179695129395,"y":911.9633617401123,"wires":[["2a194c18ce08b5ec"]]},{"id":"dc2edc7e9f41ba5a","type":"function","z":"a34699b03789f7a6","name":"","func":"const sensorValue = msg.payload;\nconst volts = sensorValue*0.1875/1000\nconst psi = (volts - 0.5)*30/4\n\nif(psi < 0){\nmsg.psi = 0 \n} else {\n msg.psi = psi\n}\nmsg.volts = volts\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":677.7074966430664,"y":1092.8306846618652,"wires":[["92473a7d3edcc293"]]},{"id":"8731d39b5a3cc95d","type":"function","z":"a34699b03789f7a6","name":"","func":"const sensorValue = msg.payload;\nconst volts = sensorValue*0.1875/1000\nconst psi = (volts - 0.5)*30/4\n\nif(psi < 0){\nmsg.psi = 0 \n} else {\n msg.psi = psi\n}\nmsg.volts = volts\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":668.9910621643066,"y":818.2609767913818,"wires":[["09ed183c2dcaa150"]]},{"id":"31a99116.50a74e","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

You can use a single function node to convert msg.payload.ads1115.a[0123] to objects though (I'm not sure I copied your calculations correctly):

function myfunction(sensorValue) {
    let volts = sensorValue * 0.1875 / 1000
    let psi = (volts - 0.5) * 30 / 4
    return {
        'sensorValue': sensorValue,
        'psi': psi >= 0 ? psi : 0,
        'volts': volts,
     }
}
msg.payload.ADS115.A0 = myfunction(msg.payload.ADS115.A0);
msg.payload.ADS115.A1 = myfunction(msg.payload.ADS115.A1);
msg.payload.ADS115.A2 = myfunction(msg.payload.ADS115.A2);
msg.payload.ADS115.A3 = myfunction(msg.payload.ADS115.A3);
return msg;

just tried that @jbudd i get this in debug
Screenshot 2022-05-14 173809

figured it out.

its actually msg.payload.ADS1115.A*
it had (3) 1's in it.
now works great.

this is much cleaner! Thanks,

[{"id":"08e7b453237355a0","type":"link out","z":"a34699b03789f7a6","name":"West Fermenter Pressure","mode":"link","links":["5e4137c9fb96d24a"],"x":1119.8473072052002,"y":1239.8679790496826,"wires":[]},{"id":"1c54327895af8d58","type":"link out","z":"a34699b03789f7a6","name":"Center Fermenter Pressure","mode":"link","links":["64e923c9d54a85a8"],"x":1126.124496459961,"y":1274.0610828399658,"wires":[]},{"id":"daf5a8a591262af5","type":"link out","z":"a34699b03789f7a6","name":"East Fermenter Pressure","mode":"link","links":["9ef4a9cf492199bf"],"x":1126.9177951812744,"y":1311.2544403076172,"wires":[]},{"id":"53336cd71aebd86f","type":"link out","z":"a34699b03789f7a6","name":"extra","mode":"link","links":[],"x":1125.1550025939941,"y":1350.9461288452148,"wires":[]},{"id":"0f25d2844dab6c70","type":"mqtt in","z":"a34699b03789f7a6","name":"","topic":"tele/tas04/SENSOR","qos":"2","datatype":"json","broker":"31a99116.50a74e","nl":false,"rap":true,"rh":0,"inputs":0,"x":288.7339172363281,"y":1232.2945556640625,"wires":[["42b5f94c33ed0f9c"]]},{"id":"42b5f94c33ed0f9c","type":"function","z":"a34699b03789f7a6","name":"","func":"function myfunction(sensorValue) {\n    let volts = sensorValue * 0.1875 / 1000\n    let psi = (volts - 0.5) * 30 / 4\n    return {\n        'sensorValue': sensorValue,\n        'psi': psi >= 0 ? psi : 0,\n        'volts': volts,\n     }\n}\nmsg.payload.ADS1115.A0 = myfunction(msg.payload.ADS1115.A0);\nmsg.payload.ADS1115.A1 = myfunction(msg.payload.ADS1115.A1);\nmsg.payload.ADS1115.A2 = myfunction(msg.payload.ADS1115.A2);\nmsg.payload.ADS1115.A3 = myfunction(msg.payload.ADS1115.A3);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":494.1163652211815,"y":1230.1154935715854,"wires":[["c2dc42c4124d837b","833c3e0acc67f8b9","399d26c832b2e85a","8ab64388d0d18770","e1d1d1619369cf78"]]},{"id":"c2dc42c4124d837b","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":486.10155868530273,"y":1182.1747970581055,"wires":[]},{"id":"e1d1d1619369cf78","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A3","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":699.4987411499023,"y":1351.0568504333496,"wires":[["f5ce2b615ada8901"]]},{"id":"8ab64388d0d18770","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700.871711730957,"y":1313.6258735656738,"wires":[["25f235eaf85c535d"]]},{"id":"399d26c832b2e85a","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":696.3343811035156,"y":1271.6264171600342,"wires":[["80cb790f0b22c788"]]},{"id":"833c3e0acc67f8b9","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ADS1115.A0","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":692.8795013427734,"y":1234.4628372192383,"wires":[["037ce65ac4479289","aae54d731e6a2d2d"]]},{"id":"037ce65ac4479289","type":"smooth","z":"a34699b03789f7a6","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":874.9182472229004,"y":1235.5632629394531,"wires":[["7e68191eef3fe4e9","08e7b453237355a0"]]},{"id":"80cb790f0b22c788","type":"smooth","z":"a34699b03789f7a6","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":873.828685760498,"y":1272.608341217041,"wires":[["f22ed4670a2a9d41","1c54327895af8d58"]]},{"id":"25f235eaf85c535d","type":"smooth","z":"a34699b03789f7a6","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":874.9181747436523,"y":1311.83251953125,"wires":[["8c4c2d66b6219e94","daf5a8a591262af5"]]},{"id":"f5ce2b615ada8901","type":"smooth","z":"a34699b03789f7a6","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":876.0078201293945,"y":1347.7881546020508,"wires":[["e461caf46d07a9e9","53336cd71aebd86f"]]},{"id":"7e68191eef3fe4e9","type":"debug","z":"a34699b03789f7a6","name":"West","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1005.8226509094238,"y":1236.65287399292,"wires":[]},{"id":"f22ed4670a2a9d41","type":"debug","z":"a34699b03789f7a6","name":"Center","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1007.6507873535156,"y":1272.6083583831787,"wires":[]},{"id":"8c4c2d66b6219e94","type":"debug","z":"a34699b03789f7a6","name":"East","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1006.7552299499512,"y":1311.8325748443604,"wires":[]},{"id":"e461caf46d07a9e9","type":"debug","z":"a34699b03789f7a6","name":"extra","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1007.6507873535156,"y":1349.9672412872314,"wires":[]},{"id":"aae54d731e6a2d2d","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850.4031379385494,"y":1184.3538897363271,"wires":[]},{"id":"31a99116.50a74e","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

If you like, you can get rid of some change nodes too:

[{"id":"08e7b453237355a0","type":"link out","z":"137f68e90e28a738","name":"West Fermenter Pressure","mode":"link","links":["5e4137c9fb96d24a"],"x":945,"y":280,"wires":[]},{"id":"1c54327895af8d58","type":"link out","z":"137f68e90e28a738","name":"Center Fermenter Pressure","mode":"link","links":["64e923c9d54a85a8"],"x":951.2771892547607,"y":314.1931037902832,"wires":[]},{"id":"daf5a8a591262af5","type":"link out","z":"137f68e90e28a738","name":"East Fermenter Pressure","mode":"link","links":["9ef4a9cf492199bf"],"x":952.0704879760742,"y":351.38646125793457,"wires":[]},{"id":"53336cd71aebd86f","type":"link out","z":"137f68e90e28a738","name":"extra","mode":"link","links":[],"x":950.307695388794,"y":391.0781497955322,"wires":[]},{"id":"0f25d2844dab6c70","type":"mqtt in","z":"137f68e90e28a738","name":"","topic":"tele/tas04/SENSOR","qos":"2","datatype":"json","broker":"31a99116.50a74e","nl":false,"rap":true,"rh":0,"inputs":0,"x":210,"y":340,"wires":[["42b5f94c33ed0f9c"]]},{"id":"42b5f94c33ed0f9c","type":"function","z":"137f68e90e28a738","name":"","func":"let msg0 = {};\nlet msg1 = {};\nlet msg2 = {};\nlet msg3 = {};\nfunction myfunction(sensorValue) {\n    let volts = sensorValue * 0.1875 / 1000\n    let psi = (volts - 0.5) * 30 / 4\n    return {\n        'sensorValue': sensorValue,\n        'psi': psi >= 0 ? psi : 0,\n        'volts': volts,\n     }\n}\nmsg0.payload = myfunction(msg.payload.ADS1115.A0);\nmsg1.payload = myfunction(msg.payload.ADS1115.A1);\nmsg2.payload = myfunction(msg.payload.ADS1115.A2);\nmsg3.payload = myfunction(msg.payload.ADS1115.A3);\nreturn [msg0, msg1, msg2, mg3];\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":340,"wires":[["037ce65ac4479289"],["80cb790f0b22c788"],["25f235eaf85c535d"],["f5ce2b615ada8901"]]},{"id":"037ce65ac4479289","type":"smooth","z":"137f68e90e28a738","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":700.0709400177002,"y":275.6952838897705,"wires":[["7e68191eef3fe4e9","08e7b453237355a0"]]},{"id":"80cb790f0b22c788","type":"smooth","z":"137f68e90e28a738","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":698.9813785552979,"y":312.7403621673584,"wires":[["f22ed4670a2a9d41","1c54327895af8d58"]]},{"id":"25f235eaf85c535d","type":"smooth","z":"137f68e90e28a738","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":700.0708675384521,"y":351.9645404815674,"wires":[["8c4c2d66b6219e94","daf5a8a591262af5"]]},{"id":"f5ce2b615ada8901","type":"smooth","z":"137f68e90e28a738","name":"","property":"payload.psi","action":"mean","count":"10","round":"2","mult":"single","reduce":false,"x":701.1605129241943,"y":387.92017555236816,"wires":[["e461caf46d07a9e9","53336cd71aebd86f"]]},{"id":"7e68191eef3fe4e9","type":"debug","z":"137f68e90e28a738","name":"West","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830.9753437042236,"y":276.7848949432373,"wires":[]},{"id":"f22ed4670a2a9d41","type":"debug","z":"137f68e90e28a738","name":"Center","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":832.8034801483154,"y":312.7403793334961,"wires":[]},{"id":"8c4c2d66b6219e94","type":"debug","z":"137f68e90e28a738","name":"East","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":831.907922744751,"y":351.96459579467773,"wires":[]},{"id":"e461caf46d07a9e9","type":"debug","z":"137f68e90e28a738","name":"extra","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":832.8034801483154,"y":390.0992622375488,"wires":[]},{"id":"31a99116.50a74e","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

thank you @jbudd
i have another question. I tried doing it myself but im missing a step somewhere.
I need to calculate the distance between 2 pressure sensors.
(A1 * 27.72)-(A227.72)=distancebetween sensors
then i need to use that number to calculate the my specific gravity.
((A1 * 27.72)-(A2
27.72))/distancebetween sensors=specific gravity.
then finally i have to use specific gravity to get real water column height..
(A1*27.72)/specific gravity =real water column
then ,
real water column * 1017(surface area of my kettle) = cubic inches of liquid
cubic of inches of liquid * 0.004329 (1 cubic inch of water) = total vollume in gallons.
my issue is grabbing the psi field from msg1 and msg2
to use the calculation properly.
do you have any suggestions?

this is what i tried.

[{"id":"504641de737e27df","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1305.3065567016602,"y":1783.51531124115,"wires":[]},{"id":"e418984ce7f5d6d9","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1095.5643310546875,"y":1861.1485595703125,"wires":[]},{"id":"5dea334096eff75b","type":"function","z":"a34699b03789f7a6","name":"","func":"\nvar upper = msg.upper.psi;\nvar lower = msg.lower.psi;\nvar sensorDist = (lower * 27.72)-(upper*27.72);\nvar specgrav = ((lower * 27.72)-(upper*27.72))/sensorDist;\nvar boilwc = (lower*27.72)/specgrav;\nvar cubicinch = boilwc*1017;\nvar boilVolume = cubicinch*0.004329;\n\nmsg.payload = boilVolume;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1134.7036056518555,"y":1782.66081905365,"wires":[["504641de737e27df"]]},{"id":"65c530439a1f2028","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1112.5643310546875,"y":1705.9210205078125,"wires":[]},{"id":"7718a196838034aa","type":"change","z":"a34699b03789f7a6","name":"set payload to Temperature value","rules":[{"t":"move","p":"payload.psi","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":892,"y":1752,"wires":[["65c530439a1f2028","5dea334096eff75b"]]},{"id":"b0e215125738bb63","type":"change","z":"a34699b03789f7a6","name":"set payload to Temperature value","rules":[{"t":"move","p":"payload.psi","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":888,"y":1809,"wires":[["e418984ce7f5d6d9","5dea334096eff75b"]]},{"id":"0d8231a4dfe728e4","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"lower","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":637.639518737793,"y":1757.7197704315186,"wires":[["ea61ce510ba2fcda","7718a196838034aa"]]},{"id":"4154f6fcae94ac65","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"upper","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":637.6395492553711,"y":1804.4833850860596,"wires":[["b9c3b3508ca03ff0","b0e215125738bb63"]]},{"id":"53bbf35e81420d8e","type":"function","z":"a34699b03789f7a6","name":"","func":"let msg0 = {};\nlet msg1 = {};\nlet msg2 = {};\nlet msg3 = {};\nfunction myfunction(sensorValue) {\n    let volts = sensorValue * 0.1875 / 1000\n    let psi = (volts - 0.5) * 5 / 4\n    //let specgravw = 1\n    //let watercolumn = (psi *27.72) / specgravw\n    //let cubinchs = watercolumn * 1017\n    //let volumeG = cubinchs * 0.004329\n    return {\n        'sensorValue': sensorValue,\n        'psi': psi >= 0 ? psi : 0,\n        'volts': volts,\n      //  'specgravw' : specgravw,\n      //    'watercolumn': watercolumn,\n      //  'cubinchs' : cubinchs,\n      //  'volumeG' : volumeG,\n     }\n}\nmsg0.payload = myfunction(msg.payload.ADS1115.A0);\nmsg1.payload = myfunction(msg.payload.ADS1115.A1);\nmsg2.payload = myfunction(msg.payload.ADS1115.A2);\nmsg3.payload = myfunction(msg.payload.ADS1115.A3);\nreturn [msg0, msg1, msg2, msg3];\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":452.7909240722656,"y":1759.204116821289,"wires":[[],["2a171b6ac5c34fdb","0d8231a4dfe728e4"],["cc38d4986b301ae8","4154f6fcae94ac65"],[]]},{"id":"2a71b465c3426380","type":"mqtt in","z":"a34699b03789f7a6","name":"","topic":"tele/tas04/SENSOR","qos":"2","datatype":"json","broker":"31a99116.50a74e","nl":false,"rap":true,"rh":0,"inputs":0,"x":243.6302490234375,"y":1752.22607421875,"wires":[["a8ce7ae004eb838d","554c17f988a8c05c","53bbf35e81420d8e"]]},{"id":"31a99116.50a74e","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

function code....
should i be setting the payload to global here
and then get global in function?


var upper = msg.upper.psi;
var lower = msg.lower.psi;
var sensorDist = (lower * 27.72)-(upper*27.72);
var specgrav = ((lower * 27.72)-(upper*27.72))/sensorDist;
var boilwc = (lower*27.72)/specgrav;
var cubicinch = boilwc*1017;
var boilVolume = cubicinch*0.004329;

msg.payload = boilVolume;

return msg;

Is this the same sensor data as used to calculate psi and volts?
Can you post a real instance of the data?

Edit since we posted at the same time:

It makes sense to use msg.topic to distinguish the four messages. You can do it in the same function node where they are created:
msg1.topic = "lower";
msg2.topic = "upper";
etc.

Your second function node won't work.
Payloads do not remain available to the function until needed. A message arrives at a node, is processed and then it's gone.
Yes you can store a value in context - which could be global, local to the flow or local to the node. It's best to try and avoid overusing context storage.
Or Join (manually) which uses msg.topic to identify the two data sources.

In this case (not having seen the data) you already have the data you need in the first function node.
Make the calculation there using msg1.payload.psi and msg2.payload.psi. Attach the result to whatever message[s] it will be needed for

yes same sensor data,
I set topic to 2 of the messages (the 2 i need)
to topic upper and lower
then i moved the psi part of the object to payload.
so then should i join the 2 into one .
i did screw up funciton because i was typing
msg.upper.psi but only needed msg.upper

nojoinavail
it cant join per debug ,
so do i need to join manually?

@jbudd
thanks for the nudge.
I re-watched the context help video.
and now I saw how simply I was messing it up.
nailedit

now I have the psi data still going through, but added the specific gravity and the boil volume
(i'll round those numbers off at final destination so i have as high as resolution as i can get.

also note
for anyone wanting to use pressure sensors for volume in beer or any tank.
You must know what your specific gravity of liquid is to get true water column height.
to get digital specific gravity is 2 steps. 3 steps for true water column height.
you need to know the distance between 2 sensors.
so
distance between sensors = (lower sensor psi * 27.72) -( upper sensor psi *27.72) only use this when you have water in kettle (specific gravity must be 1.0000)
after getting distance between sensors. you now have a constant number you chagne the formula in function to the number you collected from the debug node .
specific gravity = ( (lower sensor psi * 27.72) -( upper sensor psi *27.72)) / distance between sensors
finally true water column height = (lower sensor psi * 27.72) / specific gravity
true water column height * area(your surface area of tank) = cubic inches of liquid.
cubic inches of liquid * 0.004329 = Volume in Gallons

my now flow and fucntion

[{"id":"2a71b465c3426380","type":"mqtt in","z":"a34699b03789f7a6","name":"","topic":"tele/tas04/SENSOR","qos":"2","datatype":"json","broker":"31a99116.50a74e","nl":false,"rap":true,"rh":0,"inputs":0,"x":243.6302490234375,"y":1752.22607421875,"wires":[["a8ce7ae004eb838d","554c17f988a8c05c","53bbf35e81420d8e"]]},{"id":"53bbf35e81420d8e","type":"function","z":"a34699b03789f7a6","name":"","func":"let msg0 = {};\nlet msg1 = {};\nlet msg2 = {};\nlet msg3 = {};\nfunction myfunction(sensorValue) {\n    let volts = sensorValue * 0.1875 / 1000\n    let psi = (volts - 0.5) * 5 / 4\n    //let specgravw = 1\n    //let watercolumn = (psi *27.72) / specgravw\n    //let cubinchs = watercolumn * 1017\n    //let volumeG = cubinchs * 0.004329\n    return {\n        'sensorValue': sensorValue,\n        'psi': psi >= 0 ? psi : 0,\n        'volts': volts,\n      //  'specgravw' : specgravw,\n      //    'watercolumn': watercolumn,\n      //  'cubinchs' : cubinchs,\n      //  'volumeG' : volumeG,\n     }\n}\nmsg0.payload = myfunction(msg.payload.ADS1115.A0);\nmsg1.payload = myfunction(msg.payload.ADS1115.A1);\nmsg2.payload = myfunction(msg.payload.ADS1115.A2);\nmsg3.payload = myfunction(msg.payload.ADS1115.A3);\nreturn [msg0, msg1, msg2, msg3];\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":452.7909240722656,"y":1759.204116821289,"wires":[[],["2a171b6ac5c34fdb","0d8231a4dfe728e4"],["cc38d4986b301ae8","4154f6fcae94ac65"],[]]},{"id":"2a171b6ac5c34fdb","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":619.8342895507812,"y":1718.4608612060547,"wires":[]},{"id":"cc38d4986b301ae8","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":614.3698577880859,"y":1843.4739437103271,"wires":[]},{"id":"0d8231a4dfe728e4","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"lower","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":637.639518737793,"y":1757.7197704315186,"wires":[["ea61ce510ba2fcda","7718a196838034aa"]]},{"id":"4154f6fcae94ac65","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"upper","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":637.6395492553711,"y":1804.4833850860596,"wires":[["b9c3b3508ca03ff0","b0e215125738bb63"]]},{"id":"ea61ce510ba2fcda","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":800.7571640014648,"y":1714.82200050354,"wires":[]},{"id":"b9c3b3508ca03ff0","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":803.1916103363037,"y":1844.5768632888794,"wires":[]},{"id":"5dea334096eff75b","type":"function","z":"a34699b03789f7a6","name":"","func":"\nvar upper = msg.payload.upper;\nvar lower = msg.payload.lower;\nvar sensorDist = (lower * 27.72)-(upper*27.72);\nvar specgrav = ((lower * 27.72)-(upper*27.72))/sensorDist;\nvar boilwc = (lower*27.72)/specgrav;\nvar cubicinch = boilwc*1017;\nvar boilVolume = cubicinch*0.004329;\n\nmsg.payload.boilvolume = boilVolume;\nmsg.payload.gravity = specgrav;\nreturn msg;payload.lower","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1474.7041549682617,"y":1740.6609802246094,"wires":[["504641de737e27df"]]},{"id":"504641de737e27df","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1629.306999206543,"y":1768.515525817871,"wires":[]},{"id":"65c530439a1f2028","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1126.5643768310547,"y":1721.9210395812988,"wires":[]},{"id":"e418984ce7f5d6d9","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1155.5643920898438,"y":1829.148639678955,"wires":[]},{"id":"7718a196838034aa","type":"change","z":"a34699b03789f7a6","name":"set payload to Temperature value","rules":[{"t":"move","p":"payload.psi","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":892,"y":1752,"wires":[["65c530439a1f2028","7a4a53cb034dbaa5"]]},{"id":"b0e215125738bb63","type":"change","z":"a34699b03789f7a6","name":"set payload to Temperature value","rules":[{"t":"move","p":"payload.psi","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":888,"y":1809,"wires":[["e418984ce7f5d6d9","7a4a53cb034dbaa5"]]},{"id":"7a4a53cb034dbaa5","type":"join","z":"a34699b03789f7a6","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1144.2223358154297,"y":1776.4098405838013,"wires":[["a8151bbb8d2b8b75","552e27cb369f56a5"]]},{"id":"a8151bbb8d2b8b75","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1304.7814674377441,"y":1741.1009120941162,"wires":[]},{"id":"552e27cb369f56a5","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"pressure","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1312.7848434448242,"y":1785.4585876464844,"wires":[["7ce93d5941140aed","5dea334096eff75b"]]},{"id":"7ce93d5941140aed","type":"debug","z":"a34699b03789f7a6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1489.7709655761719,"y":1811.0903987884521,"wires":[]},{"id":"31a99116.50a74e","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

yes I made a few mistakes and found them. here is function


var upper = msg.payload.upper;
var lower = msg.payload.lower;
var sensorDist = (lower * 27.72)-(upper*27.72);
var specgrav = ((lower * 27.72)-(upper*27.72))/sensorDist;
var boilwc = (lower*27.72)/specgrav;
var cubicinch = boilwc*1017;
var boilVolume = cubicinch*0.004329;

msg.payload.boilvolume = boilVolume;
msg.payload.gravity = specgrav;
return msg;payload.lower

gaugworking

that totally makes sense to me now .

[{"id":"2a71b465c3426380","type":"mqtt in","z":"a34699b03789f7a6","name":"","topic":"tele/tas04/SENSOR","qos":"2","datatype":"json","broker":"31a99116.50a74e","nl":false,"rap":true,"rh":0,"inputs":0,"x":243.6302490234375,"y":1752.22607421875,"wires":[["a8ce7ae004eb838d","554c17f988a8c05c","53bbf35e81420d8e"]]},{"id":"53bbf35e81420d8e","type":"function","z":"a34699b03789f7a6","name":"","func":"let msg0 = {};\nlet msg1 = {};\nlet msg2 = {};\nlet msg3 = {};\nfunction myfunction(sensorValue) {\n    let volts = sensorValue * 0.1875 / 1000\n    let psi = (volts - 0.5) * 5 / 4\n    //let specgravw = 1\n    //let watercolumn = (psi *27.72) / specgravw\n    //let cubinchs = watercolumn * 1017\n    //let volumeG = cubinchs * 0.004329\n    return {\n        'sensorValue': sensorValue,\n        'psi': psi >= 0 ? psi : 0,\n        'volts': volts,\n      //  'specgravw' : specgravw,\n      //    'watercolumn': watercolumn,\n      //  'cubinchs' : cubinchs,\n      //  'volumeG' : volumeG,\n     }\n}\nmsg0.payload = myfunction(msg.payload.ADS1115.A0);\nmsg1.payload = myfunction(msg.payload.ADS1115.A1);\nmsg2.payload = myfunction(msg.payload.ADS1115.A2);\nmsg3.payload = myfunction(msg.payload.ADS1115.A3);\nmsg1.topic = \"lower\";\nmsg2.topic = \"upper\";\nreturn [msg0, msg1, msg2, msg3];\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":452.7909240722656,"y":1759.204116821289,"wires":[[],["7718a196838034aa"],["b0e215125738bb63"],[]]},{"id":"5dea334096eff75b","type":"function","z":"a34699b03789f7a6","name":"","func":"\nvar upper = msg.payload.upper;\nvar lower = msg.payload.lower;\nvar sensorDist = (lower * 27.72)-(upper*27.72);// this only works with water at specific gravity of 1.000 change formula to number you collect on first run\nvar specgrav = ((lower * 27.72)-(upper*27.72))/sensorDist;\nvar boilwc = (lower*27.72)/specgrav;\nvar cubicinch = boilwc*1017;\nvar boilVolume = cubicinch*0.004329;\n\nmsg.payload.boilvolume = boilVolume;\nmsg.payload.gravity = specgrav;\nreturn msg;payload.lower","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1044.7041358947754,"y":1723.661060333252,"wires":[["504641de737e27df","a533cc071d544180"]]},{"id":"504641de737e27df","type":"debug","z":"a34699b03789f7a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1148.3071327209473,"y":1770.515552520752,"wires":[]},{"id":"7718a196838034aa","type":"change","z":"a34699b03789f7a6","name":"set payload to PSI value","rules":[{"t":"move","p":"payload.psi","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":652.0000457763672,"y":1726.9999885559082,"wires":[["7a4a53cb034dbaa5"]]},{"id":"b0e215125738bb63","type":"change","z":"a34699b03789f7a6","name":"set payload to PSI value","rules":[{"t":"move","p":"payload.psi","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":649.0000305175781,"y":1772.0001106262207,"wires":[["7a4a53cb034dbaa5"]]},{"id":"7a4a53cb034dbaa5","type":"join","z":"a34699b03789f7a6","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":852.2224006652832,"y":1726.409839630127,"wires":[["552e27cb369f56a5"]]},{"id":"552e27cb369f56a5","type":"change","z":"a34699b03789f7a6","name":"","rules":[{"t":"set","p":"pressure","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":945.784839630127,"y":1770.4587287902832,"wires":[["5dea334096eff75b"]]},{"id":"a533cc071d544180","type":"link out","z":"a34699b03789f7a6","name":"Boil Volume","mode":"link","links":["d3730ac5b85a4c2d"],"x":1183.890781402588,"y":1724.7911567687988,"wires":[]},{"id":"31a99116.50a74e","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

This is how I would do it, all in that first function node because the data you need is already there. So no unnecessary Change and Join nodes. Code stripped down a bit for compactness. I've assumed you need the boilvolume and gravity in a seperate message, but you could attach those values to msg[0123] instead.

let msg0 = {};
let msg1 = {};
let msg2 = {};
let msg3 = {};
let msg4 = {};
function myfunction(sensorValue) {
    let volts = sensorValue * 0.1875 / 1000
    let psi = (volts - 0.5) * 5 / 4
    return {'sensorValue': sensorValue, 'psi': psi >= 0 ? psi : 0, 'volts': volts,};
}

msg0.payload = myfunction(msg.payload.ADS1115.A0);
msg1.payload = myfunction(msg.payload.ADS1115.A1);
msg2.payload = myfunction(msg.payload.ADS1115.A2);
msg3.payload = myfunction(msg.payload.ADS1115.A3);

let upper = msg1.payload.psi;
let lower = msg2.payload.psi;
let sensorDist = (lower * 27.72) - (upper * 27.72);// this only works with water at specific gravity of 1.000 change formula to number you collect on first run
let specgrav = ((lower * 27.72) - (upper * 27.72)) / sensorDist;
let boilwc = (lower * 27.72) / specgrav;
let cubicinch = boilwc * 1017;
let boilVolume = cubicinch * 0.004329;
msg4.payload = {'boilVolume': boilVolume, 'gravity': specgrav};
return [msg0, msg1, msg2, msg3, msg4];

I just left, for a wedding, but yes that is awesome and shows, that I have a lot to learn! Thanks a bunch @jbudd via Node-RED Forum