Can Node Red Dashboard read floating Variables

HI,

I am trying to create a dashboard in Node Red, but it wont show the value of a floating variable. But it does work for an IO value.

Is there something that i need to do to be able to see the floating variable there?

thanks

Hector

I see no reason why Node Red dashboard would not display a float.

Can you share your flow and screenshot of your dashboard?

I import my floats from a Float Table to Global Context using the conveniently provided ‘node-red-contrib-pac’ node from the Palette and they work fine in Node-RED.

[{"id":"5790c595.9407b4","type":"function","z":"610c8b68.e3dfec","name":"Populate Floats","func":"var index = 0;\nlet OutsideTemperature = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('OutsideTemperature', OutsideTemperature);\nindex ++;\nlet BoilerInput = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BoilerInput',BoilerInput);\nindex ++;\nlet BoilerOutput = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BoilerOutput',BoilerOutput);\nindex ++;\nlet HotWater = parseFloat(msg.PACFloatsTable[index]); //.toFixed( 3 );\nglobal.set('HotWater',HotWater);\nindex ++;\nlet HotWaterTop = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('HotWaterTop',HotWaterTop);\nindex ++;\nlet LivingRoomTemp = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('LivingRoomTemp',LivingRoomTemp);\nindex ++;\nlet RoomTemp = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('incomingTemperature',RoomTemp);\nindex ++;\nlet RoomHum = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('RoomHum',RoomHum);\nindex ++;\nlet RoomDew = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('RoomDew',RoomDew);\nindex ++;\nlet RoomPress = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('RoomPress',RoomPress);\nindex ++;\nlet RoomLux = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('RoomLux',RoomLux);\nindex ++;\nlet BedsTemp = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BedsTemp',BedsTemp);\nindex ++;\nlet BedsHum = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BedsHum',BedsHum);\nindex ++;\nlet BedsDew = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BedsDew',BedsDew);\nindex ++;\nlet BedsPress = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BedsPress',BedsPress);\nindex ++;\nlet BedsLux = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BedsLux', BedsLux);\nindex ++;\nlet CloaksTemp = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('CloaksTemp', CloaksTemp);\nindex ++;\nlet CloaksHum = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('CloaksHum', CloaksHum);\nindex ++;\nlet CloaksDew = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('CloaksDew', CloaksDew);\nindex ++;\nlet CloaksPress = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('CloaksPress', CloaksPress);\nindex ++;\nlet CloaksGas = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('CloaksGas', CloaksGas);\nindex ++;\nlet Box1Temp = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BoxTemp', Box1Temp);\nindex ++;\nlet Box1Hum = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BoxHum', Box1Hum);\nindex ++;\nlet Box1Dew = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BoxDew', Box1Dew);\nindex ++;\nlet Box1Press = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('BoxPress', Box1Press);\nindex ++;\nlet Box1lux = parseFloat(msg.PACFloatsTable[index]).toFixed( 1 );\nglobal.set('Boxlux', Box1lux);\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":200,"wires":[["bf4d52a6.171b5"]]},{"id":"ece3efd2.736f98","type":"function","z":"610c8b68.e3dfec","name":"Populate Int32","func":"//var n = (msg.nDigital_Outputs1).toString(2);\n//n = \"0000000000000000\".substr(n.length) + n;\n//node.status({text:n});\nlet nDigital_Outputs1 = parseInt(msg.PACInt32Table[0]);\nglobal.set('nDigital_Outputs1',nDigital_Outputs1);\n\nlet nDigital_Outputs2 = parseInt(msg.PACInt32Table[1]);\nglobal.set('nDigital_Outputs2',nDigital_Outputs2);\n\nlet nDigital_Outputs3 = parseInt(msg.PACInt32Table[2]);\nglobal.set('nDigital_Outputs3',nDigital_Outputs3);\n\nlet CHDesired = parseFloat(msg.PACInt32Table[3]).toFixed(1);\nglobal.set('CHDesired',CHDesired);\n\nlet HWDesired = parseFloat(msg.PACInt32Table[4]).toFixed(1);\nglobal.set('HWDesired',HWDesired);\n\nlet BedsDesired = parseFloat(msg.PACInt32Table[5]).toFixed(1);\nglobal.set('BedsDesired',BedsDesired);\n\nlet TempsManual = parseFloat(msg.PACInt32Table[6]).toFixed(1);\nglobal.set('TempsManual',TempsManual);\n\nlet BoilerDesired = parseFloat(msg.PACInt32Table[7]).toFixed(1);\nglobal.set('BoilerDesired', BoilerDesired);\n\nlet nManualSwitches = parseFloat(msg.PACInt32Table[8]).toFixed(1);\nglobal.set('nManualSwitches',nManualSwitches);\n\nlet nTempsCH = parseFloat(msg.PACInt32Table[9]).toFixed(1);\nglobal.set('nTempsCH', nTempsCH);\n\nlet nTempsHW = parseFloat(msg.PACInt32Table[10]).toFixed(1);\nglobal.set('nTempsHW',nTempsHW);\n\nlet nTempsBeds = parseFloat(msg.PACInt32Table[11]).toFixed(1);\nglobal.set('nTempsBeds', nTempsBeds);\n\nlet nTempBoiler = parseFloat(msg.PACInt32Table[12]).toFixed(1);\nglobal.set('nTempBoiler',nTempBoiler);\n\nlet nSonoffStatus = parseInt(msg.PACInt32Table[13]);\nglobal.set('nSonoffStatus',nSonoffStatus);\n\nlet nTempShower = parseInt(msg.PACInt32Table[14]);\nglobal.set('nTempShower',nTempShower);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1179,"y":200,"wires":[["badbbc39.d53ea8"]]},{"id":"37c1cfa3.a3b15","type":"pac-read","z":"610c8b68.e3dfec","device":"f4904bba.fd9e78","dataType":"float-table","tagName":"ftNRFloats","tableStartIndex":"","tableLength":"","value":"PACFloatsTable","valueType":"msg","topic":"","topicType":"none","name":"","x":610,"y":200,"wires":[["5008d447.d3f5c4","5790c595.9407b4"]]},{"id":"bf4d52a6.171b5","type":"pac-read","z":"610c8b68.e3dfec","device":"f4904bba.fd9e78","dataType":"int32-table","tagName":"ntNRInt32","tableStartIndex":"","tableLength":"","value":"PACInt32Table","valueType":"msg","topic":"","topicType":"none","name":"","x":989,"y":200,"wires":[["ece3efd2.736f98","61cdae74.9a85a8"]]},{"id":"f4904bba.fd9e78","type":"pac-device","address":"172.27.123.55","protocol":"http","msgQueueFullBehavior":"DROP_OLD"}]

In my use case, this is done in a ‘Power Up’ Flow in Node-RED and then refreshed every x seconds. Once in Global Context, you can do as you wish, including modifying the Opto Float Table.

HTH

It should just be plug and play as you can tell from the other answers.

Here is the most simple form for showing a float on the dashboard.

image

Here is where the msg.payload with 22.44 is coming from.

Here is the text node showing the msg.payload.

Of course the ‘Label:’ can be any text you need.

Do you have some similar screenshots of your setup that you can share with the forums so we can get you up and running?

Thanks Guys, your input helped.

I ended just using the function node, worked like a charm.

thanks

Hector