Valor de temperatura negativo

I have a problem where a temperature indicator has a totally different value when the temperature is negative as shown in the image next to the green circle
when it is positive the value is coming correct according to the blue circle image
Can someone help me ? I've been watching several videos and the node red forum but I haven't found anything to help me

[{"id":"58ca183f.a36258","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"9cb98268.60314","type":"modbus-read","z":"58ca183f.a36258","name":"Temp Ambiente Camara 1","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"13","dataType":"HoldingRegister","adr":"0","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"10","server":"5e1ce40.8185c1c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":250,"y":80,"wires":[["1e68c8ff.a4deb7"],[]]},{"id":"fdb0d9e1.1c54c8","type":"modbus-read","z":"58ca183f.a36258","name":"Temp Carcaça Camara 1","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"14","dataType":"HoldingRegister","adr":"0","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"10","server":"5e1ce40.8185c1c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":250,"y":140,"wires":[["118da5e5.99fc7a"],[]]},{"id":"1e68c8ff.a4deb7","type":"function","z":"58ca183f.a36258","name":"Multiplicador/Casas Decimais","func":"msg.payload = (msg.payload [0]* 1);\nmsg.payload = parseFloat(msg.payload.toFixed(2))\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":80,"wires":[["a7fe61f8.77b02"]]},{"id":"118da5e5.99fc7a","type":"function","z":"58ca183f.a36258","name":"Multiplicador/Casas Decimais","func":"msg.payload = (msg.payload [0]* 0.1);\nmsg.payload = parseFloat(msg.payload.toFixed(2))\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":140,"wires":[["b1a26dab.04392"]]},{"id":"a7fe61f8.77b02","type":"debug","z":"58ca183f.a36258","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":80,"wires":[]},{"id":"b1a26dab.04392","type":"debug","z":"58ca183f.a36258","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":140,"wires":[]},{"id":"5e1ce40.8185c1c","type":"modbus-client","z":"","name":"ETH - 485","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":true,"tcpHost":"10.254.164.119","tcpPort":"3001","tcpType":"TPC-RTU-BUFFERED","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"","commandDelay":"1000","clientTimeout":"2000","reconnectOnTimeout":true,"reconnectTimeout":"1000","parallelUnitIdsAllowed":true}]

Please see this post for how to paste a flow here so it can be imported again.

Show us what is going into the function nodes. Are the two function nodes the same?

What value are you expecting?

Do you have a manual that shows the format of the data in the modbus address?

It is likely your functions are not correct or some byteswapping might be necessary.

the buffer-parser node is a big help for modbus type data conversions

using the buffer-parser I was able to get the temperature value both negative and positive
Now I need to add decimal places with the function I have I can't
at the moment the negative temperature is -24.6 ºC
positive temperature is at 9.0 ºC

(multiplier and decimal places function)

Preformatted text`msg.payload = (msg.payload [0]* 0.1);
msg.payload = parseFloat(msg.payload.toFixed(2))
return msg;


[{"id":"58ca183f.a36258","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"9cb98268.60314","type":"modbus-read","z":"58ca183f.a36258","name":"Temp Ambiente Camara 1","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"25","dataType":"HoldingRegister","adr":"0","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"10","server":"5e1ce40.8185c1c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":250,"y":80,"wires":[["2115d4f7.a70a9c"],[]]},{"id":"fdb0d9e1.1c54c8","type":"modbus-read","z":"58ca183f.a36258","name":"Temp Carcaça Camara 1","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"14","dataType":"HoldingRegister","adr":"0","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"10","server":"5e1ce40.8185c1c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":250,"y":140,"wires":[["3b6614b0.aea81c"],[]]},{"id":"1e68c8ff.a4deb7","type":"function","z":"58ca183f.a36258","name":"Multiplicador/Casas Decimais","func":"msg.payload = (msg.payload [0]* 0.1);\nmsg.payload = parseFloat(msg.payload.toFixed(2))\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":260,"wires":[[]]},{"id":"a7fe61f8.77b02","type":"debug","z":"58ca183f.a36258","name":"Temp Ambiente Camara 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":80,"wires":[]},{"id":"b1a26dab.04392","type":"debug","z":"58ca183f.a36258","name":"Temp Ambiente Carcaca 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":140,"wires":[]},{"id":"2115d4f7.a70a9c","type":"buffer-parser","z":"58ca183f.a36258","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"Temperatura","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":470,"y":80,"wires":[["a7fe61f8.77b02"]]},{"id":"3b6614b0.aea81c","type":"buffer-parser","z":"58ca183f.a36258","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"Temperatura","offset":0,"length":0,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":470,"y":140,"wires":[["b1a26dab.04392"]]},{"id":"5e1ce40.8185c1c","type":"modbus-client","z":"","name":"ETH - 485","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":true,"tcpHost":"10.254.164.119","tcpPort":"3001","tcpType":"TPC-RTU-BUFFERED","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"","commandDelay":"1000","clientTimeout":"2000","reconnectOnTimeout":true,"reconnectTimeout":"1000","parallelUnitIdsAllowed":true}]

just set the scale expression in the buffer parser to / 10

its all in the built in help

the multiplier worked but we still have many decimal places
using the function

msg.payload = parseFloat(msg.payload.toFixed(2))
return msg;


You should only do this for presentation (e.g. dashboard)

msg.payload = msg.payload.Temperatura.toFixed(2)
return msg;

ok, all right here thanks!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.